@pfdev/api-types 3.0.13 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/v3.ts +156 -4
package/package.json
CHANGED
package/v3.ts
CHANGED
|
@@ -37,10 +37,15 @@ export const CardSchema = Type.Object(
|
|
|
37
37
|
images: CardImagesSchema,
|
|
38
38
|
setid: Type.String({ description: 'Set this card belongs to' }),
|
|
39
39
|
setname: Type.String({ description: 'Name of the set' }),
|
|
40
|
-
price: Type.Optional(Type.Number({ description: '
|
|
40
|
+
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
41
41
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
42
42
|
change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
|
|
43
|
-
variants: Type.Optional(Type.Array(Type.String(), { description: 'Available variants for this card' }))
|
|
43
|
+
variants: Type.Optional(Type.Array(Type.String(), { description: 'Available variants for this card' })),
|
|
44
|
+
variant_prices: Type.Optional(
|
|
45
|
+
Type.Record(Type.String(), PriceStatsSchema, {
|
|
46
|
+
description: 'Prices and period changes keyed by variant name. Only present when requested via include=variant_prices. Variants without price data map to an empty object.'
|
|
47
|
+
})
|
|
48
|
+
)
|
|
44
49
|
},
|
|
45
50
|
{
|
|
46
51
|
title: 'Card',
|
|
@@ -68,6 +73,7 @@ export const CardListQuerySchema = Type.Object(
|
|
|
68
73
|
{
|
|
69
74
|
setid: Type.Optional(Type.String({ description: 'Filter by set ID' })),
|
|
70
75
|
name: Type.Optional(Type.String({ description: 'Search by card name' })),
|
|
76
|
+
include: Type.Optional(Type.Literal('variant_prices', { description: 'Include per-variant prices and period changes on each card' })),
|
|
71
77
|
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 250, default: 50, description: 'Max results to return' })),
|
|
72
78
|
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Pagination offset' }))
|
|
73
79
|
},
|
|
@@ -103,6 +109,15 @@ export const CardSearchQuerySchema = Type.Object({
|
|
|
103
109
|
|
|
104
110
|
export type CardSearchQuery = Static<typeof CardSearchQuerySchema>;
|
|
105
111
|
|
|
112
|
+
export const CardBatchQuerySchema = Type.Object({
|
|
113
|
+
ids: Type.String({
|
|
114
|
+
minLength: 1,
|
|
115
|
+
description: 'Comma-separated list of card IDs (e.g. "xy1-2,base1-4"). Duplicates are deduped. Max 200 IDs per request.'
|
|
116
|
+
})
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export type CardBatchQuery = Static<typeof CardBatchQuerySchema>;
|
|
120
|
+
|
|
106
121
|
export const CardDetailSchema = Type.Object(
|
|
107
122
|
{
|
|
108
123
|
cardid: Type.String({ description: 'Unique card identifier' }),
|
|
@@ -131,7 +146,7 @@ export const CardDetailSchema = Type.Object(
|
|
|
131
146
|
nationalPokedexNumbers: Type.Optional(Type.Array(Type.Number(), { description: 'National Pokédex numbers' })),
|
|
132
147
|
legalities: Type.Optional(Type.Any({ description: 'Format legalities' })),
|
|
133
148
|
regulationMark: Type.Optional(Type.String({ description: 'Regulation mark' })),
|
|
134
|
-
price: Type.Optional(Type.Number({ description: '
|
|
149
|
+
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
135
150
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
136
151
|
change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
|
|
137
152
|
variants: Type.Optional(Type.Array(Type.String(), { description: 'Available variants for this card' })),
|
|
@@ -559,6 +574,142 @@ export type DexCollectionItem = Static<typeof DexCollectionItemSchema>;
|
|
|
559
574
|
|
|
560
575
|
export const DexCollectionResponseSchema = Type.Array(DexCollectionItemSchema);
|
|
561
576
|
|
|
577
|
+
export const InventorySummaryItemSchema = Type.Object(
|
|
578
|
+
{
|
|
579
|
+
uuid: Type.String({ description: 'Unique ID of this inventory row' }),
|
|
580
|
+
cardid: Type.String({ description: 'Card ID this inventory row belongs to' }),
|
|
581
|
+
variant: Type.String({ description: 'Card variant (e.g. Normal, Holofoil, Reverse Holofoil)' }),
|
|
582
|
+
status: Type.Union([Type.Number(), Type.Null()], {
|
|
583
|
+
description: 'Numeric status code. <100 = active, >=100 = sold/past. Null when no details row exists yet.'
|
|
584
|
+
})
|
|
585
|
+
},
|
|
586
|
+
{ title: 'InventorySummaryItem' }
|
|
587
|
+
);
|
|
588
|
+
|
|
589
|
+
export type InventorySummaryItem = Static<typeof InventorySummaryItemSchema>;
|
|
590
|
+
|
|
591
|
+
export const InventorySummaryResponseSchema = Type.Array(InventorySummaryItemSchema, {
|
|
592
|
+
title: 'InventorySummaryResponse',
|
|
593
|
+
description: 'Lightweight ownership rows for the authenticated user. One entry per physical card owned. Suitable for a global client store.'
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
export type InventorySummaryResponse = Static<typeof InventorySummaryResponseSchema>;
|
|
597
|
+
|
|
598
|
+
export const InventoryAddRequestSchema = Type.Object(
|
|
599
|
+
{
|
|
600
|
+
cardid: Type.String({ minLength: 1, description: 'Card ID to add to inventory' }),
|
|
601
|
+
variant: Type.String({ minLength: 1, description: 'Card variant (e.g. Normal, Holofoil, Reverse Holofoil)' })
|
|
602
|
+
},
|
|
603
|
+
{ title: 'InventoryAddRequest' }
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
export type InventoryAddRequest = Static<typeof InventoryAddRequestSchema>;
|
|
607
|
+
|
|
608
|
+
export const InventoryDeleteParamSchema = Type.Object({
|
|
609
|
+
uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row to delete' })
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
export type InventoryDeleteParam = Static<typeof InventoryDeleteParamSchema>;
|
|
613
|
+
|
|
614
|
+
export const InventoryTransactionSchema = Type.Object(
|
|
615
|
+
{
|
|
616
|
+
tx_uuid: Type.String({ format: 'uuid' }),
|
|
617
|
+
transaction_type: Type.Number({ description: '100-199 = cost, 200-299 = income' }),
|
|
618
|
+
transaction_date: Type.String({ description: 'ISO date string' }),
|
|
619
|
+
amount: Type.Number(),
|
|
620
|
+
currency: Type.String(),
|
|
621
|
+
amount_usd: Type.Union([Type.Number(), Type.Null()]),
|
|
622
|
+
rate: Type.Union([Type.Number(), Type.Null()]),
|
|
623
|
+
description: Type.Union([Type.String(), Type.Null()]),
|
|
624
|
+
source_platform: Type.Union([Type.String(), Type.Null()])
|
|
625
|
+
},
|
|
626
|
+
{ title: 'InventoryTransaction' }
|
|
627
|
+
);
|
|
628
|
+
|
|
629
|
+
export type InventoryTransaction = Static<typeof InventoryTransactionSchema>;
|
|
630
|
+
|
|
631
|
+
export const InventoryItemDetailSchema = Type.Object(
|
|
632
|
+
{
|
|
633
|
+
uuid: Type.String({ format: 'uuid' }),
|
|
634
|
+
cardid: Type.String(),
|
|
635
|
+
variant: Type.String(),
|
|
636
|
+
status: Type.Union([Type.Number(), Type.Null()]),
|
|
637
|
+
grade: Type.Union([Type.String(), Type.Null()]),
|
|
638
|
+
acquired: Type.Union([Type.String(), Type.Null()]),
|
|
639
|
+
sold_date: Type.Union([Type.String(), Type.Null()]),
|
|
640
|
+
notes: Type.Union([Type.String(), Type.Null()]),
|
|
641
|
+
total_cost_usd: Type.Number(),
|
|
642
|
+
total_income_usd: Type.Number(),
|
|
643
|
+
profit_loss_usd: Type.Number(),
|
|
644
|
+
transactions: Type.Array(InventoryTransactionSchema)
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
title: 'InventoryItemDetail',
|
|
648
|
+
description: 'Full detail of a single inventory row, including transactions and aggregated totals.'
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
|
|
652
|
+
export type InventoryItemDetail = Static<typeof InventoryItemDetailSchema>;
|
|
653
|
+
|
|
654
|
+
export const InventoryItemsResponseSchema = Type.Array(InventoryItemDetailSchema, {
|
|
655
|
+
title: 'InventoryItemsResponse',
|
|
656
|
+
description: 'Full-detail inventory items for a specific cardid.'
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
export type InventoryItemsResponse = Static<typeof InventoryItemsResponseSchema>;
|
|
660
|
+
|
|
661
|
+
export const InventoryItemsQuerySchema = Type.Object({
|
|
662
|
+
cardid: Type.String({ minLength: 1, description: 'Card ID to fetch inventory items for' })
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
export type InventoryItemsQuery = Static<typeof InventoryItemsQuerySchema>;
|
|
666
|
+
|
|
667
|
+
export const InventoryItemParamSchema = Type.Object({
|
|
668
|
+
uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row' })
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
export type InventoryItemParam = Static<typeof InventoryItemParamSchema>;
|
|
672
|
+
|
|
673
|
+
export const InventoryPatchTransactionSchema = Type.Object(
|
|
674
|
+
{
|
|
675
|
+
tx_uuid: Type.Optional(Type.String({ format: 'uuid', description: 'Present for updates, omitted for new transactions' })),
|
|
676
|
+
transaction_type: Type.Number(),
|
|
677
|
+
transaction_date: Type.String({ description: 'ISO date (YYYY-MM-DD)' }),
|
|
678
|
+
amount: Type.Number(),
|
|
679
|
+
currency: Type.Optional(Type.String({ minLength: 3, maxLength: 3, default: 'USD' })),
|
|
680
|
+
description: Type.Optional(Type.String()),
|
|
681
|
+
source_platform: Type.Optional(Type.String())
|
|
682
|
+
},
|
|
683
|
+
{ title: 'InventoryPatchTransaction' }
|
|
684
|
+
);
|
|
685
|
+
|
|
686
|
+
export type InventoryPatchTransaction = Static<typeof InventoryPatchTransactionSchema>;
|
|
687
|
+
|
|
688
|
+
export const InventoryPatchParamSchema = Type.Object({
|
|
689
|
+
uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row to update' })
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
export type InventoryPatchParam = Static<typeof InventoryPatchParamSchema>;
|
|
693
|
+
|
|
694
|
+
export const InventoryPatchRequestSchema = Type.Object(
|
|
695
|
+
{
|
|
696
|
+
grade: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
697
|
+
status: Type.Optional(Type.Union([Type.Number(), Type.Null()])),
|
|
698
|
+
notes: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
699
|
+
acquired: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
700
|
+
sold_date: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
701
|
+
transactions: Type.Optional(Type.Array(InventoryPatchTransactionSchema, {
|
|
702
|
+
description: 'Authoritative — any existing transaction not in this list is deleted.'
|
|
703
|
+
}))
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
title: 'InventoryPatchRequest',
|
|
707
|
+
description: 'Fields omitted from the body are left unchanged. Fields set to null are cleared.'
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
export type InventoryPatchRequest = Static<typeof InventoryPatchRequestSchema>;
|
|
712
|
+
|
|
562
713
|
// ============= VISION =============
|
|
563
714
|
|
|
564
715
|
|
|
@@ -590,7 +741,8 @@ const DetectedCardSchema = Type.Object(
|
|
|
590
741
|
|
|
591
742
|
const MatchedCardSchema = Type.Intersect(
|
|
592
743
|
[
|
|
593
|
-
CardSchema
|
|
744
|
+
// Vision returns variant_prices as an array, not CardSchema's map
|
|
745
|
+
Type.Omit(CardSchema, ['variant_prices']),
|
|
594
746
|
Type.Object({
|
|
595
747
|
score: Type.Number({ description: 'Fuzzy match score — higher is a better match' }),
|
|
596
748
|
variant_prices: Type.Array(VariantPriceSchema, { description: 'Per-variant prices with extended period changes' })
|