@playaos/api-client 0.11.0 → 0.13.0

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/dist/index.d.ts CHANGED
@@ -1,648 +1,907 @@
1
+ //#region src/error.d.ts
1
2
  declare class ApiClientError extends Error {
2
- readonly status: number;
3
- readonly code: string;
4
- constructor(status: number, code: string, message: string);
3
+ readonly status: number;
4
+ readonly code: string;
5
+ /**
6
+ * Seconds to wait before retrying, parsed from a numeric `Retry-After`
7
+ * response header when the server sends one (commonly on 429 and 503).
8
+ * Undefined when the header is absent or in HTTP-date form.
9
+ */
10
+ readonly retryAfter?: number | undefined;
11
+ constructor(status: number, code: string, message: string,
12
+ /**
13
+ * Seconds to wait before retrying, parsed from a numeric `Retry-After`
14
+ * response header when the server sends one (commonly on 429 and 503).
15
+ * Undefined when the header is absent or in HTTP-date form.
16
+ */
17
+ retryAfter?: number | undefined);
18
+ }
19
+ //#endregion
20
+ //#region src/types.d.ts
21
+ /** Cursor-paginated list envelope returned by v1 list endpoints (PLA-779). */
22
+ interface Paginated<T> {
23
+ data: T[];
24
+ /** Opaque cursor for the next page, or null when this is the last page. */
25
+ nextCursor: string | null;
5
26
  }
6
-
27
+ /**
28
+ * Shared cursor-pagination request params for list methods. Declared as a `type`
29
+ * (not an `interface`) so intersections like `{ year?: number } & PaginationParams`
30
+ * stay assignable to `Record<string, …>` when serialized into a query string.
31
+ */
32
+ type PaginationParams = {
33
+ /** Max rows to return (1-100, default 50). */
34
+ limit?: number;
35
+ /** Opaque cursor from a previous response's nextCursor. */
36
+ cursor?: string;
37
+ };
7
38
  interface Member {
8
- id: string;
9
- firstName: string;
10
- lastName: string;
11
- name: string | null;
12
- email: string;
13
- phone?: string | null;
14
- role: string | null;
15
- status: string | null;
16
- orgId: string;
17
- createdAt: string | null;
18
- bio?: string | null;
19
- playaName?: string | null;
20
- socialMedia?: Record<string, unknown> | null;
21
- showSocialsInDirectory?: boolean;
22
- profilePhotoPath?: string | null;
23
- emergencyContactName?: string | null;
24
- emergencyContactRelationship?: string | null;
25
- emergencyContactPhone?: string | null;
26
- yearJoined?: number | null;
39
+ id: string;
40
+ firstName: string;
41
+ lastName: string;
42
+ name: string | null;
43
+ email: string;
44
+ phone?: string | null;
45
+ role: string | null;
46
+ status: string | null;
47
+ orgId: string;
48
+ createdAt: string | null;
49
+ bio?: string | null;
50
+ playaName?: string | null;
51
+ socialMedia?: Record<string, unknown> | null;
52
+ showSocialsInDirectory?: boolean;
53
+ profilePhotoPath?: string | null;
54
+ emergencyContactName?: string | null;
55
+ emergencyContactRelationship?: string | null;
56
+ emergencyContactPhone?: string | null;
57
+ yearJoined?: number | null;
27
58
  }
28
59
  interface Application {
29
- id: string;
30
- userId: string;
31
- orgId: string;
32
- status: string | null;
33
- year: number;
34
- createdAt: string | null;
35
- updatedAt: string | null;
36
- email?: string | null;
37
- firstName?: string | null;
38
- lastName?: string | null;
39
- submittedAt?: string | null;
40
- whyJoin?: string | null;
41
- howHeard?: string | null;
42
- shelterType?: string | null;
43
- burningManBefore?: boolean | null;
44
- customFields?: Record<string, unknown> | null;
60
+ id: string;
61
+ userId: string;
62
+ orgId: string;
63
+ status: string | null;
64
+ year: number;
65
+ createdAt: string | null;
66
+ updatedAt: string | null;
67
+ email?: string | null;
68
+ firstName?: string | null;
69
+ lastName?: string | null;
70
+ submittedAt?: string | null;
71
+ whyJoin?: string | null;
72
+ howHeard?: string | null;
73
+ shelterType?: string | null;
74
+ burningManBefore?: boolean | null;
75
+ customFields?: Record<string, unknown> | null;
45
76
  }
46
77
  interface DuesStatus {
47
- userId: string | null;
48
- year: number | null;
49
- paymentStatus: string | null;
50
- amountOwed: string | null;
51
- amountPaid: string | null;
52
- balance: string | null;
78
+ userId: string | null;
79
+ year: number | null;
80
+ paymentStatus: string | null;
81
+ amountOwed: string | null;
82
+ amountPaid: string | null;
83
+ balance: string | null;
53
84
  }
54
85
  interface ShiftSignup {
55
- id: string;
56
- userId: string;
57
- status: string | null;
58
- role: string | null;
86
+ id: string;
87
+ userId: string;
88
+ status: string | null;
89
+ role: string | null;
59
90
  }
60
91
  interface ShiftType {
61
- id: string;
62
- name: string;
63
- description: string | null;
92
+ id: string;
93
+ name: string;
94
+ description: string | null;
64
95
  }
65
96
  interface Shift {
66
- id: string;
67
- orgId: string;
68
- shiftDate: string;
69
- year: number;
70
- startTime: string | null;
71
- endTime: string | null;
72
- maxSlots: number | null;
73
- isPublished: boolean | null;
74
- shiftType: ShiftType | null;
75
- shiftSignups: ShiftSignup[];
97
+ id: string;
98
+ orgId: string;
99
+ shiftDate: string;
100
+ year: number;
101
+ startTime: string | null;
102
+ endTime: string | null;
103
+ maxSlots: number | null;
104
+ isPublished: boolean | null;
105
+ shiftType: ShiftType | null;
106
+ shiftSignups: ShiftSignup[];
76
107
  }
77
108
  interface OrgConfig {
78
- id: string;
79
- name: string;
80
- slug: string;
81
- preset: string | null;
82
- customDomain: string | null;
83
- settings: Record<string, unknown> | null;
84
- features: Record<string, unknown> | null;
85
- plan: string | null;
86
- logoUrl: string | null;
87
- }
88
- type ApplicationStatus = "draft" | "pending" | "invite_sent" | "interview_scheduled" | "interviewed" | "approved" | "waitlisted" | "rejected";
109
+ id: string;
110
+ name: string;
111
+ slug: string;
112
+ preset: string | null;
113
+ customDomain: string | null;
114
+ settings: Record<string, unknown> | null;
115
+ features: Record<string, unknown> | null;
116
+ plan: string | null;
117
+ logoUrl: string | null;
118
+ }
119
+ type CommitmentDataType = "integer" | "boolean";
120
+ type CommitmentValue = number | boolean;
121
+ /** An admin-configured commitment definition (per org + year) the apply form renders. */
122
+ interface Commitment {
123
+ id: string;
124
+ name: string;
125
+ displayName: string;
126
+ description: string | null;
127
+ dataType: CommitmentDataType;
128
+ minValue: number | null;
129
+ maxValue: number | null;
130
+ }
131
+ interface CommitmentsListResponse {
132
+ commitments: Commitment[];
133
+ }
134
+ type ApplicationStatus = "draft" | "pending" | "invite_sent" | "interview_scheduled" | "interviewed" | "approved" | "waitlisted" | "rejected" | "spam";
89
135
  type MemberRole = "member" | "admin" | "applicant" | "super_admin";
