Skip to content

🎴 Elixir wrapper for a Yu-Gi-Oh! Trading Card Game API

License

Notifications You must be signed in to change notification settings

ChristianTovar/ygo

Repository files navigation

logotype

Build badge Hex version badge Docs License badge

Description

Get Your Game On! 🔥 YGO is an Elixir wrapper for the Yu-Gi-Oh! Trading Card Game API from YGOPRODeck.

Installation

YGO can be installed by adding ygo to your list of dependencies in mix.exs:

def deps do
  [
    {:ygo, "~> 0.1.3"}
  ]
end

and running mix deps.get.

Reference


Cards

To get cards information use the following function:

iex> YGO.get_card_information(%{name: "Dark Magician"})
{:ok,
      [
      %{
        "archetype" => "Dark Magician",
        "atk" => 2500,
        "attribute" => "DARK",
        "card_images" => [
          %{
            "id" => 46986414,
            "image_url" => "https://storage.googleapis.com/ygoprodeck.com/pics/46986414.jpg",
            "image_url_small" => "https://storage.googleapis.com/ygoprodeck.com/pics_small/46986414.jpg"
          }, ...
        ],
        "card_prices" => [
          %{
            "amazon_price" => "2.03",
            "cardmarket_price" => "0.02",
            ...
          }
        ],
        "card_sets" => [
          %{
            "set_code" => "CT13-EN003",
            "set_name" => "2016 Mega-Tins",
            ...
          }, ...
        ],
        "def" => 2100,
        "desc" => "The ultimate wizard in terms of attack and defense.",
        "id" => 46986414,
        "level" => 7,
        "name" => "Dark Magician",
        "race" => "Spellcaster",
        "type" => "Normal Monster"
      }
      ]}

Sets

For obtaining information about a specific card set use:

iex> YGO.get_card_set_information("SDY-046")

or in case you want to list every released set:

iex> YGO.get_card_sets()

Archetypes

For listing all the cards from an Archetype use:

iex> YGO.get_card_information(%{archetype: "Blue-Eyes"})

or in case you want to list all the Archetypes:

iex> YGO.get_card_archetypes()

Restrictions

⚠️ Rate Limit

The rate limit is 20 requests per 1 second. If you exceed this, you are blocked from accessing the API for 1 hour. This limit rate is being monitored and being adjusted accordingly.

⚠️ Image Pulling

Please download and store all data pulled from this API locally to keep the amount of API calls used to a minimum. Failure to do so may result in either your IP address being blacklisted or the API being rolled back.


Credits

Dependency made with 🖤 by Christian Tovar. API rights correspond to YGOPRODeck.

About

🎴 Elixir wrapper for a Yu-Gi-Oh! Trading Card Game API

Topics

Resources

License

Stars

Watchers

Forks

Languages