@pfdev/api-types 3.0.12 → 3.0.13

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 +70 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.12",
3
+ "version": "3.0.13",
4
4
  "description": "TypeScript types for PF API V3",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
package/v3.ts CHANGED
@@ -7,7 +7,7 @@ import { Static, Type } from '@sinclair/typebox';
7
7
  // ============= CARDS =============
8
8
 
9
9
 
10
- const PriceStatsSchema = Type.Object(
10
+ export const PriceStatsSchema = Type.Object(
11
11
  {
12
12
  current_price: Type.Optional(Type.Number({ description: 'Current price' })),
13
13
  change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
@@ -252,6 +252,62 @@ export const CurrencyResponseSchema = Type.Object({
252
252
 
253
253
  export type CurrencyResponse = Static<typeof CurrencyResponseSchema>;
254
254
 
255
+ // ============= DEX =============
256
+
257
+
258
+ export const DexPokemonParamSchema = Type.Object({
259
+ name: Type.String({ description: 'Pokémon name (exact match)' })
260
+ });
261
+ export type DexPokemonParam = Static<typeof DexPokemonParamSchema>;
262
+
263
+ export const DexCardSchema = Type.Intersect(
264
+ [
265
+ CardSchema,
266
+ Type.Object({
267
+ variant_prices: Type.Record(Type.String(), PriceStatsSchema, {
268
+ description: 'Per-variant prices and period changes keyed by variant name'
269
+ })
270
+ })
271
+ ],
272
+ {
273
+ title: 'DexCard',
274
+ description: 'A card in a Pokémon dex view, with full per-variant price breakdown'
275
+ }
276
+ );
277
+ export type DexCard = Static<typeof DexCardSchema>;
278
+
279
+ export const DexPokemonResponseSchema = Type.Object(
280
+ {
281
+ number: Type.Integer({ description: 'National Pokédex number' }),
282
+ name: Type.String({ description: 'Pokémon name' }),
283
+ sprite: Type.String({ description: 'Sprite GIF URL for this Pokémon' }),
284
+ cards: Type.Array(DexCardSchema)
285
+ },
286
+ { title: 'DexPokemon' }
287
+ );
288
+
289
+ export const DexEntrySchema = Type.Object(
290
+ {
291
+ id: Type.Integer({ description: 'Internal Pokémon id (ordering key)' }),
292
+ name: Type.String({ description: 'Pokémon name' }),
293
+ number: Type.Integer({ description: 'National Pokédex number' }),
294
+ sprite: Type.String({ description: 'Sprite GIF URL for this Pokémon' }),
295
+ card_count: Type.Integer({ description: 'Distinct cards tied to this Pokémon' }),
296
+ master_count: Type.Integer({ description: 'Count of priced variant rows across those cards' }),
297
+ cost: Type.Union([Type.Number(), Type.Null()], {
298
+ description: 'Sum of the cheapest priced variant per card. Null if no card has any priced variant.'
299
+ }),
300
+ master_cost: Type.Union([Type.Number(), Type.Null()], {
301
+ description: 'Sum of every priced ungraded variant across all cards. Null if nothing is priced.'
302
+ })
303
+ },
304
+ { title: 'DexEntry' }
305
+ );
306
+
307
+ export type DexEntry = Static<typeof DexEntrySchema>;
308
+
309
+ export const DexListResponseSchema = Type.Array(DexEntrySchema);
310
+
255
311
  // ============= SEALED =============
256
312
 
257
313
 
@@ -490,6 +546,19 @@ export const ErrorResponseSchema = Type.Object({
490
546
 
491
547
  export type ErrorResponse = Static<typeof ErrorResponseSchema>;
492
548
 
549
+ export const DexCollectionItemSchema = Type.Object(
550
+ {
551
+ id: Type.Integer({ description: 'Pokémon id (matches /dex/ response.id)' }),
552
+ collected: Type.Integer({ description: 'Distinct cardids the user owns for this Pokémon' }),
553
+ master_collected: Type.Integer({ description: 'Distinct (cardid, variant) pairs the user owns for this Pokémon' })
554
+ },
555
+ { title: 'DexCollectionItem' }
556
+ );
557
+
558
+ export type DexCollectionItem = Static<typeof DexCollectionItemSchema>;
559
+
560
+ export const DexCollectionResponseSchema = Type.Array(DexCollectionItemSchema);
561
+
493
562
  // ============= VISION =============
494
563
 
495
564