getRulingsByMultiverseId method

Future<PaginableList<Ruling>> getRulingsByMultiverseId(
  1. int multiverseId
)

GET /cards/multiverse/:id/rulings

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

If the card has multiple multiverse IDs, this method can find either of them.

Implementation

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