@pfdev/api-types 3.0.22 → 3.0.24
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 +22 -9
package/package.json
CHANGED
package/v3.ts
CHANGED
|
@@ -89,13 +89,15 @@ export const CardSchema = Type.Object(
|
|
|
89
89
|
cardid: Type.String({ description: 'Unique card identifier' }),
|
|
90
90
|
name: Type.String({ description: 'Card name' }),
|
|
91
91
|
number: Type.String({ description: 'Card number within set' }),
|
|
92
|
-
rarity: Type.Optional(Type.String({ description: 'Card rarity' })),
|
|
92
|
+
rarity: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Card rarity, the same for every language (no _JP suffix). None when the card has no rarity; null when not set.' })),
|
|
93
|
+
language: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Card language code (EN, JP)' })),
|
|
93
94
|
artist: Type.Optional(Type.String({ description: 'Card artist' })),
|
|
94
95
|
images: CardImagesSchema,
|
|
95
96
|
setid: Type.String({ description: 'Set this card belongs to' }),
|
|
96
97
|
setname: Type.String({ description: 'Name of the set' }),
|
|
97
98
|
...CardFilterFields,
|
|
98
99
|
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
100
|
+
max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
|
|
99
101
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
100
102
|
change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
|
|
101
103
|
price_variant_id: PriceVariantIdSchema,
|
|
@@ -132,8 +134,14 @@ export const CardListSortSchema = Type.Union([
|
|
|
132
134
|
Type.Literal('price_asc'),
|
|
133
135
|
Type.Literal('price_desc'),
|
|
134
136
|
Type.Literal('change_asc'),
|
|
135
|
-
Type.Literal('change_desc')
|
|
136
|
-
|
|
137
|
+
Type.Literal('change_desc'),
|
|
138
|
+
Type.Literal('release_desc'),
|
|
139
|
+
Type.Literal('release_asc'),
|
|
140
|
+
Type.Literal('release_desc_price_desc')
|
|
141
|
+
], {
|
|
142
|
+
default: 'number_asc',
|
|
143
|
+
description: 'Sort order. change_* sorts by 1-day percentage price change. release_asc/desc sort by set release date, then card number. release_desc_price_desc sorts by newest set, then max_price descending. Cards from sets with no release date come last in every release sort. Defaults to number_asc.'
|
|
144
|
+
});
|
|
137
145
|
|
|
138
146
|
export type CardListSort = Static<typeof CardListSortSchema>;
|
|
139
147
|
|
|
@@ -141,7 +149,8 @@ export type CardListSort = Static<typeof CardListSortSchema>;
|
|
|
141
149
|
// values within one param match with OR, different params combine with AND.
|
|
142
150
|
const CardListFilterFields = {
|
|
143
151
|
setid: Type.Optional(Type.String({ description: 'Comma-separated set IDs (max 500). A single ID behaves as before.' })),
|
|
144
|
-
rarity: Type.Optional(Type.String({ description: 'Comma-separated rarities (max 50), matched exactly' })),
|
|
152
|
+
rarity: Type.Optional(Type.String({ description: 'Comma-separated rarities (max 50), matched exactly. A rarity matches cards in every language.' })),
|
|
153
|
+
language: Type.Optional(Type.String({ description: 'Comma-separated language codes (EN, JP; max 50)' })),
|
|
145
154
|
variant_id: Type.Optional(Type.String({ description: 'Comma-separated variant ids (variants[].id, max 50). Matches non-hidden variants only.' }))
|
|
146
155
|
};
|
|
147
156
|
|
|
@@ -156,7 +165,7 @@ export const CardListQuerySchema = Type.Object(
|
|
|
156
165
|
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 250, default: 50, description: 'Max results to return' })),
|
|
157
166
|
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Pagination offset' }))
|
|
158
167
|
},
|
|
159
|
-
{ description: '
|
|
168
|
+
{ description: 'With no search or filters, lists every card' }
|
|
160
169
|
);
|
|
161
170
|
|
|
162
171
|
export type CardListQuery = Static<typeof CardListQuerySchema>;
|
|
@@ -166,7 +175,7 @@ export const CardFacetsQuerySchema = Type.Object(
|
|
|
166
175
|
...CardListFilterFields,
|
|
167
176
|
search: CardSearchField
|
|
168
177
|
},
|
|
169
|
-
{ description: 'Same search and filters as /cards
|
|
178
|
+
{ description: 'Same search and filters as /cards. With none, returns the facets for every card' }
|
|
170
179
|
);
|
|
171
180
|
|
|
172
181
|
export type CardFacetsQuery = Static<typeof CardFacetsQuerySchema>;
|
|
@@ -185,7 +194,7 @@ export const CardFacetOptionSchema = Type.Object(
|
|
|
185
194
|
label: Type.String({ description: 'Label to show users' }),
|
|
186
195
|
count: Type.Integer({ description: 'Cards this option matches, ignoring this facet\'s own selection' }),
|
|
187
196
|
variant_count: Type.Integer({ description: 'Non-hidden variants on those cards, same counting rule. With variant_id, only the selected variants count.' }),
|
|
188
|
-
order: Type.Optional(Type.Integer({ description: 'Display order, ascending: variant sort_order; sets by release date, newest first (0 = newest). Omitted for rarity.' })),
|
|
197
|
+
order: Type.Optional(Type.Integer({ description: 'Display order, ascending: variant sort_order; sets by release date, newest first (0 = newest); languages English first. Omitted for rarity.' })),
|
|
189
198
|
group: Type.Optional(CardFacetGroupSchema)
|
|
190
199
|
},
|
|
191
200
|
{ title: 'CardFacetOption' }
|
|
@@ -196,8 +205,10 @@ export type CardFacetOption = Static<typeof CardFacetOptionSchema>;
|
|
|
196
205
|
export const CardFacetsResponseSchema = Type.Object(
|
|
197
206
|
{
|
|
198
207
|
total: Type.Integer({ description: 'Cards matching search and all filters' }),
|
|
208
|
+
variant_total: Type.Integer({ description: 'Non-hidden variants on those cards, counted like variant_count. With variant_id, only the selected variants count.' }),
|
|
199
209
|
facets: Type.Object({
|
|
200
|
-
rarity: Type.Array(CardFacetOptionSchema),
|
|
210
|
+
rarity: Type.Array(CardFacetOptionSchema, { description: 'Cards with no rarity have the value None, labelled "No rarity". Cards with rarity unset are counted in total but have no option.' }),
|
|
211
|
+
language: Type.Array(CardFacetOptionSchema, { description: 'Value is the language code, label its name (e.g. JP, Japanese)' }),
|
|
201
212
|
variant: Type.Array(CardFacetOptionSchema),
|
|
202
213
|
set: Type.Array(CardFacetOptionSchema, { description: 'Each option carries its series in group, omitted when the set has no series' })
|
|
203
214
|
})
|
|
@@ -225,7 +236,8 @@ export const CardDetailSchema = Type.Object(
|
|
|
225
236
|
cardid: Type.String({ description: 'Unique card identifier' }),
|
|
226
237
|
name: Type.String({ description: 'Card name' }),
|
|
227
238
|
number: Type.String({ description: 'Card number within set' }),
|
|
228
|
-
rarity: Type.Optional(Type.String({ description: 'Card rarity' })),
|
|
239
|
+
rarity: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Card rarity, the same for every language (no _JP suffix). None when the card has no rarity; null when not set.' })),
|
|
240
|
+
language: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Card language code (EN, JP)' })),
|
|
229
241
|
images: CardImagesSchema,
|
|
230
242
|
setid: Type.String({ description: 'Set this card belongs to' }),
|
|
231
243
|
setname: Type.String({ description: 'Name of the set' }),
|
|
@@ -255,6 +267,7 @@ export const CardDetailSchema = Type.Object(
|
|
|
255
267
|
price_variant_id: PriceVariantIdSchema,
|
|
256
268
|
price_date: PriceDateSchema,
|
|
257
269
|
price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
|
|
270
|
+
max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
|
|
258
271
|
change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
|
|
259
272
|
change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
|
|
260
273
|
variants: {
|