90
136
  interface PaymentPageResponse {
91
- provider: "givebutter" | "crowded";
92
- url: string;
93
- modalSupported: boolean;
137
+ provider: "givebutter" | "crowded";
138
+ url: string;
139
+ modalSupported: boolean;
140
+ }
141
+ interface Contact {
142
+ id: string;
143
+ name: string | null;
144
+ email: string | null;
145
+ phone: string | null;
146
+ role: string | null;
147
+ status: string | null;
148
+ }
149
+ interface NotificationLog {
150
+ id: string;
151
+ orgId: string;
152
+ userIds: string[];
153
+ category: string;
154
+ title: string;
155
+ body: string;
156
+ data: Record<string, unknown> | null;
157
+ status: string | null;
158
+ sentAt: string | null;
159
+ error: string | null;
160
+ createdAt: string;
161
+ }
162
+ interface PaymentLedgerRow {
163
+ id: string;
164
+ memberId: string | null;
165
+ amount: string;
166
+ type: "dues" | "payment";
167
+ provider: "givebutter" | "crowded" | null;
168
+ status: string | null;
169
+ timestamp: string | null;
170
+ }
171
+ interface Account {
172
+ id: string;
173
+ [key: string]: unknown;
174
+ }
175
+ interface CampDocument {
176
+ id: string;
177
+ orgId: string;
178
+ name: string;
179
+ description: string | null;
180
+ documentType: string;
181
+ year: number;
182
+ publishedAt: string | null;
183
+ }
184
+ interface Shelter {
185
+ id: string;
186
+ name: string | null;
187
+ shelterType: string;
188
+ year: number;
189
+ orgId: string;
190
+ }
191
+ interface Bike {
192
+ id: string;
193
+ bikeId: string;
194
+ status: string;
195
+ orgId: string;
196
+ }
197
+ interface MemberTag {
198
+ id: string;
199
+ name: string;
200
+ description: string | null;
201
+ color: string | null;
202
+ orgId: string;
203
+ }
204
+ interface MemberGroup {
205
+ id: string;
206
+ name: string | null;
207
+ leaderProfileId: string | null;
208
+ leaderName: string | null;
209
+ leaderEmail: string | null;
210
+ memberCount: number;
211
+ createdAt: string | null;
212
+ }
213
+ interface MemberGroupRosterRow {
214
+ membershipId: string;
215
+ profileId: string;
216
+ role: string;
217
+ status: string;
218
+ name: string | null;
219
+ firstName: string | null;
220
+ lastName: string | null;
221
+ email: string | null;
222
+ profileStatus: string | null;
94
223
  }
95
224
  interface ApplicationCreatePayload {
96
- acknowledged_expectations?: true;
97
- first_name: string;
98
- last_name: string;
99
- email: string;
100
- phone?: string;
101
- referral_code?: string;
102
- socials?: string;
103
- birthday?: string;
104
- hometown?: string;
105
- how_heard?: string;
106
- burning_man_before?: "yes" | "no";
107
- burning_man_years?: string;
108
- shelter_type?: "joining_rv" | "bringing_rv" | "shiftpod_tent" | "car" | "truck" | "van" | "unsure";
109
- shelter_mates?: string;
110
- ticket_status?: "looking" | "have_ticket" | "unsure";
111
- build_available?: boolean;
112
- build_skills?: string;
113
- strike_available?: boolean;
114
- strike_help?: string;
115
- about_yourself?: string;
116
- agrees_to_principles?: true;
117
- custom_fields?: Record<string, unknown>;
225
+ acknowledged_expectations?: true;
226
+ first_name: string;
227
+ last_name: string;
228
+ email: string;
229
+ phone?: string;
230
+ referral_code?: string;
231
+ socials?: string;
232
+ birthday?: string;
233
+ hometown?: string;
234
+ how_heard?: string;
235
+ burning_man_before?: "yes" | "no";
236
+ burning_man_years?: string;
237
+ shelter_type?: "joining_rv" | "bringing_rv" | "shiftpod_tent" | "car" | "truck" | "van" | "unsure";
238
+ shelter_mates?: string;
239
+ ticket_status?: "looking" | "have_ticket" | "unsure";
240
+ build_available?: boolean;
241
+ build_skills?: string;
242
+ strike_available?: boolean;
243
+ strike_help?: string;
244
+ about_yourself?: string;
245
+ agrees_to_principles?: true;
246
+ /** commitmentId → value (integer or boolean per the commitment dataType), collected at apply (PLA-682). */
247
+ commitments?: Record<string, number | boolean>;
248
+ custom_fields?: Record<string, unknown>;
118
249
  }
119
250
  interface ApplicationCreateResponse {
120
- applicationId: string;
121
- status: string;
251
+ applicationId: string;
252
+ status: string;
122
253
  }
123
254
  interface ApplicationTransitionPayload {
124
- to: ApplicationStatus;
125
- rejectionReason?: string;
126
- /** When true, sends a templated email to the applicant (PLA-710). */
127
- notify?: boolean;
255
+ to: ApplicationStatus;
256
+ rejectionReason?: string;
257
+ /** When true, sends a templated email to the applicant (PLA-710). */
258
+ notify?: boolean;
128
259
  }
129
260
  interface ApplicationTransitionResponse {
130
- applicationId: string;
131
- status: ApplicationStatus;
261
+ applicationId: string;
262
+ status: ApplicationStatus;
132
263
  }
133
264
  interface MemberCreatePayload {
134
- firstName: string;
135
- lastName: string;
136
- email: string;
137
- phone?: string | null;
138
- role?: "member" | "admin" | "super_admin";
139
- status?: string;
265
+ firstName: string;
266
+ lastName: string;
267
+ email: string;
268
+ phone?: string | null;
269
+ role?: "member" | "admin" | "super_admin";
270
+ status?: string;
140
271
  }
141
272
  interface MemberCreateResponse {
142
- profileId: string;
273
+ profileId: string;
143
274
  }
144
275
  interface MemberUpdatePayload {
145
- firstName?: string;
146
- lastName?: string;
147
- phone?: string | null;
276
+ firstName?: string;
277
+ lastName?: string;
278
+ phone?: string | null;
148
279
  }
149
280
  interface MemberUpdateResponse {
150
- profileId: string;
281
+ profileId: string;
151
282
  }
152
283
  interface MemberDeactivateResponse {
153
- profileId: string;
154
- status: "inactive";
284
+ profileId: string;
285
+ status: "inactive";
155
286
  }
156
287
  interface WaiverSection {
157
- id: string;
158
- heading: string;
159
- body: string;
160
- required: boolean;
288
+ id: string;
289
+ heading: string;
290
+ body: string;
291
+ required: boolean;
161
292
  }
162
293
  interface WaiverContent {
163
- title: string;
164
- sections: WaiverSection[];
165
- effectiveDate?: string;
166
- orgFields?: {
167
- campName?: string;
168
- eventYear?: number;
169
- };
294
+ title: string;
295
+ sections: WaiverSection[];
296
+ effectiveDate?: string;
297
+ orgFields?: {
298
+ campName?: string;
299
+ eventYear?: number;
300
+ };
170
301
  }
171
302
  interface Waiver {
172
- id: string;
173
- version: number;
174
- name: string;
175
- year: number;
176
- content: WaiverContent;
303
+ id: string;
304
+ version: number;
305
+ name: string;
306
+ year: number;
307
+ content: WaiverContent;
177
308
  }
