@pfdev/api-types 3.0.23 → 3.0.25

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/v3.ts +22 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.23",
3
+ "version": "3.0.25",
4
4
  "description": "TypeScript types for PF API V3",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
package/v3.ts CHANGED
@@ -75,6 +75,10 @@ const PriceVariantIdSchema = Type.Optional(Type.Union([Type.Integer(), Type.Null
75
75
  description: 'Id of the variant that price, change_1d and change_1d_value come from (the lowest-priced variant that isn\'t hidden)'
76
76
  }));
77
77
 
78
+ const MaxPriceVariantIdSchema = Type.Optional(Type.Union([Type.Integer(), Type.Null()], {
79
+ description: 'Id of the variant max_price comes from (the highest-priced variant that isn\'t hidden)'
80
+ }));
81
+
78
82
  const PriceDateSchema = Type.Optional(Type.Union([Type.String(), Type.Null()], {
79
83
  description: 'Date (YYYY-MM-DD) the price was last updated, for the variant in price_variant_id'
80
84
  }));
@@ -97,6 +101,8 @@ export const CardSchema = Type.Object(
97
101
  setname: Type.String({ description: 'Name of the set' }),
98
102
  ...CardFilterFields,
99
103
  price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
104
+ max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
105
+ max_price_variant_id: MaxPriceVariantIdSchema,
100
106
  change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
101
107
  change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
102
108
  price_variant_id: PriceVariantIdSchema,
@@ -133,8 +139,14 @@ export const CardListSortSchema = Type.Union([
133
139
  Type.Literal('price_asc'),
134
140
  Type.Literal('price_desc'),
135
141
  Type.Literal('change_asc'),
136
- Type.Literal('change_desc')
137
- ], { default: 'number_asc', description: 'Sort order. change_* sorts by 1-day percentage price change. Defaults to number_asc.' });
142
+ Type.Literal('change_desc'),
143
+ Type.Literal('release_desc'),
144
+ Type.Literal('release_asc'),
145
+ Type.Literal('release_desc_price_desc')
146
+ ], {
147
+ default: 'number_asc',
148
+ 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.'
149
+ });
138
150
 
139
151
  export type CardListSort = Static<typeof CardListSortSchema>;
140
152
 
@@ -158,7 +170,7 @@ export const CardListQuerySchema = Type.Object(
158
170
  limit: Type.Optional(Type.Number({ minimum: 1, maximum: 250, default: 50, description: 'Max results to return' })),
159
171
  offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Pagination offset' }))
160
172
  },
161
- { description: 'At least one of search, setid, rarity, language or variant_id must be provided' }
173
+ { description: 'With no search or filters, lists every card' }
162
174
  );
163
175
 
164
176
  export type CardListQuery = Static<typeof CardListQuerySchema>;
@@ -168,7 +180,7 @@ export const CardFacetsQuerySchema = Type.Object(
168
180
  ...CardListFilterFields,
169
181
  search: CardSearchField
170
182
  },
171
- { description: 'Same search and filters as /cards; at least one of them must be provided' }
183
+ { description: 'Same search and filters as /cards. With none, returns the facets for every card' }
172
184
  );
173
185
 
174
186
  export type CardFacetsQuery = Static<typeof CardFacetsQuerySchema>;
@@ -188,7 +200,10 @@ export const CardFacetOptionSchema = Type.Object(
188
200
  count: Type.Integer({ description: 'Cards this option matches, ignoring this facet\'s own selection' }),
189
201
  variant_count: Type.Integer({ description: 'Non-hidden variants on those cards, same counting rule. With variant_id, only the selected variants count.' }),
190
202
  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.' })),
191
- group: Type.Optional(CardFacetGroupSchema)
203
+ group: Type.Optional(CardFacetGroupSchema),
204
+ language: Type.Optional(Type.String({
205
+ description: 'Language code of the set (EN, JP). Set options only.'
206
+ }))
192
207
  },
193
208
  { title: 'CardFacetOption' }
194
209
  );
@@ -260,6 +275,8 @@ export const CardDetailSchema = Type.Object(
260
275
  price_variant_id: PriceVariantIdSchema,
261
276
  price_date: PriceDateSchema,
262
277
  price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
278
+ max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
279
+ max_price_variant_id: MaxPriceVariantIdSchema,
263
280
  change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
264
281
  change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
265
282
  variants: {