@pfdev/api-types 3.0.11 → 3.0.12

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 +44 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pfdev/api-types",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "TypeScript types for PF API V3",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
package/v3.ts CHANGED
@@ -446,6 +446,50 @@ export const SetDetailParamSchema = Type.Object({
446
446
 
447
447
  export type SetDetailParam = Static<typeof SetDetailParamSchema>;
448
448
 
449
+ // ============= USERS =============
450
+
451
+
452
+ export const UserRoleSchema = Type.Object(
453
+ {
454
+ id: Type.Number({ description: 'Role ID' }),
455
+ name: Type.String({ description: 'Role name' }),
456
+ display_name: Type.String({ description: 'Human-friendly role name' }),
457
+ auto_assigned: Type.Boolean({ description: 'Whether the role was auto-assigned' })
458
+ },
459
+ { title: 'UserRole' }
460
+ );
461
+
462
+ export type UserRole = Static<typeof UserRoleSchema>;
463
+
464
+ export const MeResponseSchema = Type.Object(
465
+ {
466
+ userid: Type.String({ description: 'Internal user ID (Clerk userId)' }),
467
+ username: Type.Union([Type.String(), Type.Null()]),
468
+ avatar: Type.Union([Type.String(), Type.Null()]),
469
+ discord_username: Type.Union([Type.String(), Type.Null()]),
470
+ active: Type.Union([Type.Boolean(), Type.Null()], {
471
+ description: 'Whether the linked Discord account is active'
472
+ }),
473
+ roles: Type.Array(UserRoleSchema, { description: 'All roles assigned to the user' }),
474
+ display_role: Type.Union([UserRoleSchema, Type.Null()], {
475
+ description: 'Highest-tier subscription role, if any'
476
+ })
477
+ },
478
+ {
479
+ title: 'MeResponse',
480
+ description: 'The authenticated user\'s profile, roles, and Discord link'
481
+ }
482
+ );
483
+
484
+ export type MeResponse = Static<typeof MeResponseSchema>;
485
+
486
+ export const ErrorResponseSchema = Type.Object({
487
+ error: Type.String(),
488
+ message: Type.String()
489
+ });
490
+
491
+ export type ErrorResponse = Static<typeof ErrorResponseSchema>;
492
+
449
493
  // ============= VISION =============
450
494
 
451
495