178
309
  interface WaiverStatus {
179
- waiverId: string;
180
- version: number;
181
- signed: boolean;
182
- signedAt: string | null;
183
- signatureId: string | null;
310
+ waiverId: string;
311
+ version: number;
312
+ signed: boolean;
313
+ signedAt: string | null;
314
+ signatureId: string | null;
184
315
  }
185
316
  interface WaiverSignPayload {
186
- waiverId: string;
187
- applicationId: string;
188
- signerName: string;
189
- /** base64 PNG data URL — required (drawn-canvas signature). */
190
- signatureImageData: string;
317
+ waiverId: string;
318
+ applicationId: string;
319
+ signerName: string;
320
+ /** base64 PNG data URL — required (drawn-canvas signature). */
321
+ signatureImageData: string;
191
322
  }
192
323
  interface WaiverSignResponse {
193
- signatureId: string;
324
+ signatureId: string;
194
325
  }
195
326
  interface ApplicationNote {
196
- id: string;
197
- authorId: string;
198
- authorName: string | null;
199
- body: string;
200
- createdAt: string;
327
+ id: string;
328
+ authorId: string;
329
+ authorName: string | null;
330
+ body: string;
331
+ createdAt: string;
201
332
  }
202
333
  interface ApplicationScore {
203
- adminId: string;
204
- adminName: string | null;
205
- value: number;
206
- updatedAt: string;
334
+ adminId: string;
335
+ adminName: string | null;
336
+ value: number;
337
+ updatedAt: string;
207
338
  }
208
339
  interface ApplicationAnnotations {
209
- notes: ApplicationNote[];
210
- tags: string[];
211
- scores: ApplicationScore[];
340
+ notes: ApplicationNote[];
341
+ tags: string[];
342
+ scores: ApplicationScore[];
212
343
  }
213
344
  interface AnnouncementSendPayload {
214
- subject: string;
215
- body: string;
216
- filters?: {
217
- role?: string;
218
- status?: string;
219
- shiftTypeId?: string;
220
- };
221
- dryRun?: boolean;
345
+ subject: string;
346
+ body: string;
347
+ filters?: {
348
+ role?: string;
349
+ status?: string;
350
+ shiftTypeId?: string;
351
+ };
352
+ dryRun?: boolean;
222
353
  }
223
354
  interface AnnouncementSendResponse {
224
- sent: number;
225
- recipients: {
226
- name: string | null;
227
- email: string;
228
- }[];
355
+ sent: number;
356
+ recipients: {
357
+ name: string | null;
358
+ email: string;
359
+ }[];
229
360
  }
230
361
  interface DuesCreatePayload {
231
- userId: string;
232
- amount: number;
233
- paymentMethod?: string;
234
- duesCollectionId?: string;
362
+ userId: string;
363
+ amount: number;
364
+ paymentMethod?: string;
365
+ duesCollectionId?: string;
235
366
  }
236
367
  interface DuesCreateResponse {
237
- paymentId: string;
368
+ paymentId: string;
238
369
  }
239
370
  interface DuesUpdatePayload {
240
- amount?: number;
241
- paymentStatus?: string;
242
- paymentMethod?: string;
371
+ amount?: number;
372
+ paymentStatus?: string;
373
+ paymentMethod?: string;
243
374
  }
244
375
  interface DuesUpdateResponse {
245
- paymentId: string;
376
+ paymentId: string;
246
377
  }
247
378
  interface OrgUpdatePayload {
248
- name?: string;
249
- logoUrl?: string | null;
250
- tagline?: string | null;
251
- description?: string | null;
252
- settings?: Record<string, unknown> | null;
253
- features?: Record<string, unknown> | null;
379
+ name?: string;
380
+ logoUrl?: string | null;
381
+ tagline?: string | null;
382
+ description?: string | null;
383
+ settings?: Record<string, unknown> | null;
384
+ features?: Record<string, unknown> | null;
254
385
  }
255
386
  interface OrgUpdateResponse {
256
- orgId: string;
387
+ orgId: string;
257
388
  }
258
389
  interface ApplicationEvent {
259
- id: string;
260
- applicationId: string;
261
- actorId: string | null;
262
- actorName: string | null;
263
- type: "status_change" | "note_added" | "tags_updated" | "score_set";
264
- timestamp: string;
265
- fromStatus?: string | null;
266
- toStatus?: string;
267
- metadata?: Record<string, unknown>;
390
+ id: string;
391
+ applicationId: string;
392
+ actorId: string | null;
393
+ actorName: string | null;
394
+ type: "status_change" | "note_added" | "tags_updated" | "score_set";
395
+ timestamp: string;
396
+ fromStatus?: string | null;
397
+ toStatus?: string;
398
+ metadata?: Record<string, unknown>;
268
399
  }
269
400
  interface ApplicationHistoryResponse {
270
- events: ApplicationEvent[];
401
+ events: ApplicationEvent[];
271
402
  }
272
403
  interface AvailabilityWindow {
273
- dayOfWeek: number;
274
- startTime: string;
275
- endTime: string;
404
+ dayOfWeek: number;
405
+ startTime: string;
406
+ endTime: string;
276
407
  }
277
408
  interface SetAvailabilityInput {
278
- windows: AvailabilityWindow[];
409
+ windows: AvailabilityWindow[];
279
410
  }
280
411
  interface SetAvailabilityResponse {
281
- windows: {
282
- count: number;
283
- };
412
+ windows: {
413
+ count: number;
414
+ };
284
415
  }
285
416
  interface CreateBookingTokenInput {
286
- applicationId: string;
287
- bookingLinkId: string;
288
- expiresAt?: string;
417
+ applicationId: string;
418
+ bookingLinkId: string;
419
+ expiresAt?: string;
289
420
  }
290
421
  interface BookingToken {
291
- id: string;
292
- applicationId: string;
293
- token: string;
294
- url: string;
295
- expiresAt: string | null;
296
- createdAt: string | null;
422
+ id: string;
423
+ applicationId: string;
424
+ token: string;
425
+ url: string;
426
+ expiresAt: string | null;
427
+ createdAt: string | null;
297
428
  }
298
429
  interface BookSlotInput {
299
- slotUtcStart: string;
300
- name: string;
301
- email: string;
302
- interviewerId?: string;
303
- timezone?: string;
430
+ slotUtcStart: string;
431
+ name: string;
432
+ email: string;
433
+ interviewerId?: string;
434
+ timezone?: string;
304
435
  }
305
436
  interface BookSlotResponse {
306
- bookingId: string;
307
- applicationStatus: string;
437
+ bookingId: string;
438
+ applicationStatus: string;
308
439
  }
309
440
  interface RescheduleInput {
310
- slotUtcStart: string;
311
- interviewerId?: string;
312
- timezone?: string;
441
+ slotUtcStart: string;
442
+ interviewerId?: string;
443
+ timezone?: string;
313
444
  }
314
445
  interface CalendarStatus {
315
- connected: boolean;
316
- provider: string;
317
- calendarId: string | null;
318
- calendarName?: string | null;
446
+ connected: boolean;
447
+ provider: string;
448
+ calendarId: string | null;
449
+ calendarName?: string | null;
319
450
  }
320
451
  interface GoogleCalendar {
321
- id: string;
322
- summary: string;
323
- primary?: boolean;
452
+ id: string;
453
+ summary: string;
454
+ primary?: boolean;
324
455
  }
