@bosstop/pokemontcgapi
Version:
Pokemon TCG API
114 lines (97 loc) • 2.99 kB
Markdown
This is a simple API wrapper that allows you to get information about Pokemon cards. It is built using [Pokemon TCG API](https://pokemontcg.io/) to get the data.
**This is not an official API wrapper made by Pokemon TCG API.**
<br><br>
<img style="display: inline-block;" src="https://img.shields.io/npm/v/@bosstop/pokemontcgapi"> <img style="display: inline-block;" src="https://img.shields.io/npm/dt/@bosstop/pokemontcgapi" > <img style="display: inline-block;" src="https://img.shields.io/github/issues/SirBlobby/PokemonTCGAPI" >
Install the package using npm:
```bash
npm install @bosstop/pokemontcgapi
```
Install the package using pnpm:
```bash
pnpm install @bosstop/pokemontcgapi
```
```javascript
import { PokemonTCG } from '@bosstop/pokemontcgapi';
const api = new PokemonTCG("<API_KEY>"); // Get your API key from https://pokemontcg.io/
```
```javascript
const types = await api.getTypes();
console.log(types);
```
```javascript
const supertypes = await api.getSupertypes();
console.log(supertypes);
```
```javascript
const subtypes = await api.getSubtypes();
console.log(subtypes);
```
```javascript
const rarities = await api.getRarities();
console.log(rarities);
```
Usage: `all(): Promise<Set[]>`
```javascript
const sets = await api.sets.all();
console.log(sets);
```
Usage: `getSetByID(id: string): Promise<Set>`
```javascript
const set = await api.sets.getSetByID('base1');
console.log(set);
```
Usage: `getSetByName(name: string): Promise<Set>`
```javascript
const set = await api.sets.getSetByName('base');
console.log(set);
```
Usage: `getCard(id: filters: ReturnData[]|string[] = []_)`
```javascript
const card = await api.cards.getCard('base1-4');
console.log(card);
```
Usage: `searchByName(name: string, subtype: string, type: string, filters: ReturnData[]|string[] = [])`
```javascript
const cards = await api.cards.getCardByName('Charizard');
console.log(cards);
```
```typescript
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',
}
```
If you like this package, consider donating to me. It will help me to maintain this package and make more packages like this.
<br>
[](https://ko-fi.com/sirblob)