yugioh

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate added in v1.2.0

func Validate(input interface{}) (err error)

Validate ...

Types

type Archetype

type Archetype struct {
	Name string `json:"archetype_name"`
}

Archetype ...

type ArchetypesService

type ArchetypesService struct {
	// contains filtered or unexported fields
}

ArchetypesService handles communication with the archetype related methods of the Yu-Gi-Oh! API by YGOPRODeck.

func (*ArchetypesService) List

func (s *ArchetypesService) List() ([]Archetype, *http.Response, error)

List all archetypes name. This method can NOT use options.

type BanListInfo

type BanListInfo struct {
	TCG  string `json:"ban_tcg"`
	OCG  string `json:"ban_ocg"`
	Goat string `json:"ban_goat"`
}

BanListInfo if card not in ban list, it will NOT show up.

type Card

type Card struct {
	ID          int32   `json:"id"`
	Name        string  `json:"name"`
	Type        string  `json:"type"`
	FrameType   string  `json:"frameType"`
	Description string  `json:"desc"`
	Race        string  `json:"race"`
	Archetype   string  `json:"archetype"`
	Sets        []Set   `json:"card_sets"`
	Images      []Image `json:"card_images"`

	// array, but this API currently only returns one
	Prices []Prices `json:"card_prices"`
	Misc   []Misc   `json:"misc_info"`

	// Monster Card only
	Atk       int    `json:"atk"`
	Def       int    `json:"def"`
	Level     int    `json:"level"`
	Attribute string `json:"attribute"`

	// Pendulum Monster Card only
	Scale int `json:"scale"`

	// Link Monster Card only
	Link int `json:"linkval"`
	// Top, Bottom, Left, Right, Bottom-Left, Bottom-Right, Top-Left, Top-Right
	LinkMarkers []string `json:"linkmarkers"`

	// Ban Card only
	BanListInfo BanListInfo `json:"banlist_info"`
}

Card if a piece of response info is empty or null then it will NOT show up.

type CardSet

type CardSet struct {
	Name         string `json:"set_name"`
	Code         string `json:"set_code"`
	CardCounts   int    `json:"num_of_cards"`
	ReleasedDate string `json:"tcg_date"`
}

CardSet ...

type CardSetInfo added in v1.2.0

type CardSetInfo struct {
	ID      int     `json:"id"`
	Name    string  `json:"name"`
	Price   float32 `json:"set_price,string"`
	SetName string  `json:"set_name"`
	Code    string  `json:"set_code"`
	Rarity  string  `json:"set_rarity"`
}

CardSetInfo ...

type CardSetInfoOneOptions added in v1.2.0

type CardSetInfoOneOptions struct {
	Code string `url:"setcode" validate:"required"`
}

CardSetInfoOneOptions ...

type CardSetInfoService added in v1.2.0

type CardSetInfoService struct {
	// contains filtered or unexported fields
}

CardSetInfoService ...

func (*CardSetInfoService) One added in v1.2.0

One ...

type CardSetsService

type CardSetsService struct {
	// contains filtered or unexported fields
}

CardSetsService handles communication with the card sets related methods of the Yu-Gi-Oh! API by YGOPRODeck.

func (*CardSetsService) List

func (s *CardSetsService) List() ([]CardSet, *http.Response, error)

List all card sets name. This method can NOT use options.

type Cards added in v1.2.0

type Cards struct {
	Data []Card `json:"data"`
	Meta Meta   `json:"meta"`
}

Cards ...

type CardsListOptions

type CardsListOptions struct {
	// must be comma separated. You can't use this with Name field.
	IDs  string `url:"id,omitempty"`
	Name string `url:"name,omitempty"`

	Q         string `url:"fname,omitempty"`
	KonamiID  string `url:"konami_id,omitempty"`
	Type      string `url:"type,omitempty"`
	Race      string `url:"race,omitempty"`
	Archetype string `url:"archetype,omitempty"`
	Set       string `url:"cardset,omitempty"`
	BanList   string `url:"banlist,omitempty,oneof=TCG OCG Goat"`
	HasEffect bool   `url:"has_effect,omitempty"`

	Sort string `url:"sort,omitempty" validate:"omitempty,oneof=atk def name type level id new"`

	// goat, ocg goat, speed duel, rush duel, duel links
	// Duel Links is not 100% accurate but is close.
	Format string `url:"format,omitempty"`

	// it can use "lt" (less than), "lte" (less than equals to), "gt" (greater than), "gte" (greater than equals to)
	Atk   string `url:"atk,omitempty"`
	Def   string `url:"def,omitempty"`
	Level string `url:"level,omitempty"`

	Attribute string `url:"attribute,omitempty" validate:"omitempty,oneof=dark earth fire light water wind divine"`

	// Pendulum Monster Card only
	Scale int `url:"scale,omitempty"`

	// Link Monster Card only
	Link       int    `url:"link,omitempty"`
	LinkMarker string `url:"linkmarker,omitempty"`

	// If set "yes", return Misc
	Misc string `url:"misc,omitempty" validate:"omitempty,eq=yes"`

	Staple string `url:"staple,omitempty"`

	Language string `url:"language,omitempty"`

	Num    int `url:"num,omitempty"`
	Offset int `url:"offset,omitempty"`
}

