@playaos/api-client 0.13.0 → 0.15.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.js CHANGED
@@ -90,6 +90,22 @@ async function post(url, auth, body, signal) {
90
90
  if (!res.ok) throw await parseError(res);
91
91
  return res.json();
92
92
  }
93
+ /** v1 write helpers. `request`/`post` predate these; same auth, other verbs. */
94
+ async function sendV1(method, url, auth, body, signal) {
95
+ const headers = v1Headers(auth);
96
+ const init = {
97
+ method,
98
+ headers,
99
+ signal
100
+ };
101
+ if (body !== void 0) {
102
+ headers["Content-Type"] = "application/json";
103
+ init.body = JSON.stringify(body);
104
+ }
105
+ const res = await fetch(url, init);
106
+ if (!res.ok) throw await parseError(res);
107
+ return res.json();
108
+ }
93
109
  async function postEmbed(url, campKey, body, opts) {
94
110
  const headers = {
95
111
  "X-Camp-Key": campKey,
@@ -183,6 +199,32 @@ var PlayaOSClient = class PlayaOSClient {
183
199
  memberToken
184
200
  });
185
201
  }
202
+ /**
203
+ * Admin dual-path (PLA-1203): when the client has a memberToken, call `/api/v1`
204
+ * (org key + X-PlayaOS-Member-Token). Otherwise keep the legacy embed-admin
205
+ * Bearer-JWT path so published consumers without withMember() still work.
206
+ */
207
+ adminV1OrEmbed(method, v1Path, embedPath, accessToken, body, signal) {
208
+ if (this.memberToken) {
209
+ const url = buildUrl(this.baseUrl, v1Path);
210
+ if (method === "GET") return request(url, this.auth, signal);
211
+ if (method === "POST") return post(url, this.auth, body ?? {}, signal);
212
+ return sendV1(method, url, this.auth, body, signal);
213
+ }
214
+ return adminEmbed(method, buildEmbedUrl(this.embedBaseUrl, embedPath), accessToken, body, signal);
215
+ }
216
+ /** Resolve admin credential: memberToken clients skip accessToken; embed path requires it. */
217
+ adminAccess(opts) {
218
+ if (this.memberToken) return {
219
+ accessToken: opts?.accessToken ?? "",
220
+ signal: opts?.signal
221
+ };
222
+ if (!opts?.accessToken) throw new Error("accessToken is required; call withMember(token) or pass { accessToken }");
223
+ return {
224
+ accessToken: opts.accessToken,
225
+ signal: opts.signal
226
+ };
227
+ }
186
228
  members = {
187
229
  list: (params, opts) => request(buildUrl(this.baseUrl, "/members", params), this.auth, opts?.signal),
188
230
  /**
@@ -190,12 +232,21 @@ var PlayaOSClient = class PlayaOSClient {
190
232
  * `"me"` for the acting member — non-admins may fetch only themselves.
191
233
  */
192
234
  get: (id, opts) => request(buildUrl(this.baseUrl, `/members/${encodeURIComponent(id)}`), this.auth, opts?.signal),
193
- /** Member-self profile update (PLA-700). Requires camp key + member Bearer token. */
194
- selfUpdate: (payload, opts) => putEmbed(buildEmbedUrl(this.embedBaseUrl, "/members/self"), this.apiKey, payload, opts),
195
- /** Member-self shift signup + cancel (PLA-705). Requires camp key + member Bearer. */
235
+ /** Member-self profile update (PLA-700 / PLA-1203). Prefers v1 when memberToken is set. */
236
+ selfUpdate: (payload, opts) => this.memberToken ? sendV1("PUT", buildUrl(this.baseUrl, "/members/me"), this.auth, payload, opts.signal) : putEmbed(buildEmbedUrl(this.embedBaseUrl, "/members/self"), this.apiKey, payload, opts),
237
+ /** Member-self shift signup + cancel (PLA-705 / PLA-1203). Prefers v1 when memberToken is set. */
196
238
  shifts: {
197
- signup: (payload, opts) => putEmbed(buildEmbedUrl(this.embedBaseUrl, "/shifts/signup"), this.apiKey, payload, opts),
198
- cancel: (signupId, opts) => deleteEmbed(buildEmbedUrl(this.embedBaseUrl, `/shifts/signups/${encodeURIComponent(signupId)}`), this.apiKey, opts)
239
+ signup: async (payload, opts) => {
240
+ if (this.memberToken) {
241
+ const assigned = await post(buildUrl(this.baseUrl, `/shifts/${encodeURIComponent(payload.shiftId)}/assign`), this.auth, { role: payload.role }, opts.signal);
242
+ return {
243
+ signupId: assigned.id,
244
+ waitlisted: assigned.waitlisted ?? false
245
+ };
246
+ }
247
+ return postEmbed(buildEmbedUrl(this.embedBaseUrl, "/shifts/signup"), this.apiKey, payload, opts);
248
+ },
249
+ cancel: (signupId, opts) => this.memberToken ? sendV1("DELETE", buildUrl(this.baseUrl, `/shifts/signups/${encodeURIComponent(signupId)}`), this.auth, void 0, opts.signal) : deleteEmbed(buildEmbedUrl(this.embedBaseUrl, `/shifts/signups/${encodeURIComponent(signupId)}`), this.apiKey, opts)
199
250
  }
200
251
  };
