Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/interfaces.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Pricing } from "./models/Other"

export type SupportedLanguages = 'en' | 'fr' | 'es' | 'es-mx' | 'it' |
'pt' | 'pt-br' | 'de' | 'nl' | 'pl' | 'ru' |
'ja' | 'ko' | 'zh-tw' | 'id' | 'th' | 'zh-cn'
Expand Down Expand Up @@ -316,6 +318,8 @@ export interface Card<SetType extends SetResume = SetResume> extends CardResume
expanded: boolean
}

pricing?: Pricing;

boosters?: BoosterList
}

Expand Down
10 changes: 9 additions & 1 deletion src/models/Card.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { objectLoop } from '@dzeio/object-util'
import CardResume from './CardResume'
import type { Booster, Variants, VariantsDetailed } from './Other'
import type { Booster, Pricing, Variants, VariantsDetailed } from './Other'
import type TCGdexSet from './Set'
import type SetResume from './SetResume'

Expand Down Expand Up @@ -195,6 +195,14 @@ export default class Card extends CardResume {
expanded: boolean
}

/**
* Card pricing object which ingests pricing based off tcgplayer and cardmarket
*
* Note: Not availible for all cards.
*/

public pricing?: Pricing;

public boosters?: Array<Booster>

public override async getCard(): Promise<Card> {
Expand Down
44 changes: 43 additions & 1 deletion src/models/Other.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export interface Variants {
}

export interface Booster {

id: string
name: string
logo?: string
Expand Down Expand Up @@ -72,3 +71,46 @@ export interface VariantsDetailed {
*/
variantId: string
}

export interface TcgplayerVariantPricing {
lowPrice: number;
midPrice: number;
highPrice: number;
marketPrice: number;
directLowPrice: number;
}

/**
* Market pricing information from multiple sources
*/
export interface Pricing {
cardmarket?: {
idProduct?: number;
Comment thread
advra marked this conversation as resolved.
updated?: string;
unit?: string;
avg?: number;
low?: number;
trend?: number;
avg1?: number;
avg7?: number;
avg30?: number;
'avg-holo'?: number;
'low-holo'?: number;
'trend-holo'?: number;
'avg1-holo'?: number;
'avg7-holo'?: number;
'avg30-holo'?: number;
}
tcgplayer?: {
productId: number;
updated: string;
unit: string;
normal?: TcgplayerVariantPricing;
holofoil?: TcgplayerVariantPricing;
'reverse-holofoil'?: TcgplayerVariantPricing;
'1st-edition'?: TcgplayerVariantPricing;
'1st-edition-holofoil'?: TcgplayerVariantPricing;
'unlimited'?: TcgplayerVariantPricing;
'unlimited-holofoil'?: TcgplayerVariantPricing;
}
}