@pfdev/api-types 3.0.12 → 3.0.14

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 +215 -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.14",
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' })),
@@ -103,6 +103,15 @@ export const CardSearchQuerySchema = Type.Object({
103
103
 
104
104
  export type CardSearchQuery = Static<typeof CardSearchQuerySchema>;
105
105
 
106
+ export const CardBatchQuerySchema = Type.Object({
107
+ ids: Type.String({
108
+ minLength: 1,
109
+ description: 'Comma-separated list of card IDs (e.g. "xy1-2,base1-4"). Duplicates are deduped. Max 200 IDs per request.'
110
+ })
111
+ });
112
+
113
+ export type CardBatchQuery = Static<typeof CardBatchQuerySchema>;
114
+
106
115
  export const CardDetailSchema = Type.Object(
107
116
  {
108
117
  cardid: Type.String({ description: 'Unique card identifier' }),
@@ -252,6 +261,62 @@ export const CurrencyResponseSchema = Type.Object({
252
261
 
253
262
  export type CurrencyResponse = Static<typeof CurrencyResponseSchema>;
254
263
 
264
+ // ============= DEX =============
265
+
266
+
267
+ export const DexPokemonParamSchema = Type.Object({
268
+ name: Type.String({ description: 'Pokémon name (exact match)' })
269
+ });
270
+ export type DexPokemonParam = Static<typeof DexPokemonParamSchema>;
271
+
272
+ export const DexCardSchema = Type.Intersect(
273
+ [
274
+ CardSchema,
275
+ Type.Object({
276
+ variant_prices: Type.Record(Type.String(), PriceStatsSchema, {
277
+ description: 'Per-variant prices and period changes keyed by variant name'
278
+ })
279
+ })
280
+ ],
281
+ {
282
+ title: 'DexCard',
283
+ description: 'A card in a Pokémon dex view, with full per-variant price breakdown'
284
+ }
285
+ );
286
+ export type DexCard = Static<typeof DexCardSchema>;
287
+
288
+ export const DexPokemonResponseSchema = Type.Object(
289
+ {
290
+ number: Type.Integer({ description: 'National Pokédex number' }),
291
+ name: Type.String({ description: 'Pokémon name' }),
292
+ sprite: Type.String({ description: 'Sprite GIF URL for this Pokémon' }),
293
+ cards: Type.Array(DexCardSchema)
294
+ },
295
+ { title: 'DexPokemon' }
296
+ );
297
+
298
+ export const DexEntrySchema = Type.Object(
299
+ {
300
+ id: Type.Integer({ description: 'Internal Pokémon id (ordering key)' }),
301
+ name: Type.String({ description: 'Pokémon name' }),
302
+ number: Type.Integer({ description: 'National Pokédex number' }),
303
+ sprite: Type.String({ description: 'Sprite GIF URL for this Pokémon' }),
304
+ card_count: Type.Integer({ description: 'Distinct cards tied to this Pokémon' }),
305
+ master_count: Type.Integer({ description: 'Count of priced variant rows across those cards' }),
306
+ cost: Type.Union([Type.Number(), Type.Null()], {
307
+ description: 'Sum of the cheapest priced variant per card. Null if no card has any priced variant.'
308
+ }),
309
+ master_cost: Type.Union([Type.Number(), Type.Null()], {
310
+ description: 'Sum of every priced ungraded variant across all cards. Null if nothing is priced.'
311
+ })
312
+ },
313
+ { title: 'DexEntry' }
314
+ );
315
+
316
+ export type DexEntry = Static<typeof DexEntrySchema>;
317
+
318
+ export const DexListResponseSchema = Type.Array(DexEntrySchema);
319
+
255
320
  // ============= SEALED =============
256
321
 
257
322
 
@@ -490,6 +555,155 @@ export const ErrorResponseSchema = Type.Object({
490
555
 
491
556
  export type ErrorResponse = Static<typeof ErrorResponseSchema>;
492
557
 
558
+ export const DexCollectionItemSchema = Type.Object(
559
+ {
560
+ id: Type.Integer({ description: 'Pokémon id (matches /dex/ response.id)' }),
561
+ collected: Type.Integer({ description: 'Distinct cardids the user owns for this Pokémon' }),
562
+ master_collected: Type.Integer({ description: 'Distinct (cardid, variant) pairs the user owns for this Pokémon' })
563
+ },
564
+ { title: 'DexCollectionItem' }
565
+ );
566
+
567
+ export type DexCollectionItem = Static<typeof DexCollectionItemSchema>;
568
+
569
+ export const DexCollectionResponseSchema = Type.Array(DexCollectionItemSchema);
570
+
571
+ export const InventorySummaryItemSchema = Type.Object(
572
+ {
573
+ uuid: Type.String({ description: 'Unique ID of this inventory row' }),
574
+ cardid: Type.String({ description: 'Card ID this inventory row belongs to' }),
575
+ variant: Type.String({ description: 'Card variant (e.g. Normal, Holofoil, Reverse Holofoil)' }),
576
+ status: Type.Union([Type.Number(), Type.Null()], {
577
+ description: 'Numeric status code. <100 = active, >=100 = sold/past. Null when no details row exists yet.'
578
+ })
579
+ },
580
+ { title: 'InventorySummaryItem' }
581
+ );
582
+
583
+ export type InventorySummaryItem = Static<typeof InventorySummaryItemSchema>;
584
+
585
+ export const InventorySummaryResponseSchema = Type.Array(InventorySummaryItemSchema, {
586
+ title: 'InventorySummaryResponse',
587
+ description: 'Lightweight ownership rows for the authenticated user. One entry per physical card owned. Suitable for a global client store.'
588
+ });
589
+
590
+ export type InventorySummaryResponse = Static<typeof InventorySummaryResponseSchema>;
591
+
592
+ export const InventoryAddRequestSchema = Type.Object(
593
+ {
594
+ cardid: Type.String({ minLength: 1, description: 'Card ID to add to inventory' }),
595
+ variant: Type.String({ minLength: 1, description: 'Card variant (e.g. Normal, Holofoil, Reverse Holofoil)' })
596
+ },
597
+ { title: 'InventoryAddRequest' }
598
+ );
599
+
600
+ export type InventoryAddRequest = Static<typeof InventoryAddRequestSchema>;
601
+
602
+ export const InventoryDeleteParamSchema = Type.Object({
603
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row to delete' })
604
+ });
605
+
606
+ export type InventoryDeleteParam = Static<typeof InventoryDeleteParamSchema>;
607
+
608
+ export const InventoryTransactionSchema = Type.Object(
609
+ {
610
+ tx_uuid: Type.String({ format: 'uuid' }),
611
+ transaction_type: Type.Number({ description: '100-199 = cost, 200-299 = income' }),
612
+ transaction_date: Type.String({ description: 'ISO date string' }),
613
+ amount: Type.Number(),
614
+ currency: Type.String(),
615
+ amount_usd: Type.Union([Type.Number(), Type.Null()]),
616
+ rate: Type.Union([Type.Number(), Type.Null()]),
617
+ description: Type.Union([Type.String(), Type.Null()]),
618
+ source_platform: Type.Union([Type.String(), Type.Null()])
619
+ },
620
+ { title: 'InventoryTransaction' }
621
+ );
622
+
623
+ export type InventoryTransaction = Static<typeof InventoryTransactionSchema>;
624
+
625
+ export const InventoryItemDetailSchema = Type.Object(
626
+ {
627
+ uuid: Type.String({ format: 'uuid' }),
628
+ cardid: Type.String(),
629
+ variant: Type.String(),
630
+ status: Type.Union([Type.Number(), Type.Null()]),
631
+ grade: Type.Union([Type.String(), Type.Null()]),
632
+ acquired: Type.Union([Type.String(), Type.Null()]),
633
+ sold_date: Type.Union([Type.String(), Type.Null()]),
634
+ notes: Type.Union([Type.String(), Type.Null()]),
635
+ total_cost_usd: Type.Number(),
636
+ total_income_usd: Type.Number(),
637
+ profit_loss_usd: Type.Number(),
638
+ transactions: Type.Array(InventoryTransactionSchema)
639
+ },
640
+ {
641
+ title: 'InventoryItemDetail',
642
+ description: 'Full detail of a single inventory row, including transactions and aggregated totals.'
643
+ }
644
+ );
645
+
646
+ export type InventoryItemDetail = Static<typeof InventoryItemDetailSchema>;
647
+
648
+ export const InventoryItemsResponseSchema = Type.Array(InventoryItemDetailSchema, {
649
+ title: 'InventoryItemsResponse',
650
+ description: 'Full-detail inventory items for a specific cardid.'
651
+ });
652
+
653
+ export type InventoryItemsResponse = Static<typeof InventoryItemsResponseSchema>;
654
+
655
+ export const InventoryItemsQuerySchema = Type.Object({
656
+ cardid: Type.String({ minLength: 1, description: 'Card ID to fetch inventory items for' })
657
+ });
658
+
659
+ export type InventoryItemsQuery = Static<typeof InventoryItemsQuerySchema>;
660
+
661
+ export const InventoryItemParamSchema = Type.Object({
662
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row' })
663
+ });
664
+
665
+ export type InventoryItemParam = Static<typeof InventoryItemParamSchema>;
666
+
667
+ export const InventoryPatchTransactionSchema = Type.Object(
668
+ {
669
+ tx_uuid: Type.Optional(Type.String({ format: 'uuid', description: 'Present for updates, omitted for new transactions' })),
670
+ transaction_type: Type.Number(),
671
+ transaction_date: Type.String({ description: 'ISO date (YYYY-MM-DD)' }),
672
+ amount: Type.Number(),
673
+ currency: Type.Optional(Type.String({ minLength: 3, maxLength: 3, default: 'USD' })),
674
+ description: Type.Optional(Type.String()),
675
+ source_platform: Type.Optional(Type.String())
676
+ },
677
+ { title: 'InventoryPatchTransaction' }
678
+ );
679
+
680
+ export type InventoryPatchTransaction = Static<typeof InventoryPatchTransactionSchema>;
681
+
682
+ export const InventoryPatchParamSchema = Type.Object({
683
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the inventory row to update' })
684
+ });
685
+
686
+ export type InventoryPatchParam = Static<typeof InventoryPatchParamSchema>;
687
+
688
+ export const InventoryPatchRequestSchema = Type.Object(
689
+ {
690
+ grade: Type.Optional(Type.Union([Type.String(), Type.Null()])),
691
+ status: Type.Optional(Type.Union([Type.Number(), Type.Null()])),
692
+ notes: Type.Optional(Type.Union([Type.String(), Type.Null()])),
693
+ acquired: Type.Optional(Type.Union([Type.String(), Type.Null()])),
694
+ sold_date: Type.Optional(Type.Union([Type.String(), Type.Null()])),
695
+ transactions: Type.Optional(Type.Array(InventoryPatchTransactionSchema, {
696
+ description: 'Authoritative — any existing transaction not in this list is deleted.'
697
+ }))
698
+ },
699
+ {
700
+ title: 'InventoryPatchRequest',
701
+ description: 'Fields omitted from the body are left unchanged. Fields set to null are cleared.'
702
+ }
703
+ );
704
+
705
+ export type InventoryPatchRequest = Static<typeof InventoryPatchRequestSchema>;
706
+
493
707
  // ============= VISION =============
494
708
 
495
709