@pfdev/api-types 3.0.16 → 3.0.18

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 +2 -2
  2. package/v3.ts +108 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.16",
3
+ "version": "3.0.18",
4
4
  "description": "TypeScript types for PF API V3",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -9,7 +9,7 @@
9
9
  "v3.ts"
10
10
  ],
11
11
  "scripts": {
12
- "watch": "chokidar '../pfapi-fs/src/routes/v3/*/schemas.ts' -c 'npm run generate'",
12
+ "watch": "chokidar '../pfapi-fs/src/routes/v3/**/schemas.ts' -c 'npm run generate'",
13
13
  "verify": "tsc --noEmit v3.ts",
14
14
  "generate": "bash generate-types.sh",
15
15
  "preversion": "npm run generate && git add v3.ts",
package/v3.ts CHANGED
@@ -76,8 +76,10 @@ export const CardListSortSchema = Type.Union([
76
76
  Type.Literal('name_asc'),
77
77
  Type.Literal('name_desc'),
78
78
  Type.Literal('price_asc'),
79
- Type.Literal('price_desc')
80
- ], { default: 'number_asc', description: 'Sort order. Defaults to number_asc.' });
79
+ Type.Literal('price_desc'),
80
+ Type.Literal('change_asc'),
81
+ Type.Literal('change_desc')
82
+ ], { default: 'number_asc', description: 'Sort order. change_* sorts by 1-day percentage price change. Defaults to number_asc.' });
81
83
 
82
84
  export type CardListSort = Static<typeof CardListSortSchema>;
83
85
 
@@ -99,7 +101,8 @@ export const CardBatchQuerySchema = Type.Object({
99
101
  ids: Type.String({
100
102
  minLength: 1,
101
103
  description: 'Comma-separated list of card IDs (e.g. "xy1-2,base1-4"). Duplicates are deduped. Max 200 IDs per request.'
102
- })
104
+ }),
105
+ include: Type.Optional(Type.Literal('variant_prices', { description: 'Include per-variant prices and period changes on each card' }))
103
106
  });
104
107
 
105
108
  export type CardBatchQuery = Static<typeof CardBatchQuerySchema>;
@@ -503,6 +506,84 @@ export const SetDetailParamSchema = Type.Object({
503
506
 
504
507
  export type SetDetailParam = Static<typeof SetDetailParamSchema>;
505
508
 
509
+ // ============= LISTS =============
510
+
511
+
512
+ export const ListTypeSchema = Type.Union(
513
+ [Type.Literal('static'), Type.Literal('dynamic'), Type.Literal('binder')],
514
+ { description: 'static = duplicates allowed, dynamic = one entry per card variant, binder = slot-based layout' }
515
+ );
516
+
517
+ export type ListType = Static<typeof ListTypeSchema>;
518
+
519
+ export const ListSchema = Type.Object(
520
+ {
521
+ uuid: Type.String({ format: 'uuid' }),
522
+ name: Type.String(),
523
+ description: Type.Union([Type.String(), Type.Null()]),
524
+ icon: Type.Union([Type.String(), Type.Null()]),
525
+ color: Type.Union([Type.String(), Type.Null()]),
526
+ is_private: Type.Boolean(),
527
+ type: Type.Union([ListTypeSchema, Type.Null()]),
528
+ binder_config: Type.Union([Type.Number(), Type.Null()], {
529
+ description: 'Binder layout preset. Only set for binders.'
530
+ }),
531
+ card_count: Type.Integer({ description: 'Total entries, including duplicates' }),
532
+ unique_count: Type.Integer({ description: 'Distinct cardids' }),
533
+ total_value: Type.Number({ description: 'Sum of current USD prices of every entry' })
534
+ },
535
+ { title: 'List' }
536
+ );
537
+
538
+ export type List = Static<typeof ListSchema>;
539
+
540
+ export const ListsResponseSchema = Type.Array(ListSchema, {
541
+ title: 'ListsResponse',
542
+ description: 'All lists and binders owned by the authenticated user, oldest first.'
543
+ });
544
+
545
+ export const ListParamSchema = Type.Object({
546
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the list' })
547
+ });
548
+
549
+ export type ListParam = Static<typeof ListParamSchema>;
550
+
551
+ const NameSchema = Type.String({ minLength: 1, maxLength: 100 });
552
+ const DescriptionSchema = Type.String({ maxLength: 1000 });
553
+
554
+ export const ListCreateRequestSchema = Type.Object(
555
+ {
556
+ name: NameSchema,
557
+ description: Type.Optional(DescriptionSchema),
558
+ icon: Type.String({ minLength: 1 }),
559
+ color: Type.String({ minLength: 1 }),
560
+ is_private: Type.Optional(Type.Boolean({ default: false })),
561
+ type: Type.Optional(ListTypeSchema),
562
+ binder_config: Type.Optional(Type.Number({ description: 'Required when type is binder; rejected otherwise' }))
563
+ },
564
+ { title: 'ListCreateRequest', additionalProperties: false }
565
+ );
566
+
567
+ export type ListCreateRequest = Static<typeof ListCreateRequestSchema>;
568
+
569
+ export const ListPatchRequestSchema = Type.Object(
570
+ {
571
+ name: Type.Optional(NameSchema),
572
+ description: Type.Optional(DescriptionSchema),
573
+ icon: Type.Optional(Type.String({ minLength: 1 })),
574
+ color: Type.Optional(Type.String({ minLength: 1 })),
575
+ is_private: Type.Optional(Type.Boolean())
576
+ },
577
+ {
578
+ title: 'ListPatchRequest',
579
+ description: 'Fields omitted from the body are left unchanged. type and binder_config cannot be changed.',
580
+ additionalProperties: false,
581
+ minProperties: 1
582
+ }
583
+ );
584
+
585
+ export type ListPatchRequest = Static<typeof ListPatchRequestSchema>;
586
+
506
587
  // ============= USERS =============
507
588
 
508
589
 
@@ -567,7 +648,11 @@ export const InventorySummaryItemSchema = Type.Object(
567
648
  variant: Type.String({ description: 'Card variant (e.g. Normal, Holofoil, Reverse Holofoil)' }),
568
649
  status: Type.Union([Type.Number(), Type.Null()], {
569
650
  description: 'Numeric status code. <100 = active, >=100 = sold/past. Null when no details row exists yet.'
570
- })
651
+ }),
652
+ acquired: Type.Union([Type.String(), Type.Null()], {
653
+ description: 'User-entered acquired date. Null when not set or no details row exists yet.'
654
+ }),
655
+ created_at: Type.String({ description: 'When this inventory row was created' })
571
656
  },
572
657
  { title: 'InventorySummaryItem' }
573
658
  );
@@ -758,3 +843,22 @@ export const VisionResponseSchema = Type.Object(
758
843
  );
759
844
 
760
845
  export type VisionResponse = Static<typeof VisionResponseSchema>;
846
+
847
+ // ============= CLERK =============
848
+
849
+
850
+ export const WebhookAckSchema = Type.Object(
851
+ {
852
+ received: Type.Boolean()
853
+ },
854
+ { title: 'WebhookAck' }
855
+ );
856
+
857
+ export type WebhookAck = Static<typeof WebhookAckSchema>;
858
+
859
+ export const WebhookErrorSchema = Type.Object({
860
+ error: Type.String(),
861
+ message: Type.String()
862
+ });
863
+
864
+ export type WebhookError = Static<typeof WebhookErrorSchema>;