201
252
  applications = {
@@ -243,7 +294,34 @@ var PlayaOSClient = class PlayaOSClient {
243
294
  };
244
295
  bikes = {
245
296
  list: (params, opts) => request(buildUrl(this.baseUrl, "/bikes", params), this.auth, opts?.signal),
246
- get: (id, opts) => request(buildUrl(this.baseUrl, `/bikes/${encodeURIComponent(id)}`), this.auth, opts?.signal)
297
+ get: (id, opts) => request(buildUrl(this.baseUrl, `/bikes/${encodeURIComponent(id)}`), this.auth, opts?.signal),
298
+ /**
299
+ * Cancel an in-house fleet rental owned by the acting member (PLA-1232).
300
+ * Requires a member token. 404 when missing, not owned, or not cancellable.
301
+ */
302
+ cancelRental: (rentalId, opts) => sendV1("DELETE", buildUrl(this.baseUrl, `/members/bikes/${encodeURIComponent(rentalId)}`), this.auth, void 0, opts?.signal)
303
+ };
304
+ /**
305
+ * DustJunkie bike rentals (PLA-1180), passed through to the vendor. A camp
306
+ * without the integration gets 403; a DustJunkie failure is a 502.
307
+ */
308
+ bikeRentals = {
309
+ /** Bookable options with estimated totals for `delivery` (server default `camp_delivery`). Org key only. */
310
+ catalog: (params, opts) => request(buildUrl(this.baseUrl, "/bike-rentals/catalog", params), this.auth, opts?.signal),
311
+ /** The rental agreement the member must accept before `requestReservation`. Org key only. */
312
+ waiver: (opts) => request(buildUrl(this.baseUrl, "/bike-rentals/waiver"), this.auth, opts?.signal),
313
+ /**
314
+ * Requires a member token. Admins get the whole camp when `memberId` is
315
+ * omitted; any other role gets their own reservations and 403 naming someone else.
316
+ */
317
+ reservations: (params, opts) => request(buildUrl(this.baseUrl, "/bike-rentals/reservations", params), this.auth, opts?.signal),
318
+ /**
319
+ * Requires a member token; always requests for the acting member. 409 when
320
+ * the model is sold out, 400 when it is unknown or no longer bookable.
321
+ */
322
+ requestReservation: (payload, opts) => post(buildUrl(this.baseUrl, "/bike-rentals/requests"), this.auth, payload, opts?.signal),
323
+ /** Members who said they want a bike but have no reservation, for the active camp year. Org key only. */
324
+ interestedNotReserved: (opts) => request(buildUrl(this.baseUrl, "/bike-rentals/interested-not-reserved"), this.auth, opts?.signal)
247
325
  };
248
326
  tags = { list: (opts) => request(buildUrl(this.baseUrl, "/tags"), this.auth, opts?.signal) };
249
327
  groups = {
@@ -251,63 +329,155 @@ var PlayaOSClient = class PlayaOSClient {
251
329
  get: (id, opts) => request(buildUrl(this.baseUrl, `/groups/${encodeURIComponent(id)}`), this.auth, opts?.signal),
252
330
  create: (payload, opts) => post(buildUrl(this.baseUrl, "/groups"), this.auth, payload, opts?.signal)
253
331
  };
332
+ /**
333
+ * Camp-scoped packing (PLA-1197). Every method is the acting member's own
334
+ * list — packing has no `memberId` to widen, so these require `memberToken`
335
+ * and 401 on an org key alone.
336
+ */
337
+ packing = {
338
+ /** The resolved list: curated base + camp layer + personal layer (ADR-071). */
339
+ list: (params, opts) => request(buildUrl(this.baseUrl, "/packing", params), this.auth, opts?.signal),
340
+ /**
341
+ * Set the member's status for one item. The slug goes in the body, not the
342
+ * path: slugs are `${category}/${name}` and contain a `/`.
343
+ *
344
+ * Pass the same `shelter` the list was read under — validation filters by
345
+ * shelter, so an override omitted here rejects shelter-specific items.
346
+ */
347
+ setStatus: (payload, opts) => sendV1("PUT", buildUrl(this.baseUrl, "/packing/items/status"), this.auth, payload, opts?.signal),
348
+ personalItems: {
349
+ list: (params, opts) => request(buildUrl(this.baseUrl, "/packing/personal-items", params), this.auth, opts?.signal),
350
+ create: (payload, opts) => post(buildUrl(this.baseUrl, "/packing/personal-items"), this.auth, payload, opts?.signal),
351
+ /**
352
+ * Flip the item between `need` and `have`. It does **not** set `packed` —
353
+ * use `setStatus` for the full vocabulary. 404 if the item is not the
354
+ * acting member's.
355
+ */
356
+ toggle: (id, opts) => sendV1("PATCH", buildUrl(this.baseUrl, `/packing/personal-items/${encodeURIComponent(id)}`), this.auth, void 0, opts?.signal),
357
+ /** 404 if the item is not the acting member's. */
358
+ remove: (id, opts) => sendV1("DELETE", buildUrl(this.baseUrl, `/packing/personal-items/${encodeURIComponent(id)}`), this.auth, void 0, opts?.signal)
359
+ },
360
+ /**
361
+ * Camp packing layer (PLA-1204). Admin/super_admin only — non-admins get 403.
362
+ * Identity is the published slug (`overrides_slug` or `camp:<uuid>`).
363
+ */
364
+ campItems: {
365
+ list: (opts) => request(buildUrl(this.baseUrl, "/packing/camp-items"), this.auth, opts?.signal),
366
+ upsert: (payload, opts) => sendV1("PUT", buildUrl(this.baseUrl, "/packing/camp-items"), this.auth, payload, opts?.signal)
367
+ }
368
+ };
369
+ /**
370
+ * SAP — Special Access Pass, for early/overnight vehicle arrival (PLA-1202).
371
+ * Admin/super_admin only; there is no member-facing SAP surface. Year is
372
+ * always the org's active camp year — the server derives it, callers never
373
+ * pass one.
374
+ */
375
+ sap = {
376
+ allocation: {
377
+ get: (opts) => request(buildUrl(this.baseUrl, "/sap/allocation"), this.auth, opts?.signal),
378
+ update: (payload, opts) => sendV1("PUT", buildUrl(this.baseUrl, "/sap/allocation"), this.auth, payload, opts?.signal)
379
+ },
380
+ dayAllocations: {
381
+ list: (opts) => request(buildUrl(this.baseUrl, "/sap/day-allocations"), this.auth, opts?.signal),
382
+ /** Upserts by (active year, accessDate); 409 on a cross-org date collision. */
383
+ upsert: (payload, opts) => sendV1("PUT", buildUrl(this.baseUrl, "/sap/day-allocations"), this.auth, payload, opts?.signal)
384
+ },
385
+ assignments: {
386
+ list: (opts) => request(buildUrl(this.baseUrl, "/sap/assignments"), this.auth, opts?.signal),
387
+ create: (payload, opts) => post(buildUrl(this.baseUrl, "/sap/assignments"), this.auth, payload, opts?.signal),
388
+ update: (payload, opts) => sendV1("PATCH", buildUrl(this.baseUrl, "/sap/assignments"), this.auth, payload, opts?.signal),
389
+ remove: (assignmentId, opts) => sendV1("DELETE", buildUrl(this.baseUrl, "/sap/assignments"), this.auth, { assignmentId }, opts?.signal)
390
+ }
391
+ };
254
392
  admin = {
255
393
  applications: {
256
- /** Get application audit timeline (PLA-712). Requires admin Bearer token. */
257
- history: (id, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}/history`), opts.accessToken, void 0, opts.signal),
258
- transition: (id, payload, opts) => adminEmbed("PATCH", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}`), opts.accessToken, payload, opts.signal),
259
- getAnnotations: (id, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}/annotations`), opts.accessToken, void 0, opts.signal),
260
- addNote: (id, payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}/notes`), opts.accessToken, payload, opts.signal),
261
- setTags: (id, payload, opts) => adminEmbed("PUT", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}/tags`), opts.accessToken, payload, opts.signal),
262
- setScore: (id, payload, opts) => adminEmbed("PUT", buildEmbedUrl(this.embedBaseUrl, `/admin/applications/${encodeURIComponent(id)}/scores`), opts.accessToken, payload, opts.signal)
394
+ /**
395
+ * Get application audit timeline (PLA-712). Requires admin Bearer token.
396
+ *
397
+ * @deprecated The embed handler for this method never existed — calls
398
+ * always 404'd (see PLA-1199). Retained as a compile-time compatibility
399
+ * surface for published-consumer code; delegates to the canonical
400
+ * `GET /api/v1/audit/application-logs?applicationId=` (ADR-054), which
401
+ * reads the same `application_audit_logs` table. The `accessToken`
402
+ * argument is accepted but unused — the v1 surface authenticates with
403
+ * the org API key (`audit:read` scope) instead of an admin JWT. Remove
404
+ * in the next major version.
405
+ */
406
+ history: async (id, opts) => {
407
+ const rows = [];
408
+ let cursor = null;
409
+ do {
410
+ const page = await request(buildUrl(this.baseUrl, "/audit/application-logs", {
411
+ applicationId: id,
412
+ limit: 100,
413
+ ...cursor ? { cursor } : {}
414
+ }), this.auth, opts?.signal);
415
+ rows.push(...page.data);
416
+ cursor = page.nextCursor;
417
+ } while (cursor);
418
+ return { events: rows.map((row) => ({
419
+ id: row.id,
420
+ applicationId: row.applicationId,
421
+ actorId: row.actorUserId,
422
+ actorName: null,
423
+ type: row.action === "status_changed" ? "status_change" : row.action,
424
+ timestamp: row.createdAt ?? "",
425
+ metadata: row.details ?? void 0
426
+ })) };
427
+ },
428
+ transition: (id, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PATCH", `/applications/${encodeURIComponent(id)}`, `/admin/applications/${encodeURIComponent(id)}`, accessToken, payload, signal))(this.adminAccess(opts)),
429
+ getAnnotations: (id, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/applications/${encodeURIComponent(id)}/annotations`, `/admin/applications/${encodeURIComponent(id)}/annotations`, accessToken, void 0, signal))(this.adminAccess(opts)),
430
+ addNote: (id, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", `/applications/${encodeURIComponent(id)}/notes`, `/admin/applications/${encodeURIComponent(id)}/notes`, accessToken, payload, signal))(this.adminAccess(opts)),
431
+ setTags: (id, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PUT", `/applications/${encodeURIComponent(id)}/tags`, `/admin/applications/${encodeURIComponent(id)}/tags`, accessToken, payload, signal))(this.adminAccess(opts)),
432
+ setScore: (id, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PUT", `/applications/${encodeURIComponent(id)}/scores`, `/admin/applications/${encodeURIComponent(id)}/scores`, accessToken, payload, signal))(this.adminAccess(opts))
263
433
  },
264
434
  givebutter: { campaigns: {
265
- list: (opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, "/admin/givebutter/campaigns"), opts.accessToken, void 0, opts.signal),
435
+ list: (opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", "/givebutter/campaigns", "/admin/givebutter/campaigns", accessToken, void 0, signal))(this.adminAccess(opts)),
266
436
  discountCodes: {
267
- list: (campaignId, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/givebutter/campaigns/${campaignId}/discount-codes`), opts.accessToken, void 0, opts.signal),
268
- create: (campaignId, payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, `/admin/givebutter/campaigns/${campaignId}/discount-codes`), opts.accessToken, payload, opts.signal)
437
+ list: (campaignId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/givebutter/campaigns/${campaignId}/discount-codes`, `/admin/givebutter/campaigns/${campaignId}/discount-codes`, accessToken, void 0, signal))(this.adminAccess(opts)),
438
+ create: (campaignId, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", `/givebutter/campaigns/${campaignId}/discount-codes`, `/admin/givebutter/campaigns/${campaignId}/discount-codes`, accessToken, payload, signal))(this.adminAccess(opts))
269
439
  },
270
- tickets: { create: (campaignId, payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, `/admin/givebutter/campaigns/${campaignId}/tickets`), opts.accessToken, payload, opts.signal) }
440
+ tickets: { create: (campaignId, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", `/givebutter/campaigns/${campaignId}/tickets`, `/admin/givebutter/campaigns/${campaignId}/tickets`, accessToken, payload, signal))(this.adminAccess(opts)) }
271
441
  } },
272
442
  members: {
273
- create: (payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, "/admin/members"), opts.accessToken, payload, opts.signal),
274
- update: (id, patch, opts) => adminEmbed("PATCH", buildEmbedUrl(this.embedBaseUrl, `/admin/members/${encodeURIComponent(id)}`), opts.accessToken, patch, opts.signal),
275
- deactivate: (id, opts) => adminEmbed("PATCH", buildEmbedUrl(this.embedBaseUrl, `/admin/members/${encodeURIComponent(id)}`), opts.accessToken, { status: "inactive" }, opts.signal)
443
+ create: (payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", "/members", "/admin/members", accessToken, payload, signal))(this.adminAccess(opts)),
444
+ update: (id, patch, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PATCH", `/members/${encodeURIComponent(id)}`, `/admin/members/${encodeURIComponent(id)}`, accessToken, patch, signal))(this.adminAccess(opts)),
445
+ deactivate: (id, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PATCH", `/members/${encodeURIComponent(id)}`, `/admin/members/${encodeURIComponent(id)}`, accessToken, { status: "inactive" }, signal))(this.adminAccess(opts))
276
446
  },
277
447
  announcements: {
278
448
  /** Send an email blast to camp members (PLA-706). Requires admin Bearer token. */
279
- send: (payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, "/admin/announcements/send"), opts.accessToken, payload, opts.signal) },
449
+ send: (payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", "/announcements/send", "/admin/announcements/send", accessToken, payload, signal))(this.adminAccess(opts)) },
280
450
  dues: {
281
451
  /** Create a manual dues/payment record (PLA-708). Requires admin Bearer token. */
282
- create: (payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, "/admin/dues"), opts.accessToken, payload, opts.signal),
452
+ create: (payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", "/dues", "/admin/dues", accessToken, payload, signal))(this.adminAccess(opts)),
283
453
  /** Update a dues/payment record (PLA-708). Requires admin Bearer token. */
284
- update: (id, payload, opts) => adminEmbed("PATCH", buildEmbedUrl(this.embedBaseUrl, `/admin/dues/${encodeURIComponent(id)}`), opts.accessToken, payload, opts.signal)
454
+ update: (id, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PATCH", `/dues/${encodeURIComponent(id)}`, `/admin/dues/${encodeURIComponent(id)}`, accessToken, payload, signal))(this.adminAccess(opts))
285
455
  },
286
456
  org: {
287
457
  /** Update camp configuration settings (PLA-709). Requires admin Bearer token. */
288
- update: (payload, opts) => adminEmbed("PATCH", buildEmbedUrl(this.embedBaseUrl, "/admin/org"), opts.accessToken, payload, opts.signal) },
458
+ update: (payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PATCH", "/org", "/admin/org", accessToken, payload, signal))(this.adminAccess(opts)) },
289
459
  scheduling: {
290
460
  availability: {
291
461
  /** Get interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
292
- get: (interviewerId, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/availability/${encodeURIComponent(interviewerId)}`), opts.accessToken, void 0, opts.signal),
462
+ get: (interviewerId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/scheduling/availability/${encodeURIComponent(interviewerId)}`, `/admin/scheduling/availability/${encodeURIComponent(interviewerId)}`, accessToken, void 0, signal))(this.adminAccess(opts)),
293
463
  /** Set interview availability for an interviewer (PLA-713). Requires admin Bearer token. */
294
- set: (interviewerId, payload, opts) => adminEmbed("PUT", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/availability/${encodeURIComponent(interviewerId)}`), opts.accessToken, payload, opts.signal)
464
+ set: (interviewerId, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PUT", `/scheduling/availability/${encodeURIComponent(interviewerId)}`, `/admin/scheduling/availability/${encodeURIComponent(interviewerId)}`, accessToken, payload, signal))(this.adminAccess(opts))
295
465
  },
296
466
  calendar: {
297
467
  /** Get Google Calendar connection status for an interviewer (PLA-726). Requires admin Bearer. */
298
- status: (interviewerId, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/status`), opts.accessToken, void 0, opts.signal),
468
+ status: (interviewerId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/scheduling/calendar/${encodeURIComponent(interviewerId)}/status`, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/status`, accessToken, void 0, signal))(this.adminAccess(opts)),
299
469
  /** List available Google Calendars (PLA-726). Requires admin Bearer. */
300
- listCalendars: (interviewerId, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/calendars`), opts.accessToken, void 0, opts.signal),
470
+ listCalendars: (interviewerId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/scheduling/calendar/${encodeURIComponent(interviewerId)}/calendars`, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/calendars`, accessToken, void 0, signal))(this.adminAccess(opts)),
301
471
  /** Select which Google Calendar to use (PLA-726). Requires admin Bearer. */
302
- select: (interviewerId, payload, opts) => adminEmbed("PUT", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/select`), opts.accessToken, payload, opts.signal),
472
+ select: (interviewerId, payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("PUT", `/scheduling/calendar/${encodeURIComponent(interviewerId)}/select`, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/select`, accessToken, payload, signal))(this.adminAccess(opts)),
303
473
  /** Disconnect Google Calendar from interviewer (PLA-726). Requires admin Bearer. */
304
- disconnect: (interviewerId, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/disconnect`), opts.accessToken, void 0, opts.signal)
474
+ disconnect: (interviewerId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", `/scheduling/calendar/${encodeURIComponent(interviewerId)}/disconnect`, `/admin/scheduling/calendar/${encodeURIComponent(interviewerId)}/disconnect`, accessToken, void 0, signal))(this.adminAccess(opts))
305
475
  },
306
476
  bookingTokens: {
307
477
  /** Create a booking token for an application's interview link (PLA-714). Requires admin Bearer token. */
308
- create: (payload, opts) => adminEmbed("POST", buildEmbedUrl(this.embedBaseUrl, "/admin/booking-tokens"), opts.accessToken, payload, opts.signal),
478
+ create: (payload, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("POST", "/booking-tokens", "/admin/booking-tokens", accessToken, payload, signal))(this.adminAccess(opts)),
309
479
  /** Get an existing booking token for an application (PLA-714). Requires admin Bearer token. */
310
- get: (applicationId, opts) => adminEmbed("GET", buildEmbedUrl(this.embedBaseUrl, `/admin/booking-tokens/${encodeURIComponent(applicationId)}`), opts.accessToken, void 0, opts.signal)
480
+ get: (applicationId, opts) => (({ accessToken, signal }) => this.adminV1OrEmbed("GET", `/booking-tokens/${encodeURIComponent(applicationId)}`, `/admin/booking-tokens/${encodeURIComponent(applicationId)}`, accessToken, void 0, signal))(this.adminAccess(opts))
311
481
  }
312
482
  }
313
483
  };