mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-07-04 13:19:21 +00:00
19
interfaces/Ability.ts
Normal file
19
interfaces/Ability.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import AbilityType, { AbilityTypeSimple } from "./AbilityType";
|
||||
import LangList from "./LangList";
|
||||
|
||||
export interface AbilitySingle extends AbilitySimple {
|
||||
type: AbilityTypeSimple
|
||||
text: string
|
||||
}
|
||||
|
||||
export interface AbilitySimple {
|
||||
// id: number // WIP
|
||||
name: string
|
||||
}
|
||||
|
||||
export default interface Ability {
|
||||
id?: number
|
||||
type: AbilityType
|
||||
name: LangList<string>
|
||||
text: LangList<string>
|
||||
}
|
13
interfaces/AbilityType.ts
Normal file
13
interfaces/AbilityType.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export interface AbilityTypeSimple {
|
||||
id: AbilityType
|
||||
name: string
|
||||
}
|
||||
|
||||
enum AbilityType {
|
||||
POKEBODY,
|
||||
POKEPOWER,
|
||||
TALENT,
|
||||
ANCIENTTRAIT
|
||||
}
|
||||
|
||||
export default AbilityType
|
20
interfaces/Attack.ts
Normal file
20
interfaces/Attack.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import Type from "./Type";
|
||||
import LangList from "./LangList";
|
||||
|
||||
export interface AttackSingle extends AttackSimple {
|
||||
cost?: Array<string>
|
||||
text?: string
|
||||
damage?: string|number
|
||||
}
|
||||
|
||||
export interface AttackSimple {
|
||||
// id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export default interface Attack {
|
||||
cost?: Array<Type>
|
||||
name: LangList<string>
|
||||
text?: LangList<string>
|
||||
damage?: string|number
|
||||
}
|
130
interfaces/Card.ts
Normal file
130
interfaces/Card.ts
Normal file
@ -0,0 +1,130 @@
|
||||
import Type, { TypeSimple } from "./Type";
|
||||
import Tag, { TagSimple } from "./Tag";
|
||||
import { RaritySimple, Rarity } from "./Rarity";
|
||||
import { CategorySimple, Category } from "./Category";
|
||||
import { IllustratorSimple } from "./Illustrator";
|
||||
import Ability, { AbilitySingle } from "./Ability";
|
||||
import Attack, { AttackSingle } from "./Attack";
|
||||
import { List } from "./General";
|
||||
import LangList from "./LangList";
|
||||
import Set from "./Set";
|
||||
|
||||
export interface CardSimple {
|
||||
id: string
|
||||
name: string
|
||||
image: string
|
||||
}
|
||||
|
||||
export interface CardSingle {
|
||||
// General
|
||||
id: string
|
||||
localId: number|string
|
||||
name: string
|
||||
image?: {
|
||||
low: string
|
||||
high?: string
|
||||
}
|
||||
tags: Array<TagSimple>
|
||||
illustrator?: IllustratorSimple
|
||||
rarity: RaritySimple
|
||||
category: CategorySimple
|
||||
set: {
|
||||
name: string
|
||||
code: string
|
||||
}
|
||||
cardTypes?: {
|
||||
normal: boolean
|
||||
reverse: boolean
|
||||
holo: boolean
|
||||
firstEd: boolean
|
||||
}
|
||||
|
||||
// Pokémon only
|
||||
hp?: number
|
||||
dexId?: number
|
||||
type?: Array<TypeSimple>
|
||||
evolveFrom?: string
|
||||
evolveTo?: Array<string>
|
||||
abilities?: Array<AbilitySingle>
|
||||
attacks?: Array<AttackSingle>
|
||||
weaknesses?: Array<WeakRes>
|
||||
|
||||
resistances?: Array<WeakRes>
|
||||
retreat?: number
|
||||
|
||||
// Trainer/Energy only
|
||||
effect?: string
|
||||
}
|
||||
|
||||
export type CardList = List<CardSimple>
|
||||
|
||||
type WeakRes = {
|
||||
type: TypeSimple
|
||||
value?: string
|
||||
}
|
||||
|
||||
type Card = {
|
||||
|
||||
// global id made of setid and localId
|
||||
id: string
|
||||
|
||||
// set id
|
||||
localId: string|number
|
||||
|
||||
dexId?: number
|
||||
|
||||
// Card informations (from top to bottom of card)
|
||||
name: LangList<string>
|
||||
hp?: number //optionnal because energy/trainer cards might have not any hp
|
||||
type?: Array<Type> // ex for multiple https://api.pokemon.com/us/pokemon-tcg/pokemon-cards/ex-series/ex13/17/
|
||||
|
||||
image?: {
|
||||
low: LangList<string>
|
||||
high?: LangList<string>
|
||||
}
|
||||
|
||||
evolveFrom?: LangList<string>
|
||||
evolveTo?: Array<LangList<string>>
|
||||
tags: Array<Tag> // made after
|
||||
illustrator?: string
|
||||
|
||||
abilities?: Array<Ability>
|
||||
|
||||
attacks?: Array<Attack>
|
||||
|
||||
// If card is trainer or energy effect is here
|
||||
effect?: LangList<string>
|
||||
|
||||
weaknesses?: Array<{
|
||||
type: Type
|
||||
value?: string
|
||||
}>
|
||||
|
||||
resistances?: Array<{
|
||||
type: Type
|
||||
value?: string
|
||||
}>
|
||||
|
||||
retreat?: number
|
||||
|
||||
rarity: Rarity
|
||||
|
||||
// Other elements
|
||||
category: Category
|
||||
set: {
|
||||
name: string
|
||||
code: string
|
||||
}| Set
|
||||
|
||||
/**
|
||||
* Override Set defaults
|
||||
*/
|
||||
cardTypes?: {
|
||||
normal: boolean
|
||||
reverse: boolean
|
||||
holo: boolean
|
||||
firstEd: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export default Card
|
24
interfaces/Category.ts
Normal file
24
interfaces/Category.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { List } from "./General"
|
||||
import { CardSimple } from "./Card"
|
||||
|
||||
export enum Category {
|
||||
POKEMON,
|
||||
TRAINER,
|
||||
ENERGY
|
||||
}
|
||||
|
||||
export default Category
|
||||
|
||||
export type CategorySingle = {
|
||||
id: Category
|
||||
name: string
|
||||
cards: Array<CardSimple>
|
||||
}
|
||||
|
||||
|
||||
export type CategorySimple = {
|
||||
id: Category
|
||||
name: string
|
||||
}
|
||||
|
||||
export type CategoryList = List<CategorySimple>
|
22
interfaces/Expansion.ts
Normal file
22
interfaces/Expansion.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { SetSimple } from "./Set";
|
||||
import { List } from "./General";
|
||||
import LangList from "./LangList";
|
||||
|
||||
export type ExpansionSingle = {
|
||||
code: string
|
||||
name: string
|
||||
sets: Array<SetSimple>
|
||||
}
|
||||
|
||||
export type ExpansionSimple = {
|
||||
code: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export type ExpansionList = List<ExpansionSimple>
|
||||
|
||||
export default interface Expansion {
|
||||
name: LangList<string> | string
|
||||
code: string
|
||||
sets?: Array<string>
|
||||
}
|
4
interfaces/General.ts
Normal file
4
interfaces/General.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export type List<T> = {
|
||||
count: number
|
||||
list: Array<T>
|
||||
}
|
11
interfaces/Hp.ts
Normal file
11
interfaces/Hp.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { CardSimple } from "./Card";
|
||||
import { List } from "./General";
|
||||
|
||||
export type HpSingle = {
|
||||
hp: number
|
||||
cards: Array<CardSimple>
|
||||
}
|
||||
|
||||
export type HpSimple = number
|
||||
|
||||
export type HpList = List<HpSimple>
|
24
interfaces/Illustrator.ts
Normal file
24
interfaces/Illustrator.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { CardSimple } from "./Card";
|
||||
|
||||
export type IllustratorSingle = {
|
||||
id: number,
|
||||
name: string,
|
||||
cards: Array<CardSimple>
|
||||
}
|
||||
|
||||
export interface IllustratorSimple {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface IllustratorsList {
|
||||
count: number
|
||||
list: Array<IllustratorSimple>
|
||||
}
|
||||
|
||||
interface Illustrator {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
export default Illustrator
|
15
interfaces/LangList.ts
Normal file
15
interfaces/LangList.ts
Normal file
@ -0,0 +1,15 @@
|
||||
type LangList<T> = {
|
||||
[key in Langs]?: T
|
||||
}
|
||||
|
||||
export type Langs = "en" | "fr"
|
||||
|
||||
namespace LangList {
|
||||
export function insert(from: LangList<any>, el: any, lang: Langs) {
|
||||
if (typeof from !== "object") from = {}
|
||||
from[lang] = el
|
||||
return from
|
||||
}
|
||||
}
|
||||
|
||||
export default LangList
|
6
interfaces/Langs.ts
Normal file
6
interfaces/Langs.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { Langs as l } from './LangList'
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export type Langs = l
|
32
interfaces/Rarity.ts
Normal file
32
interfaces/Rarity.ts
Normal file
@ -0,0 +1,32 @@
|
||||
export enum Rarity {
|
||||
Common,
|
||||
Uncommon,
|
||||
Rare,
|
||||
|
||||
// Rare holo
|
||||
RareHolo,
|
||||
RareHoloEX,
|
||||
RareHoloGX,
|
||||
RareHoloLvX,
|
||||
|
||||
// Rare other
|
||||
RareUltra,
|
||||
RarePrime,
|
||||
RareACE,
|
||||
RareBREAK,
|
||||
RareRainbow,
|
||||
|
||||
// Other
|
||||
LEGEND,
|
||||
|
||||
// V & Vmax
|
||||
RareV,
|
||||
RareVMAX,
|
||||
}
|
||||
|
||||
export default Rarity
|
||||
|
||||
export interface RaritySimple {
|
||||
id: Rarity
|
||||
name: string
|
||||
}
|
13
interfaces/Retreat.ts
Normal file
13
interfaces/Retreat.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { CardSimple } from "./Card";
|
||||
|
||||
export type RetreatSimple = number
|
||||
|
||||
export interface RetreatSingle {
|
||||
id: RetreatSimple
|
||||
cards: Array<CardSimple>
|
||||
}
|
||||
|
||||
export interface RetreatList {
|
||||
count: number,
|
||||
list: Array<RetreatSimple>
|
||||
}
|
158
interfaces/Set.ts
Normal file
158
interfaces/Set.ts
Normal file
@ -0,0 +1,158 @@
|
||||
import { CardSimple } from "./Card";
|
||||
import { List } from "./General";
|
||||
import LangList from "./LangList";
|
||||
import Expansion from "./Expansion";
|
||||
|
||||
|
||||
export type SetRequest = SetSingle
|
||||
|
||||
export type SetSingle = {
|
||||
name: string
|
||||
code: string
|
||||
|
||||
expansionCode?: string
|
||||
tcgoCode?: string
|
||||
|
||||
cardCount: {
|
||||
total: number
|
||||
official: number
|
||||
}
|
||||
|
||||
releaseDate: Date|string
|
||||
|
||||
legal?: {
|
||||
standard: boolean
|
||||
expanded: boolean
|
||||
}
|
||||
|
||||
images?: {
|
||||
symbol?: string
|
||||
logo?: string
|
||||
}
|
||||
|
||||
list: Array<CardSimple>
|
||||
}
|
||||
|
||||
export type SetSimple = {
|
||||
code: string
|
||||
name: string
|
||||
total: number
|
||||
}
|
||||
|
||||
export type SetList = List<SetSimple>
|
||||
|
||||
|
||||
export default interface Set {
|
||||
/**
|
||||
* Display Name
|
||||
*/
|
||||
name: LangList<string> | string
|
||||
|
||||
/**
|
||||
* Expansion Object
|
||||
*/
|
||||
expansion?: Expansion
|
||||
|
||||
/**
|
||||
* Expansion code
|
||||
*/
|
||||
expansionCode?: string
|
||||
|
||||
/**
|
||||
* Set code (Also used as the slug)
|
||||
*/
|
||||
code: string
|
||||
|
||||
/**
|
||||
* Trading card online code
|
||||
*/
|
||||
tcgoCode?: string
|
||||
|
||||
cardCount: {
|
||||
/**
|
||||
* total number of cards including secrets
|
||||
*/
|
||||
total: number
|
||||
/**
|
||||
* number of card indicated at the bottom of each cards
|
||||
*/
|
||||
official: number
|
||||
}
|
||||
|
||||
cardTypes?: {
|
||||
/**
|
||||
* Default: true
|
||||
*/
|
||||
normal: boolean
|
||||
/**
|
||||
* Default: true
|
||||
*/
|
||||
reverse: boolean
|
||||
/**
|
||||
* Default: true
|
||||
*/
|
||||
holo: boolean
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
ed1: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Format of numbering
|
||||
* ex: SWSH[000] mean that it has SWSH as prefix and start at 000 -> 001 -> 002 -> etc
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Set
|
||||
*/
|
||||
format?: string
|
||||
|
||||
/**
|
||||
* Release date of the set
|
||||
* in format: yyyy-mm-dd
|
||||
* ex: 2002-12-22
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Set
|
||||
*/
|
||||
releaseDate: string // date in format yyyy-mm-dd
|
||||
|
||||
/**
|
||||
* Aol Endpoint for scrapping
|
||||
*/
|
||||
api?: string
|
||||
|
||||
/**
|
||||
* Competition usage
|
||||
*/
|
||||
legal?: {
|
||||
standard: boolean
|
||||
expanded: boolean
|
||||
}
|
||||
|
||||
images?: {
|
||||
/**
|
||||
* Symbol icon on bottom of card
|
||||
* available extensions [
|
||||
* webp
|
||||
* jpg
|
||||
* png
|
||||
* ]
|
||||
*/
|
||||
symbol?: string
|
||||
/**
|
||||
* Official logo of set
|
||||
* available extensions [
|
||||
* webp
|
||||
* jpg
|
||||
* png
|
||||
* ]
|
||||
*/
|
||||
logo?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Language in which the set is available
|
||||
*/
|
||||
availability?: LangList<boolean>
|
||||
}
|
31
interfaces/Tag.ts
Normal file
31
interfaces/Tag.ts
Normal file
@ -0,0 +1,31 @@
|
||||
enum Tag {
|
||||
BASIC,
|
||||
BASICENERGY,
|
||||
BREAK,
|
||||
EX,
|
||||
GX,
|
||||
ITEM,
|
||||
LEGEND,
|
||||
LEVELUP,
|
||||
MEGA,
|
||||
RESTORED,
|
||||
ROCKETSECRETMACHINE,
|
||||
SP,
|
||||
SPECIAL,
|
||||
STADIUM,
|
||||
STAGE1,
|
||||
STAGE2,
|
||||
SUPPORTER,
|
||||
TAGTEAM,
|
||||
TECHNICALMACHINE,
|
||||
TOOL,
|
||||
V,
|
||||
VMAX,
|
||||
}
|
||||
|
||||
export default Tag
|
||||
|
||||
export interface TagSimple {
|
||||
id: Tag
|
||||
name: string
|
||||
}
|
20
interfaces/Type.ts
Normal file
20
interfaces/Type.ts
Normal file
@ -0,0 +1,20 @@
|
||||
enum Type {
|
||||
COLORLESS,
|
||||
DARKNESS,
|
||||
DRAGON,
|
||||
FAIRY,
|
||||
FIGHTING,
|
||||
FIRE,
|
||||
GRASS,
|
||||
LIGHTNING,
|
||||
METAL,
|
||||
PSYCHIC,
|
||||
WATER,
|
||||
}
|
||||
|
||||
export interface TypeSimple {
|
||||
id: Type
|
||||
name: string
|
||||
}
|
||||
|
||||
export default Type
|
Reference in New Issue
Block a user