The JavaScript SDK
Installation
npm i @tcgdex/sdk
bun i @tcgdex/sdk
yarn add @tcgdex/sdk
pnpm add @tcgdex/sdk
<script src="https://cdn.jsdelivr.net/npm/@tcgdex/sdk@2/dist/tcgdex.browser.js"></script>
Usage
// Import the SDK in moduleJSimport TCGdex from '@tcgdex/sdk'// OR import the SDK in commonJSconst TCGdex = require('@tcgdex/sdk').default
// Instantiate the SDKconst tcgdex = new TCGdex('en');
// go into an async context(async () => { // Card will be Furret from the Darkness Ablaze Set const card = await tcgdex.fetch('cards', 'swsh3-136');})();
<script> // Instantiate the SDK const tcgdex = new TCGdex('en');
// go into an async context ;(async () => { // Card will be Furret from the Darkness Ablaze Set const card = await tcgdex.fetch('cards', 'swsh3-136'); })();</script>
You can check in the JSON REST API docs and select the correct tab to see the command specific for your SDK