getHistoricalStats static method

Future<DestinyHistoricalStatsResultsResponse> getHistoricalStats(
  1. HttpClient client,
  2. String characterId,
  3. String dayend,
  4. String daystart,
  5. String destinyMembershipId,
  6. List<DestinyStatsGroupType> groups,
  7. BungieMembershipType membershipType,
  8. List<DestinyActivityModeType> modes,
  9. PeriodType periodType,
)

Gets historical stats for indicated character.

Implementation

static Future<DestinyHistoricalStatsResultsResponse> getHistoricalStats (
    HttpClient client,
    String characterId,
    String dayend,
    String daystart,
    String destinyMembershipId,
    List<DestinyStatsGroupType> groups,
    BungieMembershipType membershipType,
    List<DestinyActivityModeType> modes,
    PeriodType periodType,
) async {
    final Map<String, dynamic> params = Map<String, dynamic>();
    final String _characterId = '$characterId';
    final String _destinyMembershipId = '$destinyMembershipId';
    final String _membershipType = '${membershipType.value}';
    params['dayend'] = dayend;
    params['daystart'] = daystart;
    params['groups'] = groups.map((DestinyStatsGroupType groups)=>groups.value).toList();
    params['modes'] = modes.map((DestinyActivityModeType modes)=>modes.value).toList();
    params['periodType'] = periodType.value;
    final HttpClientConfig config = HttpClientConfig('GET', '/Destiny2/$_membershipType/Account/$_destinyMembershipId/Character/$_characterId/Stats/', params);
    config.bodyContentType = null;
    final HttpResponse response = await client.request(config);
    if(response.statusCode == 200) {
        return DestinyHistoricalStatsResultsResponse.asyncFromJson(response.mappedBody);
    }
    throw Exception(response.mappedBody);
}