Categorygithub.com/BlueMonday/go-scryfall
modulepackage
0.9.0
Repository: https://github.com/bluemonday/go-scryfall.git
Documentation: pkg.go.dev

# README

go-scryfall

Go PkgGoDev Coverage Status Go Report Card

go-scryfall

go-scryfall is a Golang client library for accessing the Scryfall API.

The Scryfall logo is copyrighted by Scryfall, LLC. go-scryfall is not created by, affiliated with, or supported by Scryfall.

go-scryfall art was provided by @jouste the fierce drawbarian!

Example

package main

import (
	"context"
	"log"

	scryfall "github.com/BlueMonday/go-scryfall"
)

func main() {
	ctx := context.Background()
	client, err := scryfall.NewClient()
	if err != nil {
		log.Fatal(err)
	}

	sco := scryfall.SearchCardsOptions{
		Unique:        scryfall.UniqueModePrints,
		Order:         scryfall.OrderSet,
		Dir:           scryfall.DirDesc,
		IncludeExtras: true,
	}
	result, err := client.SearchCards(ctx, "storm cro", sco)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("%s", result.Cards[0].Colors)
}

Rate Limiting

go-scryfall will rate limit requests to Scryfall's API. The default limit is 10 requests per second as recommended in the REST API documentation.

To disable rate limiting use the WithLimiter option with a nil limiter when constructing the client.

package main

import (
	"log"

	scryfall "github.com/BlueMonday/go-scryfall"
)

func main() {
	client, err := scryfall.NewClient(scryfall.WithLimiter(nil))
	if err != nil {
		log.Fatal(err)
	}
}

# Functions

NewClient returns a new Scryfall API client.
WithBaseURL returns an option which overrides the base URL.
WithClientSecret returns an option which sets the client secret.
WithGrantSecret returns an option which sets the grant secret.
WithHTTPClient returns an option which overrides the default HTTP client.
WithLimiter returns an option which overrides the default rate limiter.
WithUserAgent returns an option which overrides the default HTTP user agent.

# Constants

