getRulingsBySetCodeAndCollectorNumber method
GET /cards/:code/:number/rulings
Returns a PaginableList
of Rulings for a card with the
given setCode
and collectorNumber
.
Implementation
Future<PaginableList<Ruling>> getRulingsBySetCodeAndCollectorNumber(
String setCode,
String collectorNumber,
) async {
final url = Uri.https(
_baseUrl,
'/cards/$setCode/$collectorNumber/rulings',
);
final response = await _httpClient.get(url);
final json = jsonDecode(response.body) as Map<String, dynamic>;
if (response.statusCode != 200) {
throw ScryfallException.fromJson(json);
}
return PaginableList.fromJson(
json,
(ruling) => Ruling.fromJson(ruling as Map<String, dynamic>),
);
}