Giter Site home page Giter Site logo

go-yugioh's Introduction

go-yugioh

GoDoc Go Report Card golangci-lint

go-yugioh is a Go client library for accessing the Yu-Gi-Oh! API by YGOPRODeck v7.

Feature

  • Cards
    • Get card information with some prameters.
  • Card Sets
    • Get card sets.
  • Card Set Info
    • Get card information about set name, rarity and price from code
  • Random Card
    • Get one random card.
  • Card Archetypes
    • Get card archetypes.
  • Check DB version

Install

go get -u github.com/Doarakko/go-yugioh/yugioh

Documentation

Check GoDoc and API document.

Usage

Please be carefull on the API rate limit.

Rate Limiting on the API is enabled. The rate limit is 20 requests per 1 second. If you exceed this, you are blocked from accessing the API for 1 hour. We will monitor this rate limit for now and adjust accordingly.
Yu-Gi-Oh! API Guide - YGOPRODECK

Example

Here is the example code.

client := yugioh.NewClient()
cards, _, err := client.Cards.List(
	&yugioh.CardsListOptions{
		Q:         "dragon",
		Type:      "Fusion Monster",
		Attribute: "light",
		Atk:       "gt3000",
		Misc:      "yes",
		Num:       5,
		Offset:    0,
	},
)
...

for _, card := range cards.Data {
	fmt.Printf("\"%s\" has been viewed %d times.\n", card.Name, card.Misc[0].Views)
	fmt.Printf("Type: %v\nRace: %v\nAtk: %v\n%v\n\n",
		card.Type, card.Race, card.Atk, card.Description)
}
fmt.Printf("Nex page is %s\n", cards.Meta.NextPage)
"A-to-Z-Dragon Buster Cannon" has been viewed 50305 times.
Type: Fusion Monster
Race: Machine
Atk: 4000
"ABC-Dragon Buster" + "XYZ-Dragon Cannon"
Must be Special Summoned (from your Extra Deck) by banishing cards you control with the above original names, and cannot be Special Summoned by other ways. (You do not use "Polymerization".) During either player's turn, when your opponent activates a Spell/Trap Card, or monster effect: You can discard 1 card; negate the activation, and if you do, destroy that card. During either player's turn: You can banish this card, then target 1 each of your banished "ABC-Dragon Buster", and "XYZ-Dragon Cannon"; Special Summon them.

"Armed Dragon Catapult Cannon" has been viewed 28559 times.
Type: Fusion Monster
Race: Machine
Atk: 3500
"VWXYZ-Dragon Catapult Cannon" + "Armed Dragon LV7"
Must first be Special Summoned (from your Extra Deck) during a Duel you Special Summoned both the above cards, by banishing the above cards from your field and/or GY. (You do not use "Polymerization".) Your opponent cannot activate cards or effects with the same name as any banished card. Once per turn, during your opponent's turn (Quick Effect): You can banish 1 card from your Deck or Extra Deck, face-up; banish all cards your opponent controls and in their GY.
...
Nex page is https://db.ygoprodeck.com/api/v7/cardinfo.php?atk=gt3000&attribute=light&fname=dragon&misc=yes&num=5&type=Fusion+Monster&offset=5

License

MIT License

go-yugioh's People

Contributors

dependabot[bot] avatar doarakko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fuck2ky

go-yugioh's Issues

need update

last update 2nd July 2020):

  • Fixed scale values of 0 not being returned
  • Replaced set with cardset when querying a card set
  • Complete Code Overhaul
  • Speed Optimizations
  • Cache Pool Shared with ygoprodeck.com and db.ygoprodeck.com
  • Overhauled misc info - New Data Added
  • Paginaton capability added

https://db.ygoprodeck.com/api-guide/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.