1.0.4 • Published 9 months ago

@bosstop/pokemontcgapi v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

PokemonTCGAPI

This is a simple API wrapper that allows you to get information about Pokemon cards. It is built using Pokemon TCG API to get the data.

This is not an official API wrapper made by Pokemon TCG API.

Installation

Install the package using npm:

npm install @bosstop/pokemontcgapi

Install the package using pnpm:

pnpm install @bosstop/pokemontcgapi

Usage

import { PokemonTCG } from '@bosstop/pokemontcgapi';

const api = new PokemonTCG("<API_KEY>"); // Get your API key from https://pokemontcg.io/

Get Types

const types = await api.getTypes();
console.log(types);

Get Supertypes

const supertypes = await api.getSupertypes();
console.log(supertypes);

Get Subtypes

const subtypes = await api.getSubtypes();
console.log(subtypes);

Get Rarities

const rarities = await api.getRarities();
console.log(rarities);

Get All Sets

Usage: all(): Promise<Set[]>

const sets = await api.sets.all();
console.log(sets);

Get Set By ID

Usage: getSetByID(id: string): Promise<Set>

const set = await api.sets.getSetByID('base1');
console.log(set);

Get Set By Name

Usage: getSetByName(name: string): Promise<Set>

const set = await api.sets.getSetByName('base');
console.log(set);

Get Cards By ID

Usage: getCard(id: filters: ReturnData[]|string[] = []_)

const card = await api.cards.getCard('base1-4');
console.log(card);

Get Cards By Name

Usage: searchByName(name: string, subtype: string, type: string, filters: ReturnData[]|string[] = [])

const cards = await api.cards.getCardByName('Charizard');
console.log(cards);

Return Data

enum ReturnData {
    NAME = 'name',
    ID = 'id',
    HP = 'hp',
    SUPERTYPE = 'supertype',
    SUBTYPES = 'subtypes',
    TYPES = 'types',
    EVOLVESTO = 'evolvesTo',
    RULES = 'rules',
    ATTACKS = 'attacks',
    WEAKNESSES = 'weaknesses',
    RETREATCOST = 'retreatCost',
    SET = 'set',
    NUMBER = 'number',
    ARTIST = 'artist',
    RARITY = 'rarity',
    NATIONALPOKEDEXNUMBERS = 'nationalPokedexNumbers',
    LEGALITIES = 'legalities',
    IMAGES = 'images',
    TCGPLAYER = 'tcgplayer',
}

Donate

If you like this package, consider donating to me. It will help me to maintain this package and make more packages like this. Ko-fi

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago