getCatalog method
GET /catalog/:catalog-type
Returns a Catalog
with a List of Magic datapoints.
catalogType
: The type of catalog that shall be returned.
Implementation
Future<Catalog> getCatalog(CatalogType catalogType) async {
final url = Uri.https(_baseUrl, '/catalog/${catalogType.urlEncoding}');
final response = await _httpClient.get(url);
final json = jsonDecode(response.body) as Map<String, dynamic>;
if (response.statusCode != 200) {
throw ScryfallException.fromJson(json);
}
return Catalog.fromJson(json);
}