CardsListOptions specifies the optional parameters to various CardsService.List methods.

type CardsService

type CardsService struct {
	// contains filtered or unexported fields
}

CardsService handles communication with the cards related methods of the Yu-Gi-Oh! API by YGOPRODeck.

func (*CardsService) List

func (s *CardsService) List(opt *CardsListOptions) (*Cards, *http.Response, error)

List the cards

type CheckDBVersionService added in v1.2.0

type CheckDBVersionService struct {
	// contains filtered or unexported fields
}

CheckDBVersionService ...

func (*CheckDBVersionService) One added in v1.2.0

One ...

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string

	Cards          *CardsService
	CardSets       *CardSetsService
	CardSetInfo    *CardSetInfoService
	RandomCards    *RandomCardsService
	Archetypes     *ArchetypesService
	CheckDBVersion *CheckDBVersionService
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient() *Client

NewClient ...

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

Do http request

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest ...

type DBInformation added in v1.2.0

type DBInformation struct {
	Version     string `json:"database_version"`
	LastUpdated string `json:"last_update" validate:"datetime"`
}

DBInformation ...

type Image

type Image struct {
	ID         int32  `json:"id"`
	URL        string `json:"image_url"`
	SmallURL   string `json:"image_url_small"`
	CroppedURL string `json:"image_url_cropped"`
}

Image card image.

type Meta added in v1.2.0

type Meta struct {
	CurrentRows    int `json:"current_rows"`
	TotalRows      int `json:"total_rows"`
	RowsRemaining  int `json:"rows_remaining"`
	TotalPages     int `json:"total_pages"`
	PagesRemaining int `json:"pages_remaining"`

	// omitted on last page
	NextPage       string `json:"next_page,omitempty"`
	NextPageOffset int    `json:"next_page_offset,omitempty"`

	// omitted if not on the last page
	PreviousPage       string `json:"previous_page,omitempty"`
	PreviousPageOffset int    `json:"previous_page_offset,omitempty"`
}

Meta about pagination

type Misc

type Misc struct {
	// The Old/Temporary/Translated name
	BetaName string `json:"beta_name"`

	// The number of times a card has been viewed in ygoprodeck (does not include API/external views)
	Views int `json:"views"`

	// The available formats the card is in (tcg, ocg, goat, ocg goat, duel links, rush duel or speed duel).
	Formats []string `json:"formats"`

	// The original date the card was released in the TCG.
	TCGDate string `json:"tcg_date"`

	// The original date the card was released in the OCG.
	OCGDate string `json:"ocg_date"`

	// If the card is treated as another card.
	// For example, Harpie Lady 1,2,3 are treated as Harpie Lady.
	TreatedAs string `json:"treated_as"`
}

Misc if you want to get, set "yes" to Misc param

type Prices

type Prices struct {
	// Euro
	Cardmarket float32 `json:"cardmarket_price,string"`

	// Dollar
	TCGPlayer    float32 `json:"tcgplayer_price,string"`
	Ebay         float32 `json:"ebay_price,string"`
	Amazon       float32 `json:"amazon_price,string"`
	CoolStuffInc float32 `json:"coolstuffinc_price,string"`
}

Prices card prices Only Cardmarket price is euro.

type RandomCardsService

type RandomCardsService struct {
	// contains filtered or unexported fields
}

RandomCardsService handles communication with the random cards related methods of the Yu-Gi-Oh! API by YGOPRODeck.

func (*RandomCardsService) One

func (s *RandomCardsService) One() (*Card, *http.Response, error)

One get random one card. This method can NOT use options.

type Set

type Set struct {
	Name       string `json:"set_name"`
	Code       string `json:"set_code"`
	Rarity     string `json:"set_rarity"`
	RarityCode string `json:"set_rarity_code"`

	// Dollar
	Price string `json:"set_price"`
}

Set ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL