@pfdev/api-types 3.0.11 → 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.
- package/package.json +1 -1
- package/v3.ts +114 -1
package/package.json
CHANGED
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
|
|
|
@@ -446,6 +502,63 @@ export const SetDetailParamSchema = Type.Object({
|
|
|
446
502
|
|
|
447
503
|
export type SetDetailParam = Static<typeof SetDetailParamSchema>;
|
|
448
504
|
|
|
505
|
+
// ============= USERS =============
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
export const UserRoleSchema = Type.Object(
|
|
509
|
+
{
|
|
510
|
+
id: Type.Number({ description: 'Role ID' }),
|
|
511
|
+
name: Type.String({ description: 'Role name' }),
|
|
512
|
+
display_name: Type.String({ description: 'Human-friendly role name' }),
|
|
513
|
+
auto_assigned: Type.Boolean({ description: 'Whether the role was auto-assigned' })
|
|
514
|
+
},
|
|
515
|
+
{ title: 'UserRole' }
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
export type UserRole = Static<typeof UserRoleSchema>;
|
|
519
|
+
|
|
520
|
+
export const MeResponseSchema = Type.Object(
|
|
521
|
+
{
|
|
522
|
+
userid: Type.String({ description: 'Internal user ID (Clerk userId)' }),
|
|
523
|
+
username: Type.Union([Type.String(), Type.Null()]),
|
|
524
|
+
avatar: Type.Union([Type.String(), Type.Null()]),
|
|
525
|
+
discord_username: Type.Union([Type.String(), Type.Null()]),
|
|
526
|
+
active: Type.Union([Type.Boolean(), Type.Null()], {
|
|
527
|
+
description: 'Whether the linked Discord account is active'
|
|
528
|
+
}),
|
|
529
|
+
roles: Type.Array(UserRoleSchema, { description: 'All roles assigned to the user' }),
|
|
530
|
+
display_role: Type.Union([UserRoleSchema, Type.Null()], {
|
|
531
|
+
description: 'Highest-tier subscription role, if any'
|
|
532
|
+
})
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
title: 'MeResponse',
|
|
536
|
+
description: 'The authenticated user\'s profile, roles, and Discord link'
|
|
537
|
+
}
|
|
538
|
+
);
|
|
539
|
+
|
|
540
|
+
export type MeResponse = Static<typeof MeResponseSchema>;
|
|
541
|
+
|
|
542
|
+
export const ErrorResponseSchema = Type.Object({
|
|
543
|
+
error: Type.String(),
|
|
544
|
+
message: Type.String()
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
export type ErrorResponse = Static<typeof ErrorResponseSchema>;
|
|
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
|
+
|
|
449
562
|
// ============= VISION =============
|
|
450
563
|
|
|
451
564
|
|