import CacheInterface from '@cachex/core'; declare class Query { params: Array<{ key: string; value: string | number | boolean; }>; not: { equal: (key: string, value: string) => Query; contains: (key: string, value: string) => Query; includes: (key: string, value: string) => Query; like: (key: string, value: string) => Query; isNull: (key: string) => Query; }; static create(): Query; includes(key: string, value: string): this; like(key: string, value: string): this; contains(key: string, value: string): this; equal(key: string, value: string): this; sort(key: string, order: 'ASC' | 'DESC'): this; greaterOrEqualThan(key: string, value: number): this; lesserOrEqualThan(key: string, value: number): this; greaterThan(key: string, value: number): this; lesserThan(key: string, value: number): this; isNull(key: string): this; paginate(page: number, itemsPerPage: number): this; } type SupportedLanguages = 'en' | 'fr' | 'es' | 'es-mx' | 'it' | 'pt' | 'pt-br' | 'de' | 'nl' | 'pl' | 'ru' | 'ja' | 'ko' | 'zh-tw' | 'id' | 'th' | 'zh-cn' /** * @deprecated This is not used anymore in the API V2 */ type Languages = Partial> interface SerieResume$1 { id: string name: string logo?: string } interface Serie$1 extends SerieResume$1 { sets: SetList } interface variants { normal?: boolean reverse?: boolean holo?: boolean firstEdition?: boolean } interface booster { id: string name: string logo?: string artwork_front?: string artwork_back?: string } type SetList = Array type SerieList = Array type CardList = Array type BoosterList = Array interface SetResume$1 { id: string name: string logo?: string symbol?: string cardCount: { /** * total of number of cards */ total: number /** * number of cards officialy (on the bottom of each cards) */ official: number } } interface Set$1 extends SetResume$1 { serie: SerieResume$1 tcgOnline?: string variants?: variants releaseDate: string /** * Designate if the set is usable in tournaments * * Note: this is specific to the set and if a * card is banned from the set it will still be true */ legal: { /** * Ability to play in standard tournaments */ standard: boolean /** * Ability to play in expanded tournaments */ expanded: boolean } cardCount: { /** * total of number of cards */ total: number /** * number of cards officialy (on the bottom of each cards) */ official: number /** * number of cards having a normal version */ normal: number /** * number of cards having an reverse version */ reverse: number /** * number of cards having an holo version */ holo: number /** * Number of possible cards */ firstEd?: number } cards: CardList boosters?: BoosterList } interface CardResume$1 { id: string localId: string /** * Card Name (Including the suffix if next to card name) */ name: string image?: string } interface Card$1 extends CardResume$1 { /** * Card illustrator */ illustrator?: string /** * Card Rarity * * - None https://www.tcgdex.net/database/sm/smp/SM01 * - Common https://www.tcgdex.net/database/xy/xy9/1 * - Uncommon https://www.tcgdex.net/database/xy/xy9/2 * - Rare https://www.tcgdex.net/database/xy/xy9/3 * - Ultra Rare * - Secret Rare */ rarity: string /** * Card Category * * - Pokemon * - Trainer * - Energy */ category: string /** * Card Variants (Override Set Variants) */ variants?: variants /** * Card Set */ set: SetType /** * Pokemon only elements */ /** * Pokemon Pokedex ID */ dexId?: Array /** * Pokemon HP */ hp?: number /** * Pokemon Types * ex for multiple https://www.tcgdex.net/database/ex/ex13/17 */ types?: Array /** * Pokemon Sub Evolution */ evolveFrom?: string /** * Pokemon Weight */ weight?: string /** * Pokemon Description */ description?: string /** * Level of the Pokemon * * NOTE: can be equal to 'X' when the pokemon is a LEVEL-UP one */ level?: number | string /** * Pokemon Stage * * - Basic https://www.tcgdex.net/database/xy/xy9/1 * - BREAK https://www.tcgdex.net/database/xy/xy9/18 * - LEVEL-UP https://www.tcgdex.net/database/dp/dp1/121 * - MEGA https://www.tcgdex.net/database/xy/xy1/2 * - RESTORED https://www.tcgdex.net/database/bw/bw5/53 * - Stage1 https://www.tcgdex.net/database/xy/xy9/2 * - Stage2 https://www.tcgdex.net/database/xy/xy9/3 * - VMAX https://www.tcgdex.net/database/swsh/swsh1/50 */ stage?: string /** * Card Suffix * * - EX https://www.tcgdex.net/database/ex/ex2/94 * - GX https://www.tcgdex.net/database/sm/sm12/4 * - V https://www.tcgdex.net/database/swsh/swsh1/1 * - Legend https://www.tcgdex.net/database/hgss/hgss1/114 * - Prime https://www.tcgdex.net/database/hgss/hgss2/85 * - SP https://www.tcgdex.net/database/pl/pl1/7 * - TAG TEAM-GX https://www.tcgdex.net/database/sm/sm12/226 */ suffix?: string /** * Pokemon Held Item * * ex https://www.tcgdex.net/database/dp/dp2/75 */ item?: { name: string effect: string } /** * Pokemon Abilities * * multi abilities ex https://www.tcgdex.net/database/ex/ex15/10 */ abilities?: Array<{ type: string name: string effect: string }> /** * Pokemon Attacks */ attacks?: Array<{ cost?: Array name: string effect?: string damage?: string | number }> /** * Pokemon Weaknesses */ weaknesses?: Array<{ type: string value?: string }> resistances?: Array<{ type: string value?: string }> retreat?: number // Trainer/Energy effect?: string // Trainer Only trainerType?: string // Energy Only energyType?: string /** * Define the rotation mark on cards >= Sword & Shield */ regulationMark?: string /** * Card ability to be played in official tournaments * * Note: all cards are avaialable to play in unlimited tournaments */ legal: { /** * Ability to play in standard tournaments */ standard: boolean /** * Ability to play in expanded tournaments */ expanded: boolean } boosters?: BoosterList } type StringEndpointList = Array interface StringEndpoint$1 { name: string cards: Array } type Quality = 'low' | 'high' type Extension = 'jpg' | 'webp' | 'png' type Endpoints = 'cards' | 'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'series' | 'sets' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants' | 'random' declare abstract class Model { protected readonly sdk: TCGdex; constructor(sdk: TCGdex); /** * build a model depending on the data given * @param model the model to build * @param data the data to fill it with */ static build(model: T, data?: object): T; protected fill(obj: object): void; } declare class Endpoint { protected readonly tcgdex: TCGdex; protected readonly itemModel: new (sdk: TCGdex) => Item; protected readonly listModel: new (sdk: TCGdex) => List; protected readonly endpoint: Endpoints; constructor(tcgdex: TCGdex, itemModel: new (sdk: TCGdex) => Item, listModel: new (sdk: TCGdex) => List, endpoint: Endpoints); get(id: string | number): Promise; list(query?: Query): Promise>; } declare class SimpleEndpoint { protected readonly tcgdex: TCGdex; protected readonly itemModel: new (sdk: TCGdex) => Item; protected readonly endpoint: Endpoints; constructor(tcgdex: TCGdex, itemModel: new (sdk: TCGdex) => Item, endpoint: Endpoints); get(id: string | number): Promise; list(query?: Query): Promise>; } declare class CardResume extends Model { /** * Globally unique card ID based on the set ID and the cards ID within the set */ id: string; /** * Card image url without the extension and quality * * @see {@link getImageURL} */ image?: string; /** * ID indexing this card within its set, usually just its number */ localId: string; /** * Card Name (Including the suffix if next to card name) */ name: string; /** * the the Card Image full URL * * @param {Quality} quality the quality you want your image to be in * @param {Extension} extension extension you want you image to be * @return the full card URL */ getImageURL(quality?: Quality, extension?: Extension): string; /** * Get the full Card * * @return the full card if available */ getCard(): Promise; } interface Variants { normal?: boolean reverse?: boolean holo?: boolean firstEdition?: boolean } interface Booster { id: string name: string logo?: string artwork_front?: string artwork_back?: string } /** * A better version of variants with additionnal details on each variants */ interface VariantsDetailed { /** * define the variant type * - normal: no holographic elements * - holo: the illustration has a foil * - reverse: everything but the illustration is foiled */ type: string /** * Some older sets had specific subtypes for the cards * i.e Base Set had shadowless with and without a 1st-edition stamp. * and the Unlimited version of the set had no shadow. */ subtype?: string /** * define the size of the card * - standard: the classic size of a card * - jumbo: also said oversized, big card. */ size?: string /** * indicate that this variant has stamps * a card may have multiple stamps, example "Ethan's Typhlosion pre-release staff" * this was a pre-release card only given to staff and has both the set-logo and the staff stamp. * - 1st-edition: a 1st-edition card (mostly for the first series of the game) * - w-promo: * - pre-release: * - pokemon-center: a card that is stamped with the Pokémon Center logo * - set-promo: a card that is stamped with the set logo * - staff: a card that is stamped with the staff text * - gamestop: a card that is stamped with the GameStop logo * - eb-games: a card that is stamped with the EB Games logo * - snowflake: a card that is stamped with a snowflake, available in the yearly advent calendar * - trick-or-trade: a card that is stamped with a pikachu-pumpkin, available in the yearly halloween/trick-or-trade boosters * - ace-trainer: a card that is stamped with a golden ACE TRAINER, won by getting 200 championship points in the season since 2025 season. * - player-rewards-program: a card that is stamped with the player reward logo, available in the yearly player rewards program (play! pokemon prize pack) * - etc... */ stamp?: Array /** * for the holo & reverse, **optional** indicate which foil is used on the card */ foil?: string /** * IDs from third part websites */ thirdParty?: { cardmarket?: number tcgplayer?: number } /** * A unique ID defining this variant */ variantId: string } declare class SerieResume extends Model { id: string; name: string; logo?: string; /** * the the Card Image full URL * * @param {Quality} quality the quality you want your image to be in * @param {Extension} extension extension you want you image to be * @return the full card URL */ getImageURL(extension?: Extension): string; getSerie(): Promise; } declare class SetResume extends Model { id: string; name: string; logo?: string; symbol?: string; cardCount: { /** * total of number of cards */ total: number; /** * number of cards officialy (on the bottom of each cards) */ official: number; }; getSet(): Promise; } declare class Serie extends SerieResume { sets: Array; protected fill(obj: object): void; } declare class Set extends Model { id: string; name: string; logo?: string; symbol?: string; serie: SerieResume; tcgOnline?: string; variants?: Variants; releaseDate: string; /** * Designate if the set is usable in tournaments * * Note: this is specific to the set and if a * card is banned from the set it will still be true */ legal: { /** * Ability to play in standard tournaments */ standard: boolean; /** * Ability to play in expanded tournaments */ expanded: boolean; }; cardCount: { /** * total of number of cards */ total: number; /** * number of cards officialy (on the bottom of each cards) */ official: number; /** * number of cards having a normal version */ normal: number; /** * number of cards having an reverse version */ reverse: number; /** * number of cards having an holo version */ holo: number; /** * Number of possible cards */ firstEd?: number; }; cards: Array; boosters?: Array; getSerie(): Promise; protected fill(obj: object): void; } declare class Card extends CardResume { /** * Card illustrator */ illustrator?: string; /** * Card Rarity * * - None https://www.tcgdex.net/database/sm/smp/SM01 * - Common https://www.tcgdex.net/database/xy/xy9/1 * - Uncommon https://www.tcgdex.net/database/xy/xy9/2 * - Rare https://www.tcgdex.net/database/xy/xy9/3 * - Ultra Rare * - Secret Rare */ rarity: string; /** * Card Category * * - Pokemon * - Trainer * - Energy */ category: string; /** * Card Variants (Override Set Variants) * @deprecated Use `variantsDetailed` when possible */ variants?: Variants; /** * A second generation variants system that will replace the previous one at [variants] in v3 */ variantsDetailed?: Array; /** * Card Set */ set: SetResume; /** * Pokemon only elements */ /** * Pokemon Pokedex ID */ dexId?: Array; /** * Pokemon HP */ hp?: number; /** * Pokemon Types * ex for multiple https://www.tcgdex.net/database/ex/ex13/17 */ types?: Array; /** * Pokemon Sub Evolution */ evolveFrom?: string; /** * Pokemon Weight */ weight?: string; /** * Pokemon Description */ description?: string; /** * Level of the Pokemon * * NOTE: can be equal to 'X' when the pokemon is a LEVEL-UP one */ level?: number | string; /** * Pokemon Stage * * - Basic https://www.tcgdex.net/database/xy/xy9/1 * - BREAK https://www.tcgdex.net/database/xy/xy9/18 * - LEVEL-UP https://www.tcgdex.net/database/dp/dp1/121 * - MEGA https://www.tcgdex.net/database/xy/xy1/2 * - RESTORED https://www.tcgdex.net/database/bw/bw5/53 * - Stage1 https://www.tcgdex.net/database/xy/xy9/2 * - Stage2 https://www.tcgdex.net/database/xy/xy9/3 * - VMAX https://www.tcgdex.net/database/swsh/swsh1/50 */ stage?: string; /** * Card Suffix * * - EX https://www.tcgdex.net/database/ex/ex2/94 * - GX https://www.tcgdex.net/database/sm/sm12/4 * - V https://www.tcgdex.net/database/swsh/swsh1/1 * - Legend https://www.tcgdex.net/database/hgss/hgss1/114 * - Prime https://www.tcgdex.net/database/hgss/hgss2/85 * - SP https://www.tcgdex.net/database/pl/pl1/7 * - TAG TEAM-GX https://www.tcgdex.net/database/sm/sm12/226 */ suffix?: string; /** * Pokemon Held Item * * ex https://www.tcgdex.net/database/dp/dp2/75 */ item?: { name: string; effect: string; }; /** * Pokemon Abilities * * multi abilities ex https://www.tcgdex.net/database/ex/ex15/10 */ abilities?: Array<{ type: string; name: string; effect: string; }>; /** * Pokemon Attacks */ attacks?: Array<{ cost?: Array; name: string; effect?: string; damage?: string | number; }>; /** * Pokemon Weaknesses */ weaknesses?: Array<{ type: string; value?: string; }>; resistances?: Array<{ type: string; value?: string; }>; retreat?: number; effect?: string; trainerType?: string; energyType?: string; /** * Define the rotation mark on cards >= Sword & Shield */ regulationMark?: string; /** * Card ability to be played in official tournaments * * Note: all cards are avaialable to play in unlimited tournaments */ legal: { /** * Ability to play in standard tournaments */ standard: boolean; /** * Ability to play in expanded tournaments */ expanded: boolean; }; boosters?: Array; getCard(): Promise; getSet(): Promise; protected fill(obj: object): void; } declare class StringEndpoint extends Model { name: string; cards: Array; protected fill(obj: object): void; } declare class TCGdex { /** * How the remote data is going to be fetched */ static fetch: typeof fetch; /** * @deprecated to change the lang use {@link TCGdex.getLang} and {@link TCGdex.setLang} */ static defaultLang: SupportedLanguages; /** * the previously hidden caching system used by TCGdex to not kill the API */ cache: CacheInterface; /** * the default cache TTL, only subsequent requests will have their ttl changed */ cacheTTL: number; readonly random: { card: () => Promise; set: () => Promise; serie: () => Promise; }; readonly card: Endpoint; readonly set: Endpoint; readonly serie: Endpoint; readonly type: SimpleEndpoint; readonly retreat: SimpleEndpoint; readonly rarity: SimpleEndpoint; readonly illustrator: SimpleEndpoint; readonly hp: SimpleEndpoint; readonly categorie: SimpleEndpoint; readonly dexID: SimpleEndpoint; readonly energyType: SimpleEndpoint; readonly regulationMark: SimpleEndpoint; readonly stage: SimpleEndpoint; readonly suffixe: SimpleEndpoint; readonly trainerType: SimpleEndpoint; readonly variant: SimpleEndpoint; private lang; private endpointURL; constructor(lang?: SupportedLanguages); /** * @deprecated use the constructor parameter or {@link TCGdex.setLang} when in an instance */ static setDefaultLang(lang: SupportedLanguages): void; /** * @deprecated use {@link TCGdex.setLang} when in an instance */ static getDefaultLang(): SupportedLanguages; /** * the endpoint URL * ex: `https://api.tcgdex.net/v2` * @param endpoint the url */ setEndpoint(endpoint: string): void; getEndpoint(): string; /** * set the current cache methodology * @param cache the cache to use */ setCache(cache: CacheInterface): void; /** * get the current cache methodology * @param cache the cache to use */ getCache(): CacheInterface; /** * the endpoint URL * ex: `https://api.tcgdex.net/v2` * @param endpoint the url */ setCacheTTL(seconds: number): void; /** * get the current useed cache ttl in seconds * @returns the cache ttl in seconds */ getCacheTTL(): number; getLang(): SupportedLanguages; setLang(lang: SupportedLanguages): void; /** * Shortcut to easily fetch a card using both it's global id and it's local ID * @param id the card global/local ID * @param set the card set name/ID (optionnal) * @returns the card object */ fetchCard(id: string | number, set?: string): Promise; /** * Shortcut to easily fetch cards using an optionnal set name/ID * @param set the card set name/ID (optionnal) * @returns a card list */ fetchCards(set?: string): Promise | undefined>; /** * @deprecated use `this.fetch('sets', set)` */ fetchSet(set: string): Promise; /** * @deprecated use `this.fetch('series', serie)` */ fetchSerie(serie: string): Promise; /** * @deprecated use `this.fetch('series')` */ fetchSeries(): Promise; /** * Shortcut to easily fetch sets using an optionnal serie name/ID * @param serie the card set name/ID (optionnal) * @returns a card list */ fetchSets(serie?: string): Promise; /** * Fetch a card using its global id * @param endpoint_0 'cards' * @param endpoint_1 {string} the card global ID */ fetch(...type: ['cards', string]): Promise; /** * Fetch every cards in the database * @param endpoint_0 'cards' */ fetch(type: 'cards'): Promise | undefined>; /** * Fetch a card using its local id and its set * @param endpoint_0 'sets' * @param endpoint_1 {string} the set name or ID * @param endpoint_2 {string} the card local ID */ fetch(...endpoint: ['sets', string, string]): Promise; /** * Fetch a set * @param endpoint_0 'sets' * @param endpoint_1 {string} the set name or ID */ fetch(...endpoint: ['sets', string]): Promise; /** * Fetch a random element * @param endpoint_0 'random' * @param endpoint_1 {'set' | 'card' | 'serie'} the type of random element you want to get */ fetch(...endpoint: ['random', 'set' | 'card' | 'serie']): Promise; /** * Fetch every sets * @param endpoint_0 'sets' */ fetch(endpoint: 'sets'): Promise; /** * Fetch a serie * @param endpoint_0 'series' * @param endpoint_1 {string} the serie name or ID */ fetch(...endpoint: ['series', string]): Promise; /** * Fetch every series * @param endpoint_0 'series' */ fetch(endpoint: 'series'): Promise; /** * Fetch cards depending on a specific filter * @param endpoint_0 {'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants'} * Possible value 'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants' * @param endpoint_1 {string} the value set while fetching the index */ fetch(...endpoint: ['categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants', string]): Promise; /** * Fetch cards depending on a specific filter * @param endpoint_0 {'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants'} * Possible value 'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants' * @param endpoint_1 {string} Fetch the possible values to use depending on the endpoint */ fetch(endpoint: 'categories' | 'dex-ids' | 'energy-types' | 'hp' | 'illustrators' | 'rarities' | 'regulation-marks' | 'retreats' | 'stages' | 'suffixes' | 'trainer-types' | 'types' | 'variants'): Promise | undefined>; /** * @param endpoint the endpoint to fetch * @param query the query */ fetchWithQuery(endpoint: [Endpoints, ...Array], query?: Array<{ key: string; value: string | number | boolean; }>): Promise; /** * format the final URL */ private getFullURL; private actualFetch; } export { BoosterList, Card$1 as Card, CardList, Card as CardModel, CardResume$1 as CardResume, CardResume as CardResumeModel, Endpoint, Endpoints, Extension, Languages, Model, Quality, Query, Serie$1 as Serie, SerieList, Serie as SerieModel, SerieResume$1 as SerieResume, SerieResume as SerieResumeModel, Set$1 as Set, SetList, Set as SetModel, SetResume$1 as SetResume, SetResume as SetResumeModel, SimpleEndpoint, StringEndpoint$1 as StringEndpoint, StringEndpointList, SupportedLanguages, TCGdex as default };