Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Types #28

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 49 additions & 8 deletions card.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,22 @@ const (
// LayoutLeveler is a level up card layout.
LayoutLeveler Layout = "leveler"

LayoutClass Layout = "class"

LayoutCase Layout = "case"

// LayoutSaga is saga card layout.
LayoutSaga Layout = "saga"

// LayoutAdventure is a card layout with an Adventure spell part.
LayoutAdventure Layout = "adventure"

LayoutMutate Layout = "mutate"

LayoutPrototype Layout = "prototype"

LayoutBattle Layout = "battle"

// LayoutPlanar is a plane and phenomenon card layout.
LayoutPlanar Layout = "planar"

Expand Down Expand Up @@ -126,8 +136,8 @@ const (
// LayoutArtSeries is an Art Series collectable double-faced card layout.
LayoutArtSeries Layout = "art_series"

// LayoutDoubleSided is a card layout with two sides that are unrelated.
LayoutDoubleSided Layout = "double_sided"
// LayoutReversible is a card layout with two sides that are unrelated.
LayoutReversible Layout = "reversible_card"
)

// Legality is the legality of a card in a particular format.
Expand Down Expand Up @@ -231,6 +241,20 @@ const (

// FrameEffectCompanion is a companion frame effect.
FrameEffectCompanion FrameEffect = "companion"

FrameEffectEtched FrameEffect = "etched"

FrameEffectSnow FrameEffect = "snow"

FrameEffectLesson FrameEffect = "lesson"

FrameEffectShatteredGlass FrameEffect = "shatteredglass"

FrameEffectConvertDFC FrameEffect = "convertdfc"

FrameEffectFanDFC FrameEffect = "fandfc"

FrameEffectUpsideDownDFC FrameEffect = "upsidedowndfc"
)

type Preview struct {
Expand Down Expand Up @@ -403,6 +427,8 @@ type Card struct {
// that are not numeric, such as X.
Loyalty *string `json:"loyalty"`

Defense *string `json:"defense"`

// LifeModifier is this card's life modifier, if it is Vanguard
// card. This value will contain a delta, such as +2.
LifeModifier *string `json:"life_modifier"`
Expand Down Expand Up @@ -553,6 +579,12 @@ type Card struct {

// ImageStatus is a computer-readable indicator for the state of this card's image.
ImageStatus *ImageStatus `json:"image_status"`

AttractionLights []int `json:"attraction_lights,omitempty"`

ContentWarning *bool `json:"content_warning,omitempty"`

FlavorName *string `json:"flavor_name,omitempty"`
}

// RelatedCard is a card that is closely related to another card (because it
Expand Down Expand Up @@ -585,6 +617,8 @@ type CardFace struct {
// This will only be set if the card is not in English.
PrintedName *string `json:"printed_name"`

FlavorName *string `json:"flavor_name,omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking through the documented card face object and I don't see this one there. I only see it on the card object. Is the documentation incorrect? Do you happen to have an example card that has a card face with a flavor name?

https://scryfall.com/docs/api/cards#card-face-objects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm that one seems to not have multiple card faces so it only has the flavor_name on the card object and not on the card face object.


// TypeLine is the type line of this particular face.
TypeLine string `json:"type_line"`

Expand Down Expand Up @@ -617,9 +651,16 @@ type CardFace struct {
// Toughness is this face's toughness, if any.
Toughness *string `json:"toughness"`

Layout *string `json:"layout"`

// Loyalty is this face's loyalty, if any.
Loyalty *string `json:"loyalty"`

// Appears on reversible cards.
OracleID *string `json:"oracle_id,omitempty"`

Defense *string `json:"defense"`

// FlavorText is the flavor text printed on this face, if any.
FlavorText *string `json:"flavor_text"`

Expand Down Expand Up @@ -953,12 +994,12 @@ func (c *Client) GetRandomCard(ctx context.Context) (Card, error) {
// CardIdentifier identifies a card.
//
// The following combinations are valid identifier schemas:
// * ID
// * MTGOID
// * MultiverseID
// * Name
// * Name and Set
// * Set and CollectorNumber
// - ID
// - MTGOID
// - MultiverseID
// - Name
// - Name and Set
// - Set and CollectorNumber
type CardIdentifier struct {
// Name identifies a card with the specified Scryfall ID.
ID string `json:"id,omitempty"`
Expand Down