getVendors static method

Future<DestinyVendorsResponseResponse> getVendors(
  1. HttpClient client,
  2. String characterId,
  3. List<DestinyComponentType> components,
  4. String destinyMembershipId,
  5. DestinyVendorFilter filter,
  6. BungieMembershipType membershipType,
)

Get currently available vendors from the list of vendors that can possibly have rotating inventory. Note that this does not include things like preview vendors and vendors-as-kiosks, neither of whom have rotating/dynamic inventories. Use their definitions as-is for those.

Implementation

static Future<DestinyVendorsResponseResponse> getVendors (
    HttpClient client,
    String characterId,
    List<DestinyComponentType> components,
    String destinyMembershipId,
    DestinyVendorFilter filter,
    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();
    params['filter'] = filter.value;
    final HttpClientConfig config = HttpClientConfig('GET', '/Destiny2/$_membershipType/Profile/$_destinyMembershipId/Character/$_characterId/Vendors/', params);
    config.bodyContentType = null;
    final HttpResponse response = await client.request(config);
    if(response.statusCode == 200) {
        return DestinyVendorsResponseResponse.asyncFromJson(response.mappedBody);
    }
    throw Exception(response.mappedBody);
}