javascript-sdk/interfaces.d.ts
Florian Bouillon edbcf7f4da
Add new cardCount field to set
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2021-05-02 15:48:26 +02:00

276 lines
5.4 KiB
TypeScript

export type SupportedLanguages = 'en' | 'fr'
export type Languages<T = string> = Partial<Record<SupportedLanguages, T>>
interface SerieResume {
id: string
name: string
}
export interface Serie extends SerieResume {
sets: SetList
}
interface variants {
normal?: boolean
reverse?: boolean
holo?: boolean
firstEdition?: boolean
}
export type Types = 'Colorless' | 'Darkness' | 'Dragon' |
'Fairy' | 'Fightning' | 'Fire' |
'Grass' | 'Lightning' | 'Metal' |
'Psychic' | 'Water'
export type SetList = Array<SetResume>
export type SerieList = Array<SerieResume>
export type CardList = Array<CardResume>
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
}
}
export interface Set extends SetResume {
serie: SerieResume
tcgOnline?: string
variants?: variants
releaseDate: string
legal?: {
standard: boolean
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
}
interface CardResume {
id: string
localId: string
/**
* Card Name (Including the suffix if next to card name)
*/
name: string
image?: string
}
export interface Card<SetType extends SetResume = SetResume> 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: 'None' | 'Common'| 'Uncommon' | 'Rare' | 'Ultra Rare' | 'Secret Rare'
/**
* Card Category
*
* - Pokemon
* - Trainer
* - Energy
*/
category: 'Pokemon' | 'Trainer' | 'Energy'
/**
* Card Variants (Override Set Variants)
*/
variants?: variants
/**
* Card Set
*/
set: SetType
/**
* Pokemon only elements
*/
/**
* Pokemon Pokedex ID
*/
dexId?: Array<number>
/**
* Pokemon HP
*/
hp?: number
/**
* Pokemon Types
*/
types?: Array<Types> // ex for multiple https://www.tcgdex.net/database/ex/ex13/17
/**
* 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?: 'Basic' | 'BREAK' | 'LEVEL-UP' | 'MEGA' | 'RESTORED' | 'Stage1' | 'Stage2' | 'VMAX'
/**
* 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?: 'EX' | 'GX' | 'V' | 'Legend' | 'Prime' | 'SP' | 'TAG TEAM-GX'
/**
* 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: 'Pokemon Power' | 'Poke-BODY' | 'Poke-POWER' | 'Ability' | 'Ancient Trait'
name: string
effect: string
}>
/**
* Pokemon Attacks
*/
attacks?: Array<{
cost?: Array<Types>
name: string
effect?: string
damage?: string | number
}>
/**
* Pokemon Weaknesses
*/
weaknesses?: Array<{
type: Types
value?: string
}>
resistances?: Array<{
type: Types
value?: string
}>
retreat?: number
//Trainer/Energy
effect?: string
// Trainer Only
trainerType?: 'Supporter' | // https://www.tcgdex.net/database/ex/ex7/83
'Item' | // https://www.tcgdex.net/database/ex/ex7/89
'Stadium' | // https://www.tcgdex.net/database/ex/ex7/87
'Tool' | // https://www.tcgdex.net/database/neo/neo1/93
'Ace Spec' | // https://www.tcgdex.net/database/bw/bw7/139
'Technical Machine' | // https://www.tcgdex.net/database/ecard/ecard1/144
'Goldenred Game Corner' | // https://www.tcgdex.net/database/neo/neo1/83
'Rocket\'s Secret Machine' // https://www.tcgdex.net/database/ex/ex7/84
// Energy Only
energyType?: 'Normal' | // https://www.tcgdex.net/database/ecard/ecard1/160
'Special' // https://www.tcgdex.net/database/ecard/ecard1/158
}
export type StringEndpointList = Array<string>
export interface StringEndpoint {
name: string
cards: Array<CardResume>
}