feat: Add support for boosters to set and card (#295)

This commit is contained in:
dhaber 2025-05-26 07:43:35 -04:00 committed by GitHub
parent c866b4022f
commit 95a658f98a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 2 deletions

13
src/interfaces.d.ts vendored
View File

@ -22,9 +22,18 @@ interface variants {
firstEdition?: boolean firstEdition?: boolean
} }
interface booster {
id: string
name: string
logo?: string
artwork_front?: string
artwork_back?: string
}
export type SetList = Array<SetResume> export type SetList = Array<SetResume>
export type SerieList = Array<SerieResume> export type SerieList = Array<SerieResume>
export type CardList = Array<CardResume> export type CardList = Array<CardResume>
export type BoosterList = Array<booster>
export interface SetResume { export interface SetResume {
id: string id: string
@ -105,6 +114,8 @@ export interface Set extends SetResume {
} }
cards: CardList cards: CardList
boosters?: BoosterList
} }
export interface CardResume { export interface CardResume {
@ -302,6 +313,8 @@ export interface Card<SetType extends SetResume = SetResume> extends CardResume
*/ */
expanded: boolean expanded: boolean
} }
boosters?: BoosterList
} }
export type StringEndpointList = Array<string> export type StringEndpointList = Array<string>

View File

@ -1,5 +1,5 @@
import CardResume from './CardResume' import CardResume from './CardResume'
import type { Variants } from './Other' import type { Booster, Variants } from './Other'
import type TCGdexSet from './Set' import type TCGdexSet from './Set'
import type SetResume from './SetResume' import type SetResume from './SetResume'
@ -188,6 +188,8 @@ export default class Card extends CardResume {
expanded: boolean expanded: boolean
} }
public boosters?: Array<Booster>
public override async getCard(): Promise<Card> { public override async getCard(): Promise<Card> {
return this return this
} }

View File

@ -4,3 +4,12 @@ export interface Variants {
holo?: boolean holo?: boolean
firstEdition?: boolean firstEdition?: boolean
} }
export interface Booster {
id: string
name: string
logo?: string
artwork_front?: string
artwork_back?: string
}

View File

@ -1,7 +1,7 @@
import { objectLoop } from '@dzeio/object-util' import { objectLoop } from '@dzeio/object-util'
import CardResume from './CardResume' import CardResume from './CardResume'
import Model from './Model' import Model from './Model'
import type { Variants } from './Other' import type { Booster, Variants } from './Other'
import type SerieResume from './SerieResume' import type SerieResume from './SerieResume'
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation> // biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
@ -70,6 +70,8 @@ export default class Set extends Model {
public cards!: Array<CardResume> public cards!: Array<CardResume>
public boosters?: Array<Booster>
public async getSerie() { public async getSerie() {
return this.sdk.serie.get(this.serie.id) return this.sdk.serie.get(this.serie.id)
} }