getDestinyEntityDefinition static method
Future<DestinyDefinitionResponse>
getDestinyEntityDefinition(
- HttpClient client,
- String entityType,
- int hashIdentifier
Returns the static definition of an entity of the given Type and hash identifier. Examine the API Documentation for the Type Names of entities that have their own definitions. Note that the return type will always inherit from DestinyDefinition, but the specific type returned will be the requested entity type if it can be found. Please don't use this as a chatty alternative to the Manifest database if you require large sets of data, but for simple and one-off accesses this should be handy.
Implementation
static Future<DestinyDefinitionResponse> getDestinyEntityDefinition (
HttpClient client,
String entityType,
int hashIdentifier,
) async {
final Map<String, dynamic> params = Map<String, dynamic>();
final String _entityType = '$entityType';
final String _hashIdentifier = '$hashIdentifier';
final HttpClientConfig config = HttpClientConfig('GET', '/Destiny2/Manifest/$_entityType/$_hashIdentifier/', params);
config.bodyContentType = null;
final HttpResponse response = await client.request(config);
if(response.statusCode == 200) {
return DestinyDefinitionResponse.asyncFromJson(response.mappedBody);
}
throw Exception(response.mappedBody);
}