@pfdev/api-types 3.0.14 → 3.0.16
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 +26 -33
package/package.json
CHANGED
package/v3.ts
CHANGED
|
@@ -34,13 +34,19 @@ export const CardSchema = Type.Object(
|
|
|
34
34
|
name: Type.String({ description: 'Card name' }),
|
|
35
35
|
number: Type.String({ description: 'Card number within set' }),
|
|
36
36
|
rarity: Type.Optional(Type.String({ description: 'Card rarity' })),
|
|
37
|
+
artist: Type.Optional(Type.String({ description: 'Card artist' })),
|
|
37
38
|
images: CardImagesSchema,
|
|
38
39
|
setid: Type.String({ description: 'Set this card belongs to' }),
|
|
39
40
|
setname: Type.String({ description: 'Name of the set' }),
|
|
40
|
-
price: Type.Optional(Type.Number({ description: '
|
|
41
|
+
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
41
42
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
42
43
|
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' }))
|
|
44
|
+
variants: Type.Optional(Type.Array(Type.String(), { description: 'Available variants for this card' })),
|
|
45
|
+
variant_prices: Type.Optional(
|
|
46
|
+
Type.Record(Type.String(), PriceStatsSchema, {
|
|
47
|
+
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.'
|
|
48
|
+
})
|
|
49
|
+
)
|
|
44
50
|
},
|
|
45
51
|
{
|
|
46
52
|
title: 'Card',
|
|
@@ -64,45 +70,31 @@ export const CardListResponseSchema = Type.Object(
|
|
|
64
70
|
|
|
65
71
|
export type CardListResponse = Static<typeof CardListResponseSchema>;
|
|
66
72
|
|
|
73
|
+
export const CardListSortSchema = Type.Union([
|
|
74
|
+
Type.Literal('number_asc'),
|
|
75
|
+
Type.Literal('number_desc'),
|
|
76
|
+
Type.Literal('name_asc'),
|
|
77
|
+
Type.Literal('name_desc'),
|
|
78
|
+
Type.Literal('price_asc'),
|
|
79
|
+
Type.Literal('price_desc')
|
|
80
|
+
], { default: 'number_asc', description: 'Sort order. Defaults to number_asc.' });
|
|
81
|
+
|
|
82
|
+
export type CardListSort = Static<typeof CardListSortSchema>;
|
|
83
|
+
|
|
67
84
|
export const CardListQuerySchema = Type.Object(
|
|
68
85
|
{
|
|
69
86
|
setid: Type.Optional(Type.String({ description: 'Filter by set ID' })),
|
|
70
|
-
|
|
87
|
+
search: Type.Optional(Type.String({ minLength: 1, description: 'Search by card name and/or number. Tokens with digits match card number; other tokens match card name.' })),
|
|
88
|
+
sort: Type.Optional(CardListSortSchema),
|
|
89
|
+
include: Type.Optional(Type.Literal('variant_prices', { description: 'Include per-variant prices and period changes on each card' })),
|
|
71
90
|
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 250, default: 50, description: 'Max results to return' })),
|
|
72
91
|
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Pagination offset' }))
|
|
73
92
|
},
|
|
74
|
-
{ description: 'At least one of setid or
|
|
93
|
+
{ description: 'At least one of setid or search must be provided' }
|
|
75
94
|
);
|
|
76
95
|
|
|
77
96
|
export type CardListQuery = Static<typeof CardListQuerySchema>;
|
|
78
97
|
|
|
79
|
-
export const CardSearchSortSchema = Type.Union([
|
|
80
|
-
Type.Literal('number_asc'),
|
|
81
|
-
Type.Literal('number_desc'),
|
|
82
|
-
Type.Literal('name_asc'),
|
|
83
|
-
Type.Literal('name_desc'),
|
|
84
|
-
Type.Literal('price_asc'),
|
|
85
|
-
Type.Literal('price_desc')
|
|
86
|
-
]);
|
|
87
|
-
|
|
88
|
-
export type CardSearchSort = Static<typeof CardSearchSortSchema>;
|
|
89
|
-
|
|
90
|
-
export const CardSearchQuerySchema = Type.Object({
|
|
91
|
-
q: Type.String({ minLength: 1, description: 'Search query. Tokens with digits match card number; other tokens match card name.' }),
|
|
92
|
-
sort: Type.Optional(Type.Union([
|
|
93
|
-
Type.Literal('number_asc'),
|
|
94
|
-
Type.Literal('number_desc'),
|
|
95
|
-
Type.Literal('name_asc'),
|
|
96
|
-
Type.Literal('name_desc'),
|
|
97
|
-
Type.Literal('price_asc'),
|
|
98
|
-
Type.Literal('price_desc')
|
|
99
|
-
], { default: 'number_asc', description: 'Sort order. Defaults to number_asc.' })),
|
|
100
|
-
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 100, default: 25, description: 'Max results to return' })),
|
|
101
|
-
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Pagination offset' }))
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export type CardSearchQuery = Static<typeof CardSearchQuerySchema>;
|
|
105
|
-
|
|
106
98
|
export const CardBatchQuerySchema = Type.Object({
|
|
107
99
|
ids: Type.String({
|
|
108
100
|
minLength: 1,
|
|
@@ -140,7 +132,7 @@ export const CardDetailSchema = Type.Object(
|
|
|
140
132
|
nationalPokedexNumbers: Type.Optional(Type.Array(Type.Number(), { description: 'National Pokédex numbers' })),
|
|
141
133
|
legalities: Type.Optional(Type.Any({ description: 'Format legalities' })),
|
|
142
134
|
regulationMark: Type.Optional(Type.String({ description: 'Regulation mark' })),
|
|
143
|
-
price: Type.Optional(Type.Number({ description: '
|
|
135
|
+
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
144
136
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
145
137
|
change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
|
|
146
138
|
variants: Type.Optional(Type.Array(Type.String(), { description: 'Available variants for this card' })),
|
|
@@ -735,7 +727,8 @@ const DetectedCardSchema = Type.Object(
|
|
|
735
727
|
|
|
736
728
|
const MatchedCardSchema = Type.Intersect(
|
|
737
729
|
[
|
|
738
|
-
CardSchema
|
|
730
|
+
// Vision returns variant_prices as an array, not CardSchema's map
|
|
731
|
+
Type.Omit(CardSchema, ['variant_prices']),
|
|
739
732
|
Type.Object({
|
|
740
733
|
score: Type.Number({ description: 'Fuzzy match score — higher is a better match' }),
|
|
741
734
|
variant_prices: Type.Array(VariantPriceSchema, { description: 'Per-variant prices with extended period changes' })
|