getSetByTcgplayerId method

Future<MtgSet> getSetByTcgplayerId(
  1. int tcgplayerId
)

GET /sets/tcgplayer/:id

Returns a MtgSet with the given tcgplayerId, also known as the group_id on TCGPlayer's API.

Implementation

Future<MtgSet> getSetByTcgplayerId(int tcgplayerId) async {
  final url = Uri.https(_baseUrl, '/sets/tcgplayer/$tcgplayerId');
  final response = await _httpClient.get(url);

  final json = jsonDecode(response.body) as Map<String, dynamic>;

  if (response.statusCode != 200) {
    throw ScryfallException.fromJson(json);
  }

  return MtgSet.fromJson(json);
}