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