Skip to content

2000Slash/pokemon-tcg-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon TCG Api

This is a simple Pokemon Trading Card Game api with an integrated pack builder

Example use:

import {PackBuilder, Set} from "pokemon-tcg-api"

Set.all().then((sets) => {
    sets.forEach((set) => {
        console.log(`${set.name} -- ${set.id}`)
    })
})

async function openPacks() {
    let set = await Set.fromId("swsh9");
    let openDefaultPack = set.getPack().open();

    console.log("------------------ Default pack ------------------")
    for (const card of openDefaultPack) {
        console.log(card.name)
    }
    console.log("--------------------------------------------------")

    let openCustomPack = PackBuilder.fromSet(set).withStage("Common", 1).withStage("Rare", 10).build().open()

    console.log("------------------ Custom pack -------------------")
    for (const card of openCustomPack) {
        console.log(card.name)
    }
    console.log("--------------------------------------------------")
}

openPacks();

Releases

No releases published

Packages

No packages published