Skip to content
Pokémon TCG SDK - Typescript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.npmignore
README.md
npm-debug.log
package-lock.json
package.json
tsconfig.json
yarn.lock

README.md

Pokemon TCG SDK TypeScript

This is the TypeScript SDK for the Pokemon TCG API.

Installation

npm install --save pokemon-tcg-sdk-typescript

Class Definitions

Card

id: number;
name: string;
imageUrl: string;
imageUrlHighRes: string;
subType: ISubType;
superType: ISuperType;
ability: IAbility;
hp: number;
number: number;
artist: string;
rarity: string;
series: string;
set: ISet;
setCode: string;
retreatCost: string;
text: string;
types: IType[];
attacks: IAttack[];
weaknesses: string[];
resistances: string[];
nationalPokedexNumber: number;
ancientTrait: string;
evolvesFrom: string;

Set

code: string;
name: string;
series: string;
totalCards: number;
standardLegal: boolean;
expandedLegal: boolean;
releaseDate: string;
symbolUrl: string;
ptcgoCode: string;

Type, SubType, SuperType

type: string;

IQuery

{ name: string, value: string | number }

Method Definitions

Card.find(id: string): Promise<Card>
Card.where(params: IQuery[]): Promise<Card[]>
Card.all(): Promise<Card[]>

Set.find(id: string): Promise<Set>
Set.where(params: IQuery[]): Promise<Set[]>
Set.all(): Promise<Set[]>

Type.all(): Promise<Type[]>
SuperType.all(): Promise<SuperType[]>
SubType.all(): Promise<SubType[]>

Usage

All of the calls return generic promises like Promise<T> or Promise<T[]>. The type is determined from the class making the call. The examples here are using the Card class but the usage for the other classes are the same.

import { PokemonTCG } from 'pokemon-tcg-sdk-typescript'

PokemonTCG.Card.find('xy1')
  .then(card => {
    // do stuff with the card
  })
  .catch(error => {
    // do something with the error
  });

let params: PokemonTCG.IQuery[] = [{ name: 'name', value: 'Charizard' }];
PokemonTCG.Card.where(params)
  .then(cards => {
    // do stuff with the cards
  })
  .catch(error => {
    // do something with the error
  });

PokemonTCG.Card.all()
  .then(cards => {
    // do stuff with the cards
  })
  .catch(error => {
    // do something with the error
  });

Contributing

  • Fork it (click the Fork button at the top of the page)
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

TODO

  • Add more testing?
  • Update package name for easier use?
You can’t perform that action at this time.