getLeaderboardsForCharacter static method

Future<DestinyLeaderboardResultsResponse> getLeaderboardsForCharacter(
  1. HttpClient client,
  2. String characterId,
  3. String destinyMembershipId,
  4. int maxtop,
  5. BungieMembershipType membershipType,
  6. String modes,
  7. String statid,
)

Gets leaderboards with the signed in user's friends and the supplied destinyMembershipId as the focus. PREVIEW: This endpoint is still in beta, and may experience rough edges. The schema is in final form, but there may be bugs that prevent desirable operation.

Implementation

static Future<DestinyLeaderboardResultsResponse> getLeaderboardsForCharacter (
    HttpClient client,
    String characterId,
    String destinyMembershipId,
    int maxtop,
    BungieMembershipType membershipType,
    String modes,
    String statid,
) async {
    final Map<String, dynamic> params = Map<String, dynamic>();
    final String _characterId = '$characterId';
    final String _destinyMembershipId = '$destinyMembershipId';
    final String _membershipType = '${membershipType.value}';
    params['maxtop'] = maxtop;
    params['modes'] = modes;
    params['statid'] = statid;
    final HttpClientConfig config = HttpClientConfig('GET', '/Destiny2/Stats/Leaderboards/$_membershipType/$_destinyMembershipId/$_characterId/', params);
    config.bodyContentType = null;
    final HttpResponse response = await client.request(config);
    if(response.statusCode == 200) {
        return DestinyLeaderboardResultsResponse.asyncFromJson(response.mappedBody);
    }
    throw Exception(response.mappedBody);
}