325
456
  interface SelectCalendarInput {
326
- calendarId: string;
327
- calendarName?: string;
457
+ calendarId: string;
458
+ calendarName?: string;
328
459
  }
329
-
460
+ //#endregion
461
+ //#region src/client.d.ts
330
462
  interface ClientOptions {
331
- /** Base URL for authenticated /api/v1 routes, e.g. https://api.playaos.app */
332
- baseUrl: string;
333
- /** Optional base URL for /api/embed/v1 routes when they live on a different host. */
334
- embedBaseUrl?: string;
335
- /** API key in the format pk_live_* */
336
- apiKey: string;
463
+ /** Base URL for authenticated /api/v1 routes, e.g. https://api.playaos.app */
464
+ baseUrl: string;
465
+ /** Optional base URL for /api/embed/v1 routes when they live on a different host. */
466
+ embedBaseUrl?: string;
467
+ /** API key in the format pk_live_* */
468
+ apiKey: string;
469
+ /**
470
+ * Supabase session JWT of the acting member, sent as `X-PlayaOS-Member-Token`
471
+ * on every /api/v1 call (PLA-1195). Member-scoped endpoints (a member's own
472
+ * dues, payments, application, shelter, shifts signup, …) require it and
473
+ * return 401 without it. Org-level endpoints do not require it, but a token
474
+ * that is sent must still verify — an expired or invalid one is a 401 on any
475
+ * /api/v1 route that installs the member middleware. Prefer
476
+ * `client.withMember(token)` to derive a per-request client from a shared
477
+ * server-side one rather than constructing a client per user.
478
+ */
479
+ memberToken?: string;
337
480
  }
