package
0.0.0-20240808151852-3363955b67b3
Repository: https://github.com/sethcurry/stax.git
Documentation: pkg.go.dev
# README
scryfall
This project is not affiliated with Scryfall in any way.
Examples
Cards
Find a card by name:
client := scryfall.NewClient(nil)
card, err := client.Card.Named("Lightning Bolt")
if err != nil {
panic(err)
}
fmt.Println(card.ID)
Search for cards:
client := scryfall.NewClient(nil)
cardPager, err := client.Card.Search(context.Background(), "Black Lotus", scryfall.CardSearchOptions{})
if err != nil {
panic(err)
}
for cardPager.HasMore() {
cards, err := cardPager.NextPage()
if err != nil {
panic(err)
}
for _, card := range cards {
fmt.Println(card.Name)
}
}
Try to autocomplete a card name:
client := scryfall.NewClient(nil)
cardNames, err := client.Card.Autocomplete("Black Lot")
if err != nil {
panic(err)
}
for _, cardName := range cardNames {
fmt.Println(cardName)
}
# Functions
AllComponents returns a slice of all of the known components.
AllLegalities returns a slice of all valid values of Legality.
ObjectList returns a list of all valid values of Object.
AllSources returns all possible values of Source.
NewBulkReader creates a BulkReader[T] from a given io.Reader.
NewClient creates a new Client.
# Constants
ComponentComboPiece indicates that the card is a combo piece.
ComponentMeldPart indicates that the card is a meld part.
ComponentMeldResult indicates that the card is a meld result.
ComponentToken indicates that the card is a token.
LegalityBanned returns a Legality representing a card that is specifically banned.
LegalityLegal returns a Legality representing a card that is legal in a format.
LegalityNotLegal returns a Legality representing not legal, e.g.
LegalityRestricted returns a Legality representing a card that is restricted in a format.
ObjectBulkData represents a bulk data source.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SourceScryfall indicates rulings that were added by Scryfall.
SourceWOTC indicates rulings that come directly from Wizards of the Coast.
# Variables
ErrFirstTokenNotDelim is returned when the first token in the JSON stream is not a delimeter.
ErrFirstTokenNotOpenBracket is returned when the first token in the JSON stream is not an open bracket ([).
No description provided by the author
No description provided by the author
ErrUnknownLegality is returned when unmarshaling a Legality from a string that is not one of the pre-defined legalities.
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
APIError is a representation of the error format returned by the Scryfall API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BulkReader[T] is a generic reader for lists of data encoded as JSON.
Card encapsulates all of the data returned by the Scryfall API for a given card.
No description provided by the author
No description provided by the author
No description provided by the author
CardSearchOptions provide optional parameters for searching for cards.
No description provided by the author
Client is the interface to Scryfall's API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Ruling is a single ruling.
No description provided by the author
# Type aliases
Component represents the "component" field that is present on some Scryfall responses.
Date is a type alias for time.Time that supports marshalling/unmarshalling text and JSON in the format YYYY-MM-DD.
Legality is an enum representing the legality of a card in a format.
Object represents the "object" field that is present in all Scryfall API objects.
Source is an enum representing the source of some information.