Skip to content

gerrue/mtg-sdk-javascript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic: The Gathering SDK

This is the Magic: The Gathering SDK Javascript implementation. It is a wrapper around the MTG API of magicthegathering.io.

Installation

npm install --save mtgsdk

Usage

const mtg = require('mtgsdk')

mtg.card.find(3)
.then(result => {
    console.log(result.card.name) // "Black Lotus"
})

Query cards by any property:

card.where({ supertypes: 'legendary', subtypes: 'goblin' })
.then(cards => {
    console.log(cards[0].name) // "Squee, Goblin Nabob"
})

Retrieve cards across multiple pages of results:

card.all({ name: 'Squee', pageSize: 1 })
.on('data', card => {
    console.log(card.name)
})

// Will print:
// Squee
// Squee, Goblin Nabob Avatar
// Squee's Toy
// Squeeze
// Squee, Goblin Nabob
// Squee's Embrace
// Squee's Revenge
// Squee, Goblin Nabob
// Squee, Goblin Nabob
// (the duplicates are from different sets)

Properties

Card

name
multiverseid
layout
names
manaCost
cmc
colors
type
types
subtypes
rarity
text
flavor
artist
number
power 
toughness
reserved
rulings
printings
originalText
originalType
legalities
source
imageUrl
set
id

Set

code
name
gatherer_code
old_code
magic_cards_info_code
release_date
border
type
block
online_only
booster
mkm_id
mkm_name

Development

Build tasks are in npm scripts:

npm run

About

Magic: The Gathering SDK - Javascript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%