ColorBlack is the black mana color.
ColorBlue is the blue mana color.
ColorGreen is the green mana color.
ColorRed is the red mana color.
ColorWhite is the white mana color.
ComponentComboPiece represents a combo piece related to a card.
ComponentMeldPart represents one of the parts of a meld.
ComponentMeldResult represents the result of a meld.
ComponentToken represents a token related to a card.
DirAsc sorts cards in ascending order.
DirAuto lets Scryfall automatically choose the most intuitive direction to sort.
DirDesc sorts cards in descending order.
FinishEtched represents a etched card finish.
FinishFoil represents a foild card finish.
FinishGlossy represents a glossy card finish.
FinishNonFoil represents a nonfoild card finish.
Frame1993 is the original Magic card frame, starting from Limited Edition Alpha.
Frame1997 is the updated classic frame starting from Mirage block.
Frame2003 is the “modern” Magic card frame, introduced in Eighth Edition and Mirrodin block.
Frame2015 is the holofoil-stamp Magic card frame, introduced in Magic 2015.
FrameEffectColorShifted is the colorshifted frame effect.
FrameEffectCompanion is the companion frame effect.
FrameEffectCompassLandDFC is the compass and land transform marks frame effect.
FrameEffectConvertDFC is the more than meets the eye marks frame effect.
FrameEffectDevoid is the Devoid frame effect.
FrameEffectDraft is the draft-matters frame effect.
FrameEffectEtched is the etched foil treatment frame effect.
FrameEffectExtendedArt is the extended art frame effect.
FrameEffectFanDFC is the fan transforming marks frame effect.
FrameEffectInverted is the FNM-style inverted frame effect.
FrameEffectLegendary is the legendary crown introduced in Dominaria.
FrameEffectLesson is the lesson frame effect.
FrameEffectMiracle is the miracle frame effect.
FrameEffectMoonEldraziDFC is the moon and Eldrazi transform marks frame effect.
FrameEffectMoonReverseMoonDFC is the waxing and waning crescent moon transform marks frame effect.
FrameEffectNyxTouched is the Nyx-touched frame effect.
FrameEffectOriginPWDFC is the Origins and planeswalker transform marks frame effect.
FrameEffectShatteredGlass is the shattered glass frame effect.
FrameEffectShowcase is the custom Showcase frame effect.
FrameEffectSnow is the snowy frame effect.
FrameEffectSpree is the spree asterisk frame effect.
FrameEffectSunMoonDFC is the sun and moon transform marks frame effect.
FrameEffectTombstone is the Odyssey tombstone mark frame effect.
FrameEffectUpsideDownDFC is the upside down transforming marks frame effect.
FrameFuture is the frame used on cards from the future.
ImageStatusHighres represents that the card has a full-resolution scanner image.
ImageStatusHighres represents that the card's image is low-quality, either because it was just spoiled or we don't have better photography for it yet.
ImageStatusMissing represents that the card has no image, or the image is being processed.
ImageStatusPlaceholder represents that Scryfall doesn't have an image of this card, but we know it exists and we have uploaded a placeholder in the meantime.
LangAncientGreek is the ancient Greek language code.
LangArabic is the Arabic language code.
LangEnglish is the English language code.
LangFrench is the French language code.
LangGerman is the German language code.
LangHebrew is the Hebrew language code.
LangItalian is the Italian language code.
LangJapanese is the Japanese language code.
LangKorean is the Korean language code.
LangLatin is the Latin language code.
LangPhyrexian is the Phyrexian language code.
LangPortuguese is the Portuguese language code.
LangRussian is the Russian language code.
LangSanskrit is the Sanskrit language code.
LangSimplifiedChinese is the simplified Chinese language code.
LangSpanish is the Spanish language code.
LangTraditionalChinese is the traditional Chinese language code.
LayoutAdventure is a card layout with an Adventure spell part.
LayoutArtSeries is an Art Series collectable double-faced card layout.
LayoutAugment is an augment card layout.
LayoutBattle is a battle-type card layout.
LayoutCase is a case-type enchantment cards layout.
LayoutClass is class-type enchantment cards layout.
LayoutDoubleFacedToken is a card token layout with another token printed on the back.
LayoutEmblem is an emblem card layout.
LayoutFlip is a card layout that inverts vertically with the flip keyword.
LayoutHost is host card layout.
LayoutLeveler is a level up card layout.
LayoutMeld is a card layout with meld parts printed on the back.
LayoutModalDFC is a double-sided card layout that can be played either-side.
LayoutMutate is mutate card layout.
LayoutNormal is a standard Magic card layout with one face.
LayoutPlanar is a plane and phenomenon card layout.
LayoutPrototype is prototype card layout.
LayoutReversible is a card layout with two sides that are unrelated.
LayoutSaga is saga card layout.
LayoutScheme is a scheme card layout.
LayoutSplit is a split-faced card layout.
LayoutToken is a token card layout.
LayoutTransform is a double-sided card layout that transforms.
LayoutVanguard is a vanguard card layout.
LegalityBanned indicates the card is banned in the format.
LegalityLegal indicates the card is legal in the format.
LegalityNotLegal indicates the card is not legal in the format.
LegalityRestricted indicates the card is restricted to one copy in the format.
OAuthScopeEphemeral will grant access to the user's public account information, and then revoke access immediately afterward.
OAuthScopeRead grants the ability to inspect data on a user's account.
OAuthScopeReadWrite grants full API access to a user's account.
OrderArtist sorts cards by their front-side artist name: A → Z.
OrderCMC sorts cards by their converted mana cost: 0 → highest.
OrderColor sorts cards by their color and color identity: WUBRG → multicolor → colorless.
OrderEDHREC sorts cards by their EDHREC ranking: lowest → highest.
OrderEUR sorts cards by their lowest known Euro price: 0.01 → highest, null last.
OrderName sorts cards by name, A → Z.
OrderPower sorts cards by their power: null → highest.
OrderRarity sorts cards by their rarity: Common → Mythic.
OrderSet sorts cards by their set and collector number: oldest → newest.
OrderTix sorts cards by their lowest known TIX price: 0.01 → highest, null last.
OrderToughness sorts cards by their toughness: null → highest.
OrderUSD sorts cards by their lowest known U.S.
SetTypeArchenemy is an Archenemy set.
SetTypeBox is a gift box set.
SetTypeCommander is a commander preconstructed set.
SetTypeCore is a yearly Magic core set (Tenth Edition, etc).
SetTypeDraftInnovation is a special draft set, like Conspiracy and Battlebond.
SetTypeDuelDeck is a Duel Decks set.
SetTypeExpansion is a rotational expansion set in a block (Zendikar, etc).
SetTypeFromTheVault is a From the Vault gift set.
SetTypeFunny is a funny un-set or set with funny promos (Unglued, Happy Holidays, etc).
SetTypeMasterpiece is a set that contains masterpiece series premium foil cards.
SetTypeMasters is a reprint set that contains no new cards (Modern Masters, etc).
SetTypeMemorabilia is a set made up of gold-bordered, oversize, or trophy cards that are not legal.
SetTypePlanechase is a Planechase set.
SetTypePremiumDeck is a premium Deck Series decks set.
SetTypePromo is a set that contains purely promotional cards.
SetTypeSpellbook is a Spellbook series gift set.
SetTypeStarter is a starter/introductory set (Portal, etc).
SetTypeToken is a set made up of tokens and emblems.
SetTypeTreasureChest is a Magic Online treasure chest prize set.
SetTypeVanguard is a Vanguard card set.
SourceScryfall is a Scryfall ruling source.
SourceWOTC is a Wizards of the Coast ruling source.
UniqueModeArt returns only one copy of each unique artwork for matching cards.
UniqueModeCards removes duplicate gameplay objects (cards that share a name and have the same functionality).
UniqueModePrints returns all prints for all cards matched (disables rollup).
No description provided by the author

