@pfdev/api-types 3.0.24 → 3.0.27

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 +95 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.24",
3
+ "version": "3.0.27",
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
  }));
@@ -98,6 +102,7 @@ export const CardSchema = Type.Object(
98
102
  ...CardFilterFields,
99
103
  price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
100
104
  max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
105
+ max_price_variant_id: MaxPriceVariantIdSchema,
101
106
  change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
102
107
  change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
103
108
  price_variant_id: PriceVariantIdSchema,
@@ -195,7 +200,10 @@ export const CardFacetOptionSchema = Type.Object(
195
200
  count: Type.Integer({ description: 'Cards this option matches, ignoring this facet\'s own selection' }),
196
201
  variant_count: Type.Integer({ description: 'Non-hidden variants on those cards, same counting rule. With variant_id, only the selected variants count.' }),
197
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.' })),
198
- 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
+ }))
199
207
  },
200
208
  { title: 'CardFacetOption' }
201
209
  );
@@ -268,6 +276,7 @@ export const CardDetailSchema = Type.Object(
268
276
  price_date: PriceDateSchema,
269
277
  price: Type.Optional(Type.Number({ description: 'Price of the lowest-priced variant' })),
270
278
  max_price: Type.Optional(Type.Number({ description: 'Price of the highest-priced non-hidden variant' })),
279
+ max_price_variant_id: MaxPriceVariantIdSchema,
271
280
  change_1d: Type.Optional(Type.Number({ description: '1-day price change as a percentage' })),
272
281
  change_1d_value: Type.Optional(Type.Number({ description: '1-day price change in dollars' })),
273
282
  variants: {
@@ -660,7 +669,7 @@ export const ListSchema = Type.Object(
660
669
  icon: Type.Union([Type.String(), Type.Null()]),
661
670
  color: Type.Union([Type.String(), Type.Null()]),
662
671
  is_private: Type.Boolean(),
663
- type: Type.Union([ListTypeSchema, Type.Null()]),
672
+ type: ListTypeSchema,
664
673
  binder_config: Type.Union([Type.Number(), Type.Null()], {
665
674
  description: 'Binder layout preset. Only set for binders.'
666
675
  }),
@@ -724,6 +733,90 @@ export const ListPatchRequestSchema = Type.Object(
724
733
 
725
734
  export type ListPatchRequest = Static<typeof ListPatchRequestSchema>;
726
735
 
736
+ export const ListEntrySchema = Type.Object(
737
+ {
738
+ uuid: Type.String({ format: 'uuid', description: 'Unique ID of this entry' }),
739
+ list_uuid: Type.String({ format: 'uuid' }),
740
+ cardid: Type.String(),
741
+ variant_id: Type.Union([Type.Integer(), Type.Null()], { description: 'Variant id (pfdata_variant_definitions.id); matches variants[].id on cards. Null when the variant has no definition.' }),
742
+ added_at: Type.String({ description: 'When this entry was added' }),
743
+ slot: Type.Union([Type.Integer(), Type.Null()], { description: 'Binder slot. Null for lists.' }),
744
+ inventory_uuid: Type.Union([Type.String({ format: 'uuid' }), Type.Null()], { description: 'Inventory copy linked to this binder slot. Null for lists and unlinked slots.' })
745
+ },
746
+ { title: 'ListEntry' }
747
+ );
748
+
749
+ export type ListEntry = Static<typeof ListEntrySchema>;
750
+
751
+ export const ListEntriesResponseSchema = Type.Array(ListEntrySchema, {
752
+ title: 'ListEntriesResponse',
753
+ description: 'Entries in the order they were added.'
754
+ });
755
+
756
+ const MAX_BATCH = 500;
757
+
758
+ export const ListEntriesAddRequestSchema = Type.Object(
759
+ {
760
+ cards: Type.Array(
761
+ Type.Object({
762
+ cardid: Type.String({ minLength: 1 }),
763
+ variant_id: Type.Integer({ minimum: 1, description: 'Variant id (variants[].id on the card). Must be one of the card\'s variants and not hidden.' })
764
+ }),
765
+ { minItems: 1, maxItems: MAX_BATCH }
766
+ )
767
+ },
768
+ { title: 'ListEntriesAddRequest', additionalProperties: false }
769
+ );
770
+
771
+ export type ListEntriesAddRequest = Static<typeof ListEntriesAddRequestSchema>;
772
+
773
+ export const ListEntryParamSchema = Type.Object({
774
+ uuid: Type.String({ format: 'uuid', description: 'UUID of the list' }),
775
+ entry_uuid: Type.String({ format: 'uuid', description: 'UUID of the entry' })
776
+ });
777
+
778
+ export type ListEntryParam = Static<typeof ListEntryParamSchema>;
779
+
780
+ export const ListEntriesDeleteRequestSchema = Type.Object(
781
+ {
782
+ uuids: Type.Array(Type.String({ format: 'uuid' }), { minItems: 1, maxItems: MAX_BATCH })
783
+ },
784
+ { title: 'ListEntriesDeleteRequest', additionalProperties: false }
785
+ );
786
+
787
+ export type ListEntriesDeleteRequest = Static<typeof ListEntriesDeleteRequestSchema>;
788
+
789
+ export const ListCardLimitErrorSchema = Type.Object(
790
+ {
791
+ error: Type.String(),
792
+ message: Type.String(),
793
+ code: Type.Literal('LIST_CARD_LIMIT'),
794
+ limit: Type.Integer(),
795
+ used: Type.Integer({ description: 'Entries currently in the list' }),
796
+ remaining: Type.Integer({ description: 'Entries that can still be added. 0 when the list is at or over its limit.' })
797
+ },
798
+ { title: 'ListCardLimitError' }
799
+ );
800
+
801
+ export type ListCardLimitError = Static<typeof ListCardLimitErrorSchema>;
802
+
803
+ const UsageCountSchema = Type.Object({
804
+ used: Type.Integer(),
805
+ limit: Type.Integer({ description: '-1 = unlimited' })
806
+ });
807
+
808
+ export const ListUsageResponseSchema = Type.Object(
809
+ {
810
+ lists: UsageCountSchema,
811
+ binders: UsageCountSchema,
812
+ cards_per_list: Type.Integer({ description: '-1 = unlimited' }),
813
+ cards_per_binder: Type.Integer({ description: '-1 = unlimited' })
814
+ },
815
+ { title: 'ListUsageResponse' }
816
+ );
817
+
818
+ export type ListUsageResponse = Static<typeof ListUsageResponseSchema>;
819
+
727
820
  // ============= USERS =============
728
821
 
729
822