### Install Pokémon TCG SDK Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Installs the Pokémon TCG SDK for JavaScript using npm. This is the first step to using the SDK in your project. ```bash npm install --save pokemontcgsdk ``` -------------------------------- ### Get Single Card by ID Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Fetches a single Pokémon card by its unique ID. The result is a promise that resolves with the card data. ```javascript pokemon.card.find('base1-4') .then(card => { console.log(card.name) // "Charizard" }) ``` -------------------------------- ### Get Single Set by ID Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Fetches a single Pokémon TCG set by its unique ID. The result is a promise that resolves with the set data. ```javascript pokemon.set.find('base1') .then(set => { console.log(set.name) // "Base" }) ``` -------------------------------- ### Build and Test SDK Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Commands for building and testing the Pokémon TCG SDK. These are typically run during development or for contributing to the project. ```bash npm run build npm run test ``` -------------------------------- ### Pokémon TCG API Documentation Reference Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Provides an overview of the Pokémon TCG API endpoints and their functionalities. Refer to https://docs.pokemontcg.io for detailed query syntax and available fields. ```APIDOC API Endpoints: - /cards: Retrieve and filter Pokémon cards. - GET /cards/{id}: Get a single card by ID. - GET /cards: Filter cards using query parameters (q, page, pageSize). - GET /cards/all: Fetch all cards matching a query, with automatic pagination. - /sets: Retrieve and filter Pokémon TCG sets. - GET /sets/{id}: Get a single set by ID. - GET /sets: Filter sets using query parameters (q, page, pageSize). - GET /sets/all: Fetch all sets matching a query, with automatic pagination. - /supertypes: Get a list of all card supertypes. - /subtypes: Get a list of all card subtypes. - /types: Get a list of all card types. - /rarities: Get a list of all card rarities. Query Parameters: - q: String for filtering resources. Supports field-based queries (e.g., 'name:Pikachu', 'series:base'). - page: Integer specifying the page number for paginated results. - pageSize: Integer specifying the number of results per page. ``` -------------------------------- ### Configure API Key Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Configures the SDK with your API key. This is necessary for making authenticated requests to the Pokémon TCG API. ```javascript import pokemon from 'pokemontcgsdk' pokemon.configure({apiKey: '123abc'}) ``` -------------------------------- ### Fetch All Sets with Query Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves all Pokémon TCG sets matching a query, automatically handling pagination. The result is an array of set objects. ```javascript pokemon.set.all({ q: 'series:base' }) .then((cards) => { console.log(cards[0].name) // "Base" }) ``` -------------------------------- ### Fetch All Rarities Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves a list of all available rarities for Pokémon cards. Useful for understanding the distribution and collectibility of cards. ```javascript pokemon.rarity.all() ``` -------------------------------- ### Fetch All Cards with Query Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves all Pokémon cards matching a query, automatically handling pagination. The result is an array of card objects. ```javascript pokemon.card.all({ q: 'name:blastoise' }) .then((cards) => { console.log(cards[0].name) // "Blastoise" }) ``` -------------------------------- ### Fetch All Types Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves a list of all available types for Pokémon cards (e.g., Fire, Water, Grass). Essential for type-based searches and analysis. ```javascript pokemon.type.all() ``` -------------------------------- ### Fetch All Subtypes Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves a list of all available subtypes for Pokémon cards. This helps in categorizing and filtering cards based on their subtypes. ```javascript pokemon.subtype.all() ``` -------------------------------- ### Filter Sets by Query Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Filters Pokémon TCG sets using a query string. You can search sets by series or other available fields. The result is paginated. ```javascript pokemon.set.where({ q: 'series:base' }) .then(result => { console.log(result.data[0].name) // "Base" }) ``` -------------------------------- ### Filter Sets with Pagination Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Filters Pokémon TCG sets using a query string and specifies pagination parameters. This allows for precise retrieval of set data. ```javascript pokemon.set.where({ q: 'series:base', pageSize: 1, page: 1 }) .then(result => { console.log(result.data[0].name) // "Base" }) ``` -------------------------------- ### Fetch All Supertypes Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Retrieves a list of all available supertypes for Pokémon cards. This is useful for filtering or understanding card classifications. ```javascript pokemon.supertype.all() ``` -------------------------------- ### Filter Cards by Query Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Filters Pokémon cards using a query string. You can specify fields and values to search for. The result is paginated. ```javascript pokemon.card.where({ q: 'name:blastoise' }) .then(result => { console.log(result.data[0].name) // "Blastoise" }) ``` -------------------------------- ### Filter Cards with Pagination Source: https://github.com/pokemontcg/pokemon-tcg-sdk-javascript/blob/master/README.md Filters Pokémon cards using a query string and specifies pagination parameters like page size and page number. Useful for retrieving specific subsets of data. ```javascript pokemon.card.where({ q: 'name:blastoise', pageSize: 10, page: 3 }) .then(result => { console.log(result.data[0].name) // "Blastoise" }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.