getRulingsByMtgoId method

Future<PaginableList<Ruling>> getRulingsByMtgoId(
  1. int mtgoId
)

GET /cards/mtgo/:id/rulings

Returns a PaginableList of Rulings for a card with the given mtgoId.

The mtgoId can either be the card’s mtgo_id or its mtgo_foil_id.

Implementation

Future<PaginableList<Ruling>> getRulingsByMtgoId(int mtgoId) async {
  final url = Uri.https(_baseUrl, '/cards/mtgo/$mtgoId/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>),
  );
}