This is the Pokémon TCG SDK TypeScript implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io.
npm install ptcg-api
import {v1 as ptcg} from 'ptcg-api';
ptcg.cards.find('base1-4').then(res => {
console.log(res.card.name); // "Charizard"
});
ptcg.cards.where({
set: 'generations',
supertype: 'pokemon'
}).then(res => {
res.cards.forEach(card => console.log(card.name));
});
ptcg.cards.all();
ptcg.cards.all({
page: 5,
pageSize: 100
}).then(res => {
console.log(res.pageSize); // size of page
console.log(res.count); // number of returned elements
console.log(res.totalCount); // number of all elements
});
ptcg.sets.find('base1');
ptcg.sets.where({standardLegal: 'true'});
ptcg.sets.all();
ptcg.types.all();
ptcg.subtypes.all();
ptcg.supertypes.all();
import {config} from 'ptcg-api';
config.API_URL_V1 = 'https://new-api-url.com/v1';