Now Supporting Version 2 of the Pokémon TCG API!
This is the Pokémon TCG SDK Javascript implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io.
npm install --save pokemontcgsdk
import pokemon from 'pokemontcgsdk'
pokemon.configure({apiKey: '123abc'})
pokemon.card.find('base1-4')
.then(card => {
console.log(card.name) // "Charizard"
})
pokemon.card.where({ q: 'name:blastoise' })
.then(result => {
console.log(result.data[0].name) // "Blastoise"
})
pokemon.card.where({ q: 'name:blastoise', pageSize: 10, page: 3 })
.then(result => {
console.log(result.data[0].name) // "Blastoise"
})
pokemon.card.all({ q: 'name:blastoise' })
.then((cards) => {
console.log(cards[0].name) // "Blastoise"
})
Using the all
function, pagination happens automatically, and the result will simply contain the data and no pagination info.
pokemon.set.find('base1')
.then(set => {
console.log(set.name) // "Base"
})
pokemon.set.where({ q: 'series:base' })
.then(result => {
console.log(result.data[0].name) // "Base"
})
pokemon.set.where({ q: 'series:base', pageSize: 1, page: 1 })
.then(result => {
console.log(result.data[0].name) // "Base"
})
pokemon.set.all({ q: 'series:base' })
.then((cards) => {
console.log(cards[0].name) // "Base"
})
Using the all
function, pagination happens automatically, and the result will simply contain the data and no pagination info.
pokemon.supertype.all()
pokemon.subtype.all()
pokemon.type.all()
pokemon.rarity.all()
Please refer to https://docs.pokemontcg.io for more information on query syntax and what fields are available.
- (nwb)
Build tasks are in npm scripts:
npm run build
npm run test