# Variables

ErrMultipleSecrets is returned if both the grant and client secret are set when creating a new Scryfall client.

# Structs

Account represents a Scryfall account.
Application represents a Scryfall application.
BulkData is a Scryfall bulk data item.
Card represents individual Magic: The Gathering cards that players could obtain and add to their collection (with a few minor exceptions).
CardFace is a face of a multifaced card.
CardIdentifier identifies a card.
CardListResponse represents a requested sequence of card objects.
CardSymbol represents an illustrated symbol that may appear in card's mana cost or Oracle text.
Catalog contains an array of Magic datapoints (words, card values, etc).
Client is a Scryfall API client.
Date is a date returned by the Scryfall API.
Error is a Scryfall API error response.
GetCardByNameOptions holds the options used to get a card by name.
GetCardsByIdentifiersRequest represents a request to get cards which correspond to the provided card identifiers.
GetCardsByIdentifiersResponse represents the list of cards retrieved using a list of card identifiers.
ImageURIs contains links to the different image sizes and crops for a given card.
Legalities describes the legality of a card across formats.
ManaCost is Scryfall's interpretation of a mana cost.
OAuthConvertRequest is an OAuth convert request.
OAuthDowngradeRequest is an OAuth downgrade request.
OAuthGrant is an OAuth grant.
OAuthRevokeRequest is an OAuth revoke request.
OAuthRevokeResponse is an OAuth revoke response.
No description provided by the author
Prices contains daily price information for this card, including usd, usd_foil, eur, and tix prices.
PurchaseURIs contains links to the card on online card stores.
RelatedCard is a card that is closely related to another card (because it calls it by name, or generates a token, or meld, etc).
RelatedURIs contains links related to a card.
Ruling represents an Oracle ruling, Wizards of the Coast set release notes, or Scryfall notes for a particular card.
SearchCardsOptions holds the options used to search for cards.
Set is an object which represents a group of related Magic cards.
Timestamp is a timestamp returned by the Scryfall API.

# Type aliases

ClientOption configures the Scryfall API client.
Color represents a color in Magic: The Gathering.
Component is a field explaining what role a card plays in a relationship.
Dir is a direction used to sort cards.
Finish is a finish a card can come in.
Frame tracks the major edition of the card frame of used for the re/print in question.
FrameEffect tracks additional frame artwork applied over a particular frame.
ImageStatus is a computer-readable indicator for the state of this card's image, one of missing, placeholder, lowres, or highres_scan.
Lang is an ISO-like language code.
Layout categorizes the arrangement of card parts, faces, and other bounded regions on cards.
Legality is the legality of a card in a particular format.
OAuthScope is the level of access.
Order is a method used to sort cards.
SetType is a computer-readable classification for a set.
Source indicates which company produced the ruling.
UniqueMode specifies whether Scryfall should remove duplicates from search results.