1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-07-03 08:59:18 +00:00
Files
cards-database/meta/definitions/api.d.ts
2025-05-22 17:30:40 +02:00

452 lines
8.4 KiB
TypeScript

/**
* This file define how the API is architectured for the Compiler and the Javascript/Typescript SDK
*/
/**
* Booster interface
*/
export interface Booster {
/**
* the booster ID
*
* boo_<set_id>-<booster_name>
*/
id: `boo_${string}-${string}`
/**
* the name of the booster
*/
name: string
/**
* the logo of the booster
*/
logo?: string
/**
* the front of the booster pack
*/
artwork_front?: string
/**
* the back of the booster pack
*/
artwork_back?: string
}
/**
* /series endpoint
*/
export interface SerieResume {
id: string;
name: string;
logo?: string;
}
/**
* /series/:id endpoint
*/
export interface Serie extends SerieResume {
firstSet: SetResume;
lastSet: SetResume;
releaseDate: string;
sets: Array<SetResume>;
}
interface variants {
normal?: boolean;
reverse?: boolean;
holo?: boolean;
firstEdition?: boolean;
wPromo?: boolean
}
export interface SetResume {
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;
};
}
/**
* /sets/:id
*/
export interface Set extends SetResume {
serie: SerieResume;
tcgOnline?: string;
variants?: variants;
releaseDate: string;
/**
* The boosters available in this set
*/
boosters?: Array<Booster>
/**
* 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<CardResume>;
abbreviation: { official: string, localized: string };
}
export interface CardResume {
id: string;
localId: string;
/**
* Card Name (Including the suffix if next to card name)
*/
name: string;
image?: string;
}
/**
* /cards/:id
* /sets/:set/:localId
*/
export interface 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;
// rarity: { icon: string, designation: string }
/**
* Card Category
*
* - Pokemon
* - Trainer
* - Energy
*/
category: string
/**
* Card Variants
* @deprecated `variants` is deprecated in favor of the current `variants_detailed` that contains more informations & is WAY more precise
*/
variants?: variants
/**
* define the list of variants the card is available in
*/
variants_detailed?: Array<{
/**
* define the variant type
* - normal: no holographic elements
* - holo: the illustration has a foil
* - reverse: everything but the illustration is foiled
*/
type: 'normal' | 'holo' | 'reverse'
/**
* define the size of the card
* - standard: the classic size of a card
* - jumbo: also said oversized, big card.
*/
size?: 'standard' | 'jumbo'
/**
* indicate that this variant has a stamp
* - 1st edition: a 1st edition card (mostly for the first serie of the game)
* - w-promo:
* - pre-release:
*/
stamp?: '1st edition' | 'w-promo' | 'pre-release'
/**
* for the holo & reverse, **optionnnal** indicate which foil is used on the card
*/
foil?: 'pokeball' | 'hyperball'
}>
/**
* Card Set
*/
set: SetResume;
/**
* Pokemon only elements
*/
/**
* Pokemon Pokedex ID
*/
dexId?: Array<number>;
/**
* Pokemon HP
*/
hp?: number;
/**
* Pokemon Types
* ex for multiple https://www.tcgdex.net/database/ex/ex13/17
*/
types?: Array<string>;
/**
* 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<string>
/**
* the attack name
*/
name: string
/**
* the attack effect
*/
effect?: string
/**
* The damage text or number
*/
damage?: string | number
/**
* the damage amount as a number
*/
amount?: number
/**
* the damage operator as a standardized character
*/
operator?: '+' | 'x' | '-'
}>;
/**
* Pokemon Weaknesses
*/
weaknesses?: Array<{
/**
* Indicate the type the Pokémon is weak to
*/
type: string
/**
* the full line text of the weakness (excluding the type)
*/
value?: string
/**
* the amount as a number
* note: not set for old card but it is a `2`
*/
amount?: number
/**
* the operator
* note: not set for old cards, but it is a `x`
*/
operator?: '+' | 'x'
}>
resistances?: Array<{
/**
* Indicate the type the Pokémon resist
*/
type: string
/**
* the full line text of the resistance (excluding the type)
*/
value: string
/**
* the amount as a number
*/
amount: number
/**
* the operator, currently always a `-`
*/
operator: '-'
}>
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
}
/**
* the boosters in which the card is available
*/
boosters?: Array<Booster>
/**
* the list of Pokémons that appear on the card
*/
pokemons?: Array<{
/**
* the National Pokédex ID of the Pokémon
*
* note: you can then fetch aditionnal infos thorugh pokeapi.co like https://pokeapi.co/api/v2/pokemon/{id}
*/
id: number
/**
* The Pokémon name
*/
name: string
/**
* indicate if the pokémon is shiny or not
*/
isShiny?: true
}>
/**
* get the copyright informations about the card
*/
copyright?: {
text: string
year?: number
}
/**
* The card no.
*/
number: {
/**
* the first part of the no. (if there is no `/` it will include everything)
*/
nominator: string
/**
* a parseable area as a number (ex: 065 = 65, GG55 = 55)
*/
numeric: number
/**
* The second part of the no (skipped if there is no `/`)
*/
denominator?: string
}
updated: string
}
/**
* String Endpoint List
*/
export declare type StringEndpointList = Array<string>;
/**
* StringEndpoint
*/
export interface StringEndpoint {
name: string;
cards: Array<CardResume>;
}