338
481
  declare class PlayaOSClient {
339
- private readonly baseUrl;
340
- private readonly embedBaseUrl;
341
- private readonly apiKey;
342
- constructor(opts: ClientOptions);
343
- readonly members: {
344
- list: (params?: {
345
- role?: MemberRole;
346
- status?: string;
347
- }, opts?: {
348
- signal?: AbortSignal;
349
- }) => Promise<Member[]>;
350
- get: (id: string, opts?: {
351
- signal?: AbortSignal;
352
- }) => Promise<Member>;
353
- /** Member-self profile update (PLA-700). Requires camp key + member Bearer token. */
354
- selfUpdate: (payload: {
355
- bio?: string | null;
356
- playaName?: string | null;
357
- socialMedia?: Record<string, unknown> | null;
358
- showSocialsInDirectory?: boolean;
359
- phone?: string | null;
360
- emergencyContactName?: string | null;
361
- emergencyContactRelationship?: string | null;
362
- emergencyContactPhone?: string | null;
363
- profilePhotoPath?: string | null;
364
- yearJoined?: number | null;
365
- }, opts: {
366
- accessToken: string;
367
- signal?: AbortSignal;
368
- }) => Promise<{
369
- profileId: string;
370
- }>;
371
- /** Member-self shift signup + cancel (PLA-705). Requires camp key + member Bearer. */
372
- shifts: {
373
- signup: (payload: {
374
- shiftId: string;
375
- role?: string;
376
- }, opts: {
377
- accessToken: string;
378
- signal?: AbortSignal;
379
- }) => Promise<{
380
- signupId: string;
381
- waitlisted: boolean;
382
- }>;
383
- cancel: (signupId: string, opts: {
384
- accessToken: string;
385
- signal?: AbortSignal;
386
- }) => Promise<{
387
- canceled: boolean;
388
- promotedSignupId: string | null;
389
- }>;
390
- };
482
+ private readonly baseUrl;
483
+ private readonly embedBaseUrl;
484
+ private readonly apiKey;
485
+ private readonly memberToken;
486
+ constructor(opts: ClientOptions);
487
+ /** Credentials for /api/v1 calls; the embed surface uses `apiKey` alone as the camp key. */
488
+ private get auth();
489
+ /**
490
+ * Derive a client that acts as one member (PLA-1195): same host and org key,
491
+ * plus the member's Supabase session JWT on every /api/v1 call. Use this in a
492
+ * server that holds one org key and serves many signed-in members.
493
+ */
494
+ withMember(memberToken: string): PlayaOSClient;
495
+ readonly members: {
496
+ list: (params?: {
497
+ role?: MemberRole;
498
+ status?: string;
499
+ } & PaginationParams, opts?: {
500
+ signal?: AbortSignal;
501
+ }) => Promise<Paginated<Member>>;
502
+ /**
503
+ * Full profile (phone, emergency contact). Requires a member token; pass
504
+ * `"me"` for the acting member — non-admins may fetch only themselves.
505
+ */
506
+ get: (id: string, opts?: {
507
+ signal?: AbortSignal;
508
+ }) => Promise<Member>;
509
+ /** Member-self profile update (PLA-700). Requires camp key + member Bearer token. */
510
+ selfUpdate: (payload: {
511
+ bio?: string | null;
512
+ playaName?: string | null;
513
+ socialMedia?: Record<string, unknown> | null;
514
+ showSocialsInDirectory?: boolean;
515
+ phone?: string | null;
516
+ emergencyContactName?: string | null;
517
+ emergencyContactRelationship?: string | null;
518
+ emergencyContactPhone?: string | null;
519
+ profilePhotoPath?: string | null;
520
+ yearJoined?: number | null;
521
+ }, opts: {
522
+ accessToken: string;
523
+ signal?: AbortSignal;
524
+ }) => Promise<{
525
+ profileId: string;
526
+ }>;
527
+ /** Member-self shift signup + cancel (PLA-705). Requires camp key + member Bearer. */
528
+ shifts: {
529
+ signup: (payload: {
530
+ shiftId: string;
531
+ role?: string;
532
+ }, opts: {
533
+ accessToken: string;
534
+ signal?: AbortSignal;
535
+ }) => Promise<{
536
+ signupId: string;
537
+ waitlisted: boolean;
538
+ }>;
539
+ cancel: (signupId: string, opts: {
540
+ accessToken: string;
541
+ signal?: AbortSignal;
542
+ }) => Promise<{
543
+ canceled: boolean;
544
+ promotedSignupId: string | null;
545
+ }>;
391
546
  };
392
- readonly applications: {
393
- list: (params?: {
394
- status?: ApplicationStatus;
395
- year?: number;
396
- }, opts?: {
397
- signal?: AbortSignal;
398
- }) => Promise<Application[]>;
399
- create: (payload: ApplicationCreatePayload, opts?: {
400
- accessToken?: string;
401
- signal?: AbortSignal;
402
- }) => Promise<ApplicationCreateResponse>;
547
+ };
548
+ readonly applications: {
549
+ list: (params?: {
550
+ status?: ApplicationStatus;
551
+ year?: number;
552
+ } & PaginationParams, opts?: {
553
+ signal?: AbortSignal;
554
+ }) => Promise<Paginated<Application>>;
555
+ create: (payload: ApplicationCreatePayload, opts?: {
556
+ accessToken?: string;
557
+ signal?: AbortSignal;
558
+ }) => Promise<ApplicationCreateResponse>;
559
+ };
560
+ readonly waivers: {
561
+ /** Get the active waiver for an org for the current year. */
562
+ active: (orgId: string, opts?: {
563
+ signal?: AbortSignal;
564
+ }) => Promise<Waiver>;
565
+ /** Sign a waiver. Requires X-Camp-Key; optional accessToken for Bearer path. */
566
+ sign: (payload: WaiverSignPayload, opts?: {
567
+ accessToken?: string;
568
+ signal?: AbortSignal;
569
+ }) => Promise<WaiverSignResponse>;
570
+ /** Has this applicant/member signed the active waiver? Anchor: applicationId query or Bearer accessToken. */
571
+ status: (orgId: string, opts?: {
572
+ applicationId?: string;
573
+ accessToken?: string;
574
+ signal?: AbortSignal;
575
+ }) => Promise<WaiverStatus>;
576
+ /** Get a short-lived download URL for a completed signature's PDF. Anchor: applicationId query or Bearer. */
577
+ signedPdf: (orgId: string, signatureId: string, opts?: {
578
+ applicationId?: string;
579
+ accessToken?: string;
580
+ signal?: AbortSignal;
581
+ }) => Promise<{
582
+ url: string;
583
+ }>;
584
+ };
585
+ readonly dues: {
586
+ list: (params?: {
587
+ userId?: string;
588
+ year?: number;
589
+ paymentStatus?: "unpaid" | "partial" | "paid";
590
+ } & PaginationParams, opts?: {
591
+ signal?: AbortSignal;
592
+ }) => Promise<Paginated<DuesStatus>>;
593
+ };
594
+ readonly shifts: {
595
+ list: (params?: {
596
+ year?: number;
597
+ fromDate?: string;
598
+ toDate?: string;
599
+ publishedOnly?: boolean;
600
+ openOnly?: boolean;
601
+ } & PaginationParams, opts?: {
602
+ signal?: AbortSignal;
603
+ }) => Promise<Paginated<Shift>>;
604
+ };
605
+ readonly org: {
606
+ get: (opts?: {
607
+ signal?: AbortSignal;
608
+ }) => Promise<OrgConfig>;
609
+ };
610
+ readonly commitments: {
611
+ list: (opts?: {
612
+ signal?: AbortSignal;
613
+ }) => Promise<CommitmentsListResponse>;
614
+ };
615
+ readonly payments: {
616
+ list: (params?: {
617
+ type?: "dues" | "payment";
618
+ memberId?: string;
619
+ from?: string;
620
+ to?: string;
621
+ limit?: number;
622
+ offset?: number;
623
+ }, opts?: {
624
+ signal?: AbortSignal;
625
+ }) => Promise<PaymentLedgerRow[]>;
626
+ /** Requires a member token. `memberId` may be omitted by a non-admin (defaults to themselves); admins must pass it. */
627
+ page: (memberId?: string, duesCollectionId?: string, opts?: {
628
+ signal?: AbortSignal;
629
+ }) => Promise<PaymentPageResponse>;
630
+ };
631
+ readonly accounts: {
632
+ list: (params?: {
633
+ limit?: number;
634
+ offset?: number;
635
+ }, opts?: {
636
+ signal?: AbortSignal;
637
+ }) => Promise<Account[]>;
638
+ };
639
+ readonly contacts: {
640
+ list: (params?: {
641
+ role?: MemberRole;
642
+ status?: string;
643
+ search?: string;
644
+ sort?: "name" | "email";
645
+ limit?: number;
646
+ offset?: number;
647
+ }, opts?: {
648
+ signal?: AbortSignal;
649
+ }) => Promise<Contact[]>;
650
+ };
651
+ readonly notifications: {
652
+ list: (params?: {
653
+ category?: string;
654
+ status?: string;
655
+ recipientId?: string;
656
+ limit?: number;
657
+ }, opts?: {
658
+ signal?: AbortSignal;
659
+ }) => Promise<NotificationLog[]>;
660
+ };
661
+ readonly documents: {
662
+ list: (params?: {
663
+ type?: string;
664
+ year?: number;
665
+ }, opts?: {
666
+ signal?: AbortSignal;
667
+ }) => Promise<CampDocument[]>;
668
+ get: (id: string, opts?: {
669
+ signal?: AbortSignal;
670
+ }) => Promise<CampDocument>;
671
+ };
672
+ readonly shelters: {
673
+ list: (params?: {
674
+ ownerId?: string;
675
+ shelterType?: string;
676
+ year?: number;
677
+ }, opts?: {
678
+ signal?: AbortSignal;
679
+ }) => Promise<Shelter[]>;
680
+ get: (id: string, opts?: {
681
+ signal?: AbortSignal;
682
+ }) => Promise<Shelter>;
683
+ };
684
+ readonly bikes: {
685
+ list: (params?: {
686
+ status?: string;
687
+ }, opts?: {
688
+ signal?: AbortSignal;
689
+ }) => Promise<Bike[]>;
690
+ get: (id: string, opts?: {
691
+ signal?: AbortSignal;
692
+ }) => Promise<Bike>;
693
+ };
694
+ readonly tags: {
695
+ list: (opts?: {
696
+ signal?: AbortSignal;
697
+ }) => Promise<MemberTag[]>;
698
+ };
699
+ readonly groups: {
700
+ list: (opts?: {
701
+ signal?: AbortSignal;
702
+ }) => Promise<MemberGroup[]>;
703
+ get: (id: string, opts?: {
704
+ signal?: AbortSignal;
705
+ }) => Promise<MemberGroupRosterRow[]>;
706
+ create: (payload: {
707
+ name: string;
708
+ leaderProfileId: string;
709
+ }, opts?: {
710
+ signal?: AbortSignal;
711
+ }) => Promise<{
712
+ id: string;
713
+ }>;
714
+ };
715
+ readonly admin: {
716
+ applications: {
717
+ /** Get application audit timeline (PLA-712). Requires admin Bearer token. */
718
+ history: (id: string, opts: {
719
+ accessToken: string;
720
+ signal?: AbortSignal;
721
+ }) => Promise<ApplicationHistoryResponse>;
722
+ transition: (id: string, payload: ApplicationTransitionPayload, opts: {
723
+ accessToken: string;
724
+ signal?: AbortSignal;
725
+ }) => Promise<ApplicationTransitionResponse>;
726
+ getAnnotations: (id: string, opts: {
727
+ accessToken: string;
728
+ signal?: AbortSignal;
729
+ }) => Promise<ApplicationAnnotations>;
730
+ addNote: (id: string, payload: {
731
+ body: string;
732
+ }, opts: {
733
+ accessToken: string;
734
+ signal?: AbortSignal;
735
+ }) => Promise<ApplicationNote>;
736
+ setTags: (id: string, payload: {
737
+ tags: string[];
738
+ }, opts: {
739
+ accessToken: string;
740
+ signal?: AbortSignal;
741
+ }) => Promise<string[]>;
742
+ setScore: (id: string, payload: {
743
+ value: number;
744
+ }, opts: {
745
+ accessToken: string;
746
+ signal?: AbortSignal;
747
+ }) => Promise<ApplicationScore>;
403
748
  };
404
- readonly waivers: {
405
- /** Get the active waiver for an org for the current year. */
406
- active: (orgId: string, opts?: {
407
- signal?: AbortSignal;
408
- }) => Promise<Waiver>;
409
- /** Sign a waiver. Requires X-Camp-Key; optional accessToken for Bearer path. */
410
- sign: (payload: WaiverSignPayload, opts?: {
411
- accessToken?: string;
749
+ givebutter: {
750
+ campaigns: {
751
+ list: (opts: {
752
+ accessToken: string;
753
+ signal?: AbortSignal;
754
+ }) => Promise<unknown[]>;
755
+ discountCodes: {
756
+ list: (campaignId: number, opts: {
757
+ accessToken: string;
412
758
  signal?: AbortSignal;
413
- }) => Promise<WaiverSignResponse>;
414
- /** Has this applicant/member signed the active waiver? Anchor: applicationId query or Bearer accessToken. */
415
- status: (orgId: string, opts?: {
416
- applicationId?: string;
417
- accessToken?: string;
759
+ }) => Promise<unknown[]>;
760
+ create: (campaignId: number, payload: {
761
+ code: string;
762
+ value: number;
763
+ type: "percent" | "fixed";
764
+ expirationDate?: string;
765
+ }, opts: {
766
+ accessToken: string;
418
767
  signal?: AbortSignal;
419
- }) => Promise<WaiverStatus>;
420
- /** Get a short-lived download URL for a completed signature's PDF. Anchor: applicationId query or Bearer. */
421
- signedPdf: (orgId: string, signatureId: string, opts?: {
422
- applicationId?: string;
423
- accessToken?: string;
768
+ }) => Promise<unknown>;
769
+ };
770
+ tickets: {
771
+ create: (campaignId: number, payload: {
772
+ name: string;
773
+ price: number;
774
+ totalQuantity?: number;
775
+ }, opts: {
776
+ accessToken: string;
424
777
  signal?: AbortSignal;
425
- }) => Promise<{
426
- url: string;
427
- }>;
778
+ }) => Promise<unknown>;
779
+ };
780
+ };
428
781
  };
429
- readonly dues: {
430
- list: (params?: {
431
- userId?: string;
432
- year?: number;
433
- }, opts?: {
434
- signal?: AbortSignal;
435
- }) => Promise<DuesStatus[]>;
782
+ members: {
783
+ create: (payload: MemberCreatePayload, opts: {
784
+ accessToken: string;
785
+ signal?: AbortSignal;
786
+ }) => Promise<MemberCreateResponse>;
787
+ update: (id: string, patch: MemberUpdatePayload, opts: {
788
+ accessToken: string;
789
+ signal?: AbortSignal;
790
+ }) => Promise<MemberUpdateResponse>;
791
+ deactivate: (id: string, opts: {
792
+ accessToken: string;
793
+ signal?: AbortSignal;
794
+ }) => Promise<MemberDeactivateResponse>;
436
795
  };
437
- readonly shifts: {
438
- list: (params?: {
439
- year?: number;
440
- fromDate?: string;
441
- toDate?: string;
442
- publishedOnly?: boolean;
443
- }, opts?: {
444
- signal?: AbortSignal;
445
- }) => Promise<Shift[]>;
796
+ announcements: {
797
+ /** Send an email blast to camp members (PLA-706). Requires admin Bearer token. */
798
+ send: (payload: AnnouncementSendPayload, opts: {
799
+ accessToken: string;
800
+ signal?: AbortSignal;
801
+ }) => Promise<AnnouncementSendResponse>;
446
802
  };
447
- readonly org: {
448
- get: (opts?: {
449
- signal?: AbortSignal;
450
- }) => Promise<OrgConfig>;
803
+ dues: {
804
+ /** Create a manual dues/payment record (PLA-708). Requires admin Bearer token. */
805
+ create: (payload: DuesCreatePayload, opts: {
806
+ accessToken: string;
807
+ signal?: AbortSignal;
808
+ }) => Promise<DuesCreateResponse>;
809
+ /** Update a dues/payment record (PLA-708). Requires admin Bearer token. */
810
+ update: (id: string, payload: DuesUpdatePayload, opts: {
811
+ accessToken: string;
812
+ signal?: AbortSignal;
813
+ }) => Promise<DuesUpdateResponse>;
451
814
  };
452
- readonly payments: {
453
- page: (memberId: string, duesCollectionId?: string, opts?: {
454
- signal?: AbortSignal;
455
- }) => Promise<PaymentPageResponse>;
815
+ org: {
816
+ /** Update camp configuration settings (PLA-709). Requires admin Bearer token. */
817
+ update: (payload: OrgUpdatePayload, opts: {
818
+ accessToken: string;
819
+ signal?: AbortSignal;
820
+ }) => Promise<OrgUpdateResponse>;
456
821
  };
457
- readonly admin: {
458
- applications: {
459
- /** Get application audit timeline (PLA-712). Requires admin Bearer token. */
460
- history: (id: string, opts: {
461
- accessToken: string;
462
- signal?: AbortSignal;
463
- }) => Promise<ApplicationHistoryResponse>;
464
- transition: (id: string, payload: ApplicationTransitionPayload, opts: {
465
- accessToken: string;
466
- signal?: AbortSignal;
467
- }) => Promise<ApplicationTransitionResponse>;
468
- getAnnotations: (id: string, opts: {
469
- accessToken: string;
470
- signal?: AbortSignal;
471
- }) => Promise<ApplicationAnnotations>;
472
- addNote: (id: string, payload: {
473
- body: string;
474
- }, opts: {
475
- accessToken: string;
476
- signal?: AbortSignal;
477
- }) => Promise<ApplicationNote>;
478
- setTags: (id: string, payload: {
479
- tags: string[];
480
- }, opts: {
481
- accessToken: string;
482
- signal?: AbortSignal;
483
- }) => Promise<string[]>;
484
- setScore: (id: string, payload: {
485
- value: number;
486
- }, opts: {
487
- accessToken: string;
488
- signal?: AbortSignal;
489
- }) => Promise<ApplicationScore>;
490
- };
491
- givebutter: {
492
- campaigns: {
493
- list: (opts: {
494
- accessToken: string;
495
- signal?: AbortSignal;
496
- }) => Promise<unknown[]>;
497
- discountCodes: {
498
- list: (campaignId: number, opts: {
499
- accessToken: string;
500
- signal?: AbortSignal;
501
- }) => Promise<unknown[]>;
502
- create: (campaignId: number, payload: {
503
- code: string;
504
- type: string;
505
- amount: number;
506
- active?: boolean;
507
- }, opts: {
508
- accessToken: string;
509
- signal?: AbortSignal;
510
- }) => Promise<unknown>;
511
- };
512
- tickets: {
513
- create: (campaignId: number, payload: {
514
- name: string;
515
- price: number;
516
- totalQuantity?: number;
517
- }, opts: {
518
- accessToken: string;
519
- signal?: AbortSignal;
520
- }) => Promise<unknown>;
521
- };
522
- };
523
- };
524
- members: {
525
- create: (payload: MemberCreatePayload, opts: {
526
- accessToken: string;
527
- signal?: AbortSignal;
528
- }) => Promise<MemberCreateResponse>;
529
- update: (id: string, patch: MemberUpdatePayload, opts: {
530
- accessToken: string;
531
- signal?: AbortSignal;
532
- }) => Promise<MemberUpdateResponse>;
533
- deactivate: (id: string, opts: {
534
- accessToken: string;
535
- signal?: AbortSignal;
536
- }) => Promise<MemberDeactivateResponse>;
537
- };
538
- announcements: {
539
- /** Send an email blast to camp members (PLA-706). Requires admin Bearer token. */
540
- send: (payload: AnnouncementSendPayload, opts: {
541
- accessToken: string;
542
- signal?: AbortSignal;
543
- }) => Promise<AnnouncementSendResponse>;
544
- };
545
- dues: {
546
- /** Create a manual dues/payment record (PLA-708). Requires admin Bearer token. */
547
- create: (payload: DuesCreatePayload, opts: {
548
- accessToken: string;
549
- signal?: AbortSignal;
550
- }) => Promise<DuesCreateResponse>;
551
- /** Update a dues/payment record (PLA-708). Requires admin Bearer token. */
552
- update: (id: string, payload: DuesUpdatePayload, opts: {
553
- accessToken: string;
554
- signal?: AbortSignal;
555
- }) => Promise<DuesUpdateResponse>;
556
- };
557
- org: {
558
- /** Update camp configuration settings (PLA-709). Requires admin Bearer token. */
559
- update: (payload: OrgUpdatePayload, opts: {
560
- accessToken: string;
561
- signal?: AbortSignal;
562
- }) => Promise<OrgUpdateResponse>;
563
- };
564
- scheduling: {
565
- availability: {
566
- /** Get interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
567
- get: (interviewerId: string, opts: {
568
- accessToken: string;
569
- signal?: AbortSignal;
570
- }) => Promise<SetAvailabilityResponse>;
571
- /** Set interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
572
- set: (interviewerId: string, payload: SetAvailabilityInput, opts: {
573
- accessToken: string;
574
- signal?: AbortSignal;
575
- }) => Promise<SetAvailabilityResponse>;
576
- };
577
- calendar: {
578
- /** Get Google Calendar connection status for an interviewer (PLA-726). Requires admin Bearer. */
579
- status: (interviewerId: string, opts: {
580
- accessToken: string;
581
- signal?: AbortSignal;
582
- }) => Promise<CalendarStatus>;
583
- /** List available Google Calendars (PLA-726). Requires admin Bearer. */
584
- listCalendars: (interviewerId: string, opts: {
585
- accessToken: string;
586
- signal?: AbortSignal;
587
- }) => Promise<{
588
- calendars: GoogleCalendar[];
589
- }>;
590
- /** Select which Google Calendar to use (PLA-726). Requires admin Bearer. */
591
- select: (interviewerId: string, payload: SelectCalendarInput, opts: {
592
- accessToken: string;
593
- signal?: AbortSignal;
594
- }) => Promise<{
595
- calendarId: string;
596
- }>;
597
- /** Disconnect Google Calendar from interviewer (PLA-726). Requires admin Bearer. */
598
- disconnect: (interviewerId: string, opts: {
599
- accessToken: string;
600
- signal?: AbortSignal;
601
- }) => Promise<{
602
- disconnected: boolean;
603
- }>;
604
- };
605
- bookingTokens: {
606
- /** Create a booking token for an application's interview link (PLA-714). Requires admin Bearer token. */
607
- create: (payload: CreateBookingTokenInput, opts: {
608
- accessToken: string;
609
- signal?: AbortSignal;
610
- }) => Promise<BookingToken>;
611
- /** Get an existing booking token for an application (PLA-714). Requires admin Bearer token. */
612
- get: (applicationId: string, opts: {
613
- accessToken: string;
614
- signal?: AbortSignal;
615
- }) => Promise<BookingToken>;
616
- };
617
- };
618
- };
619
- readonly schedule: {
620
- /** List available interview slots for a booking token (PLA-714). Public. */
621
- getSlots: (token: string, opts?: {
622
- signal?: AbortSignal;
822
+ scheduling: {
823
+ availability: {
824
+ /** Get interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
825
+ get: (interviewerId: string, opts: {
826
+ accessToken: string;
827
+ signal?: AbortSignal;
828
+ }) => Promise<SetAvailabilityResponse>;
829
+ /** Set interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
830
+ set: (interviewerId: string, payload: SetAvailabilityInput, opts: {
831
+ accessToken: string;
832
+ signal?: AbortSignal;
833
+ }) => Promise<SetAvailabilityResponse>;
834
+ };
835
+ calendar: {
836
+ /** Get Google Calendar connection status for an interviewer (PLA-726). Requires admin Bearer. */
837
+ status: (interviewerId: string, opts: {
838
+ accessToken: string;
839
+ signal?: AbortSignal;
840
+ }) => Promise<CalendarStatus>;
841
+ /** List available Google Calendars (PLA-726). Requires admin Bearer. */
842
+ listCalendars: (interviewerId: string, opts: {
843
+ accessToken: string;
844
+ signal?: AbortSignal;
623
845
  }) => Promise<{
624
- slots: {
625
- startsAt: string;
626
- endsAt: string;
627
- }[];
846
+ calendars: GoogleCalendar[];
628
847
  }>;
629
- /** Book an interview slot (PLA-714). Public. */
630
- book: (token: string, payload: BookSlotInput, opts?: {
631
- signal?: AbortSignal;
632
- }) => Promise<BookSlotResponse>;
633
- /** Cancel an interview booking (PLA-714). Public. */
634
- cancel: (token: string, opts?: {
635
- signal?: AbortSignal;
636
- }) => Promise<BookSlotResponse>;
637
- /** Reschedule an interview booking (PLA-714). Public. */
638
- reschedule: (token: string, payload: RescheduleInput, opts?: {
639
- signal?: AbortSignal;
640
- }) => Promise<BookSlotResponse>;
848
+ /** Select which Google Calendar to use (PLA-726). Requires admin Bearer. */
849
+ select: (interviewerId: string, payload: SelectCalendarInput, opts: {
850
+ accessToken: string;
851
+ signal?: AbortSignal;
852
+ }) => Promise<{
853
+ calendarId: string;
854
+ }>;
855
+ /** Disconnect Google Calendar from interviewer (PLA-726). Requires admin Bearer. */
856
+ disconnect: (interviewerId: string, opts: {
857
+ accessToken: string;
858
+ signal?: AbortSignal;
859
+ }) => Promise<{
860
+ disconnected: boolean;
861
+ }>;
862
+ };
863
+ bookingTokens: {
864
+ /** Create a booking token for an application's interview link (PLA-714). Requires admin Bearer token. */
865
+ create: (payload: CreateBookingTokenInput, opts: {
866
+ accessToken: string;
867
+ signal?: AbortSignal;
868
+ }) => Promise<BookingToken>;
869
+ /** Get an existing booking token for an application (PLA-714). Requires admin Bearer token. */
870
+ get: (applicationId: string, opts: {
871
+ accessToken: string;
872
+ signal?: AbortSignal;
873
+ }) => Promise<BookingToken>;
874
+ };
641
875
  };
876
+ };
877
+ readonly schedule: {
878
+ /** List available interview slots for a booking token (PLA-714). Public. */
879
+ getSlots: (token: string, opts?: {
880
+ signal?: AbortSignal;
881
+ }) => Promise<{
882
+ slots: {
883
+ startsAt: string;
884
+ endsAt: string;
885
+ }[];
886
+ }>;
887
+ /** Book an interview slot (PLA-714). Public. */
888
+ book: (token: string, payload: BookSlotInput, opts?: {
889
+ signal?: AbortSignal;
890
+ }) => Promise<BookSlotResponse>;
891
+ /** Cancel an interview booking (PLA-714). Public. */
892
+ cancel: (token: string, opts?: {
893
+ signal?: AbortSignal;
894
+ }) => Promise<BookSlotResponse>;
895
+ /** Reschedule an interview booking (PLA-714). Public. */
896
+ reschedule: (token: string, payload: RescheduleInput, opts?: {
897
+ signal?: AbortSignal;
898
+ }) => Promise<BookSlotResponse>;
899
+ };
642
900
  }
643
901
  /** Convenience factory — equivalent to `new PlayaOSClient(opts)`. */
644
902
  declare function createClient(opts: ClientOptions): PlayaOSClient;
645
-
903
+ //#endregion
904
+ //#region src/exchange.d.ts
646
905
  /**
647
906
  * Server-side OAuth-code → ID-token exchange.
648
907
  *
@@ -654,20 +913,99 @@ declare function createClient(opts: ClientOptions): PlayaOSClient;
654
913
  * in `@playaos/react`.
655
914
  */
656
915
  interface ExchangeParams {
657
- authBaseUrl?: string;
658
- code: string;
659
- codeVerifier: string;
660
- clientId: string;
661
- /** Confidential clients only. Omit for public/PKCE-only clients. */
662
- clientSecret?: string;
663
- redirectUri: string;
916
+ authBaseUrl?: string;
917
+ code: string;
918
+ codeVerifier: string;
919
+ clientId: string;
920
+ /** Confidential clients only. Omit for public/PKCE-only clients. */
921
+ clientSecret?: string;
922
+ redirectUri: string;
664
923
  }
665
924
  interface ExchangeResult {
666
- idToken: string;
667
- expiresAt: string;
668
- /** Confidential clients only. Undefined for public clients. */
669
- refreshToken?: string;
925
+ idToken: string;
926
+ expiresAt: string;
927
+ /** Confidential clients only. Undefined for public clients. */
928
+ refreshToken?: string;
670
929
  }
671
930
  declare function exchangeCode(params: ExchangeParams): Promise<ExchangeResult>;
672
-
673
- export { ApiClientError, type Application, type ApplicationAnnotations, type ApplicationCreatePayload, type ApplicationCreateResponse, type ApplicationNote, type ApplicationScore, type ApplicationStatus, type ApplicationTransitionPayload, type ApplicationTransitionResponse, type DuesStatus, type ExchangeParams, type ExchangeResult, type Member, type MemberCreatePayload, type MemberCreateResponse, type MemberDeactivateResponse, type MemberRole, type MemberUpdatePayload, type MemberUpdateResponse, type OrgConfig, type PaymentPageResponse, PlayaOSClient, type Shift, type ShiftSignup, type ShiftType, type Waiver, type WaiverContent, type WaiverSection, type WaiverSignPayload, type WaiverSignResponse, type WaiverStatus, createClient, exchangeCode };
931
+ //#endregion
932
+ //#region src/public-marketplace.d.ts
933
+ /** A listing holds at most this many images (matches the DB's position 1–6 check). */
934
+ declare const MAX_IMAGE_POSITION = 6;
935
+ /**
936
+ * Typed client for the anonymous gift-layer marketplace API (`/api/public/marketplace/*`).
937
+ *
938
+ * Unlike `PlayaOSClient` (api-key auth for `/api/v1`), this surface authenticates
939
+ * writes with a Supabase **Bearer JWT** belonging to a public `global_accounts`
940
+ * user. The token is supplied by an injected `getToken` provider so the same
941
+ * client works from any consumer (the marketing UI supplies the browser
942
+ * Supabase session token; a future surface could supply its own). Keeps the
943
+ * public API as the single write contract — the UI is just another consumer.
944
+ */
945
+ interface PublicMarketplaceClientOptions {
946
+ /** API base, e.g. `https://api.playaos.app`. */
947
+ baseUrl: string;
948
+ /** Supplies the Supabase access token (Bearer) for authenticated calls; null/undefined when signed out. */
949
+ getToken: () => Promise<string | null | undefined> | string | null | undefined;
950
+ }
951
+ interface NewListingInput {
952
+ category: string;
953
+ subcategory?: string;
954
+ title: string;
955
+ body: string;
956
+ price?: number;
957
+ location?: string;
958
+ replyEmail: string;
959
+ }
960
+ interface ImageUploadTarget {
961
+ /** Supabase signed upload URL — PUT the file bytes here. */
962
+ uploadUrl: string;
963
+ /** Storage path to pass back to `attachImage` once the PUT succeeds. */
964
+ storagePath: string;
965
+ }
966
+ /** Moderation flag reasons accepted by the API (mirrors the DB enum). */
967
+ type MarketplaceFlagReason = "spam" | "prohibited" | "other";
968
+ interface ListingImage {
969
+ /** Short-lived signed download URL for the image. */
970
+ url: string;
971
+ /** 1-based display order. */
972
+ position: number;
973
+ }
974
+ interface PublicMarketplaceClient {
975
+ /**
976
+ * Create a listing as the signed-in account. Throws a plain `Error` when there
977
+ * is no token (signed out), or `ApiClientError` on a non-2xx response.
978
+ */
979
+ createListing(input: NewListingInput, signal?: AbortSignal): Promise<{
980
+ id: string;
981
+ }>;
982
+ /** Request a signed upload URL for an image on a listing the caller owns. */
983
+ getImageUploadUrl(listingId: string, signal?: AbortSignal): Promise<ImageUploadTarget>;
984
+ /** Attach an already-uploaded image (by storage path) to a listing at a 1–6 position. */
985
+ attachImage(listingId: string, input: {
986
+ storagePath: string;
987
+ position: number;
988
+ }, signal?: AbortSignal): Promise<{
989
+ id: string;
990
+ }>;
991
+ /** Anonymous: list an active listing's images as short-lived signed URLs (for public display). */
992
+ listListingImages(listingId: string, signal?: AbortSignal): Promise<{
993
+ images: ListingImage[];
994
+ }>;
995
+ /** Anonymous: batch-fetch first-image signed thumbnail URLs (listingId -> url) for browse cards. */
996
+ listThumbnails(listingIds: string[], signal?: AbortSignal): Promise<{
997
+ thumbnails: Record<string, string>;
998
+ }>;
999
+ /** Flag a listing for moderation (signed-in). Idempotent per (listing, user). */
1000
+ flagListing(listingId: string, reason: MarketplaceFlagReason, signal?: AbortSignal): Promise<{
1001
+ ok: boolean;
1002
+ }>;
1003
+ /** Contact a listing's owner (signed-in); records the reply + queues a notification email. */
1004
+ replyToListing(listingId: string, message: string | undefined, signal?: AbortSignal): Promise<{
1005
+ ok: boolean;
1006
+ }>;
1007
+ }
1008
+ declare function createPublicMarketplaceClient(opts: PublicMarketplaceClientOptions): PublicMarketplaceClient;
1009
+ //#endregion
1010
+ export { ApiClientError, type Application, type ApplicationAnnotations, type ApplicationCreatePayload, type ApplicationCreateResponse, type ApplicationNote, type ApplicationScore, type ApplicationStatus, type ApplicationTransitionPayload, type ApplicationTransitionResponse, type Commitment, type CommitmentDataType, type CommitmentValue, type CommitmentsListResponse, type DuesStatus, type ExchangeParams, type ExchangeResult, type ImageUploadTarget, type ListingImage, MAX_IMAGE_POSITION, type MarketplaceFlagReason, type Member, type MemberCreatePayload, type MemberCreateResponse, type MemberDeactivateResponse, type MemberRole, type MemberUpdatePayload, type MemberUpdateResponse, type NewListingInput, type OrgConfig, type PaymentPageResponse, PlayaOSClient, type PublicMarketplaceClient, type PublicMarketplaceClientOptions, type Shift, type ShiftSignup, type ShiftType, type Waiver, type WaiverContent, type WaiverSection, type WaiverSignPayload, type WaiverSignResponse, type WaiverStatus, createClient, createPublicMarketplaceClient, exchangeCode };
1011
+ //# sourceMappingURL=index.d.ts.map