getCharacter static method

Future<DestinyCharacterResponseResponse> getCharacter(
  1. HttpClient client,
  2. String characterId,
  3. List<DestinyComponentType> components,
  4. String destinyMembershipId,
  5. BungieMembershipType membershipType,
)

Returns character information for the supplied character.

Implementation

static Future<DestinyCharacterResponseResponse> getCharacter (
    HttpClient client,
    String characterId,
    List<DestinyComponentType> components,
    String destinyMembershipId,
    BungieMembershipType membershipType,
) async {
    final Map<String, dynamic> params = Map<String, dynamic>();
    final String _characterId = '$characterId';
    final String _destinyMembershipId = '$destinyMembershipId';
    final String _membershipType = '${membershipType.value}';
    params['components'] = components.map((DestinyComponentType components)=>components.value).toList();
    final HttpClientConfig config = HttpClientConfig('GET', '/Destiny2/$_membershipType/Profile/$_destinyMembershipId/Character/$_characterId/', params);
    config.bodyContentType = null;
    final HttpResponse response = await client.request(config);
    if(response.statusCode == 200) {
        return DestinyCharacterResponseResponse.asyncFromJson(response.mappedBody);
    }
    throw Exception(response.mappedBody);
}