CardsApi

class CardsApi(config: ScryfallConfig = ScryfallConfig(), engine: HttpClientEngine? = null, logger: (String) -> Unit? = null) : ScryfallBaseApi

https://scryfall.com/docs/api/cards

Constructors

Link copied to clipboard
constructor(config: ScryfallConfig = ScryfallConfig(), engine: HttpClientEngine? = null, logger: (String) -> Unit? = null)

Functions

Link copied to clipboard
suspend fun autocomplete(q: String, format: String? = "json", pretty: Boolean? = null, includeExtras: Boolean? = false): AutocompleteResult

Returns a Catalog-like object containing up to 20 full English card names that could be autocompletions of the given string parameter. If q is less than 2 characters long, or if no names match, the result will contain 0 items. https://scryfall.com/docs/api/cards/autocomplete

Link copied to clipboard
suspend fun byArenaId(id: Int, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given Magic: The Gathering Arena ID. https://scryfall.com/docs/api/cards/arena

Link copied to clipboard
suspend fun byCardmarketId(id: Int, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given cardmarket_id, also known as the idProduct" or the Product ID on Cardmarket’s APIs. https://scryfall.com/docs/api/cards/cardmarket

Link copied to clipboard
suspend fun byMtgoId(id: Int, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given MTGO ID (also known as the Catalog ID). The ID can either be the card’s mtgo_id or its mtgo_foil_id. https://scryfall.com/docs/api/cards/mtgo

Link copied to clipboard
suspend fun byMultiverseId(id: Int, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given Multiverse ID. If the card has multiple multiverse IDs, this method can find either of them. https://scryfall.com/docs/api/cards/multiverse

Link copied to clipboard
suspend fun byScryfallId(id: String, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given Scryfall ID. https://scryfall.com/docs/api/cards/id

Link copied to clipboard
suspend fun bySetAndCollectorNumber(code: String, number: String, lang: String? = null, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given set code and collector number. You may optionally also append a lang part to the URL to retrieve a non-English version of the card. https://scryfall.com/docs/api/cards/collector

Link copied to clipboard
suspend fun byTcgplayerId(id: Int, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single card with the given tcgplayer_id or tcgplayer_etched_id, also known as the productId on TCGplayer’s API. https://scryfall.com/docs/api/cards/tcgplayer

Link copied to clipboard
suspend fun collection(identifiers: List<Identifier>, pretty: Boolean? = false): ScryfallList<Card>

Accepts a JSON array of card identifiers, and returns a List object with the collection of requested cards. A maximum of 75 card references may be submitted per request. The request must be posted with Content-Type as application/json. https://scryfall.com/docs/api/cards/collection

Link copied to clipboard
suspend fun namedExact(name: String, set: String? = null, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a Card based on a name search string. https://scryfall.com/docs/api/cards/named

Link copied to clipboard
suspend fun namedFuzzy(name: String, set: String? = null, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a Card based on a name search string. The server allows misspellings and partial words to be provided. For example: jac bele will match Jace Beleren. https://scryfall.com/docs/api/cards/named

Link copied to clipboard
suspend fun random(q: String? = null, format: String? = "json", face: String? = null, version: String? = null, pretty: Boolean? = false): Card

Returns a single random Card object. https://scryfall.com/docs/api/cards/random

Link copied to clipboard
suspend fun search(q: String, unique: UniqueModes? = null, order: SortingCards? = null, dir: SortDirection? = null, includeExtras: Boolean? = false, includeMultilingual: Boolean? = false, includeVariations: Boolean? = false, page: Int? = 1, format: String? = "json", pretty: Boolean? = false): ScryfallList<Card>

Returns a List object containing Cards found using a fulltext search string. This string supports the same fulltext search system that the main site uses. https://scryfall.com/docs/api/cards/search https://scryfall.com/docs/syntax

Link copied to clipboard
suspend fun CardsApi.searchWithBuilder(unique: UniqueModes? = null, order: SortingCards? = null, dir: SortDirection? = null, includeExtras: Boolean = false, includeMultilingual: Boolean = false, includeVariations: Boolean = false, page: Int = 1, builder: SearchQueryBuilder.() -> Unit): ScryfallList<Card>

Searches for cards using the DSL query builder instead of a raw query string.