@roarkanalytics/sdk 6.2.0 → 7.1.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/client.d.mts +9 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +9 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +9 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +9 -0
  9. package/client.mjs.map +1 -1
  10. package/lib/config.d.mts +12 -0
  11. package/lib/config.d.mts.map +1 -1
  12. package/lib/config.d.ts +12 -0
  13. package/lib/config.d.ts.map +1 -1
  14. package/lib/config.js +11 -1
  15. package/lib/config.js.map +1 -1
  16. package/lib/config.mjs +9 -0
  17. package/lib/config.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/calendar-connection.d.mts +897 -0
  20. package/resources/calendar-connection.d.mts.map +1 -0
  21. package/resources/calendar-connection.d.ts +897 -0
  22. package/resources/calendar-connection.d.ts.map +1 -0
  23. package/resources/calendar-connection.js +143 -0
  24. package/resources/calendar-connection.js.map +1 -0
  25. package/resources/calendar-connection.mjs +139 -0
  26. package/resources/calendar-connection.mjs.map +1 -0
  27. package/resources/call.d.mts +2 -0
  28. package/resources/call.d.mts.map +1 -1
  29. package/resources/call.d.ts +2 -0
  30. package/resources/call.d.ts.map +1 -1
  31. package/resources/config.d.mts +508 -27
  32. package/resources/config.d.mts.map +1 -1
  33. package/resources/config.d.ts +508 -27
  34. package/resources/config.d.ts.map +1 -1
  35. package/resources/customer-flow.d.mts +49 -9
  36. package/resources/customer-flow.d.mts.map +1 -1
  37. package/resources/customer-flow.d.ts +49 -9
  38. package/resources/customer-flow.d.ts.map +1 -1
  39. package/resources/http-request-definition.d.mts +4 -4
  40. package/resources/http-request-definition.d.mts.map +1 -1
  41. package/resources/http-request-definition.d.ts +4 -4
  42. package/resources/http-request-definition.d.ts.map +1 -1
  43. package/resources/index.d.mts +3 -0
  44. package/resources/index.d.mts.map +1 -1
  45. package/resources/index.d.ts +3 -0
  46. package/resources/index.d.ts.map +1 -1
  47. package/resources/index.js +7 -1
  48. package/resources/index.js.map +1 -1
  49. package/resources/index.mjs +3 -0
  50. package/resources/index.mjs.map +1 -1
  51. package/resources/metric-variant.d.mts +6 -0
  52. package/resources/metric-variant.d.mts.map +1 -1
  53. package/resources/metric-variant.d.ts +6 -0
  54. package/resources/metric-variant.d.ts.map +1 -1
  55. package/resources/metric.d.mts +93 -0
  56. package/resources/metric.d.mts.map +1 -1
  57. package/resources/metric.d.ts +93 -0
  58. package/resources/metric.d.ts.map +1 -1
  59. package/resources/simulation-audio-clip.d.mts +44 -0
  60. package/resources/simulation-audio-clip.d.mts.map +1 -0
  61. package/resources/simulation-audio-clip.d.ts +44 -0
  62. package/resources/simulation-audio-clip.d.ts.map +1 -0
  63. package/resources/simulation-audio-clip.js +23 -0
  64. package/resources/simulation-audio-clip.js.map +1 -0
  65. package/resources/simulation-audio-clip.mjs +19 -0
  66. package/resources/simulation-audio-clip.mjs.map +1 -0
  67. package/resources/tool.d.mts +671 -0
  68. package/resources/tool.d.mts.map +1 -0
  69. package/resources/tool.d.ts +671 -0
  70. package/resources/tool.d.ts.map +1 -0
  71. package/resources/tool.js +83 -0
  72. package/resources/tool.js.map +1 -0
  73. package/resources/tool.mjs +79 -0
  74. package/resources/tool.mjs.map +1 -0
  75. package/src/client.ts +66 -0
  76. package/src/lib/config.ts +22 -0
  77. package/src/resources/calendar-connection.ts +1103 -0
  78. package/src/resources/call.ts +4 -0
  79. package/src/resources/config.ts +948 -22
  80. package/src/resources/customer-flow.ts +79 -11
  81. package/src/resources/http-request-definition.ts +4 -4
  82. package/src/resources/index.ts +27 -0
  83. package/src/resources/metric-variant.ts +7 -0
  84. package/src/resources/metric.ts +111 -0
  85. package/src/resources/simulation-audio-clip.ts +63 -0
  86. package/src/resources/tool.ts +884 -0
  87. package/src/version.ts +1 -1
  88. package/version.d.mts +1 -1
  89. package/version.d.ts +1 -1
  90. package/version.js +1 -1
  91. package/version.mjs +1 -1
@@ -0,0 +1,1103 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class CalendarConnection extends APIResource {
9
+ /**
10
+ * Verifies the credential against the provider and, only if it works, stores it
11
+ * encrypted. A credential the provider rejects is a 400 and no connection is
12
+ * created: a connection that has never worked would next be exercised by an
13
+ * inbound call at 2am, with nobody there to fix it.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const calendarConnection =
18
+ * await client.calendarConnection.create({
19
+ * apiKey: 'x',
20
+ * label: 'x',
21
+ * provider: 'CAL_COM',
22
+ * });
23
+ * ```
24
+ */
25
+ create(
26
+ body: CalendarConnectionCreateParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<CalendarConnectionCreateResponse> {
29
+ return this._client.post('/v1/calendar-connection', { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * Renames a connection, changes the timezone slots are offered in, or rotates the
34
+ * credential. A rotated credential is verified first, and a verified credential
35
+ * returns the connection to ACTIVE.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const calendarConnection =
40
+ * await client.calendarConnection.update('connectionId');
41
+ * ```
42
+ */
43
+ update(
44
+ connectionID: string,
45
+ body: CalendarConnectionUpdateParams | null | undefined = {},
46
+ options?: RequestOptions,
47
+ ): APIPromise<CalendarConnectionUpdateResponse> {
48
+ return this._client.patch(path`/v1/calendar-connection/${connectionID}`, { body, ...options });
49
+ }
50
+
51
+ /**
52
+ * Returns every calendar connection in the authenticated project, by label. A
53
+ * project has a handful of these, so the list is not paginated:
54
+ * `pagination.hasMore` is always false.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const calendarConnections =
59
+ * await client.calendarConnection.list();
60
+ * ```
61
+ */
62
+ list(
63
+ query: CalendarConnectionListParams | null | undefined = {},
64
+ options?: RequestOptions,
65
+ ): APIPromise<CalendarConnectionListResponse> {
66
+ return this._client.get('/v1/calendar-connection', { query, ...options });
67
+ }
68
+
69
+ /**
70
+ * Disconnects the calendar and destroys the stored credential. A credential the
71
+ * customer deleted should stop existing, so this is not an archive. Appointments
72
+ * already recorded against the connection are kept, so a booking stays explainable
73
+ * after the calendar is disconnected. Refused with a 409 while a calendar tool is
74
+ * still bound to the connection, naming the tools: point them at another calendar,
75
+ * or delete them, first. A dangling binding would otherwise be found by whoever
76
+ * next tried to ship the agent, who is not the person who disconnected the
77
+ * calendar.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const calendarConnection =
82
+ * await client.calendarConnection.delete('connectionId');
83
+ * ```
84
+ */
85
+ delete(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionDeleteResponse> {
86
+ return this._client.delete(path`/v1/calendar-connection/${connectionID}`, options);
87
+ }
88
+
89
+ /**
90
+ * Re-verifies the stored credential against the provider and records the result on
91
+ * the connection. A credential the provider rejects sets `status` to
92
+ * INVALID_CREDENTIALS. A provider outage is a 500 and leaves the status untouched:
93
+ * being unable to reach the provider is not evidence that the customer’s
94
+ * credential is bad.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const response =
99
+ * await client.calendarConnection.check('connectionId');
100
+ * ```
101
+ */
102
+ check(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionCheckResponse> {
103
+ return this._client.post(path`/v1/calendar-connection/${connectionID}/check`, options);
104
+ }
105
+
106
+ /**
107
+ * Returns one calendar connection. The stored credential is never included.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const response =
112
+ * await client.calendarConnection.getByID('connectionId');
113
+ * ```
114
+ */
115
+ getByID(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionGetByIDResponse> {
116
+ return this._client.get(path`/v1/calendar-connection/${connectionID}`, options);
117
+ }
118
+
119
+ /**
120
+ * The same entry as the list, plus what it demands of a booker.
121
+ * `requiresAttendeeEmail` is the field that decides an agent’s design: the
122
+ * attendee object itself needs only a name and a timezone, but an event type can
123
+ * declare email required, and an agent that cannot collect one simply cannot book
124
+ * on it. Read this when configuring a calendar tool, not after a caller is already
125
+ * waiting. Costs one provider call more than the list, which is why the list does
126
+ * not fold it in.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * const response = await client.calendarConnection.getTarget(
131
+ * 'targetId',
132
+ * { connectionId: 'connectionId' },
133
+ * );
134
+ * ```
135
+ */
136
+ getTarget(
137
+ targetID: string,
138
+ params: CalendarConnectionGetTargetParams,
139
+ options?: RequestOptions,
140
+ ): APIPromise<CalendarConnectionGetTargetResponse> {
141
+ const { connectionId } = params;
142
+ return this._client.get(path`/v1/calendar-connection/${connectionId}/targets/${targetID}`, options);
143
+ }
144
+
145
+ /**
146
+ * What an agent can be pointed at on this connection: Cal.com event types today,
147
+ * Google calendars when that lands. Read live from the provider, so an event type
148
+ * added since you connected is here without reconnecting. Each entry carries a
149
+ * `target` ready to put on a calendar tool, so nothing has to assemble one by
150
+ * hand.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * const response =
155
+ * await client.calendarConnection.listTargets(
156
+ * 'connectionId',
157
+ * );
158
+ * ```
159
+ */
160
+ listTargets(
161
+ connectionID: string,
162
+ options?: RequestOptions,
163
+ ): APIPromise<CalendarConnectionListTargetsResponse> {
164
+ return this._client.get(path`/v1/calendar-connection/${connectionID}/targets`, options);
165
+ }
166
+ }
167
+
168
+ export interface CalendarConnectionCreateResponse {
169
+ /**
170
+ * A project’s credential for one calendar account, the thing a calendar tool books
171
+ * against. The credential itself is never returned.
172
+ */
173
+ data: CalendarConnectionCreateResponse.Data;
174
+ }
175
+
176
+ export namespace CalendarConnectionCreateResponse {
177
+ /**
178
+ * A project’s credential for one calendar account, the thing a calendar tool books
179
+ * against. The credential itself is never returned.
180
+ */
181
+ export interface Data {
182
+ /**
183
+ * Unique identifier of the calendar connection.
184
+ */
185
+ id: string;
186
+
187
+ /**
188
+ * How the provider names the connected account (a Cal.com email). Read-only.
189
+ */
190
+ accountLabel: string | null;
191
+
192
+ /**
193
+ * What a calendar provider can actually do. Read this before configuring a
194
+ * calendar tool.
195
+ */
196
+ capabilities: Data.Capabilities;
197
+
198
+ /**
199
+ * Creation timestamp in ISO 8601 format.
200
+ */
201
+ createdAt: string;
202
+
203
+ /**
204
+ * When the credential expires, ISO 8601. Null when it does not expire.
205
+ */
206
+ credentialExpiresAt: string | null;
207
+
208
+ /**
209
+ * Customer-supplied name for this account. Unique within the project.
210
+ */
211
+ label: string;
212
+
213
+ /**
214
+ * When the credential was last verified against the provider, ISO 8601.
215
+ */
216
+ lastCheckedAt: string | null;
217
+
218
+ /**
219
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
220
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
221
+ * connectable.
222
+ */
223
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
224
+
225
+ /**
226
+ * Scopes the credential carries, when the provider issues scoped credentials. Null
227
+ * for an API key.
228
+ */
229
+ scopes: Array<string> | null;
230
+
231
+ /**
232
+ * Whether the stored credential still works, as of `lastCheckedAt`.
233
+ * INVALID_CREDENTIALS means the provider rejected it and the connection needs a
234
+ * new one. A provider outage never changes this.
235
+ */
236
+ status: 'ACTIVE' | 'INVALID_CREDENTIALS' | 'ERROR';
237
+
238
+ /**
239
+ * Why the status is not ACTIVE, in the provider’s words. Null when ACTIVE.
240
+ */
241
+ statusMessage: string | null;
242
+
243
+ /**
244
+ * The IANA timezone slots are offered in: the business’s, not the caller’s. A
245
+ * clinic’s 3pm is 3pm whoever dials it.
246
+ */
247
+ timezone: string;
248
+
249
+ /**
250
+ * Last update timestamp in ISO 8601 format.
251
+ */
252
+ updatedAt: string;
253
+ }
254
+
255
+ export namespace Data {
256
+ /**
257
+ * What a calendar provider can actually do. Read this before configuring a
258
+ * calendar tool.
259
+ */
260
+ export interface Capabilities {
261
+ /**
262
+ * How this provider is authenticated.
263
+ */
264
+ auth: 'API_KEY' | 'OAUTH';
265
+
266
+ /**
267
+ * Hard cap on the width of one availability query, in days, when the provider has
268
+ * one.
269
+ */
270
+ availabilityWindowDays: number | null;
271
+
272
+ /**
273
+ * The operations this provider supports. An operation that is absent is never
274
+ * registered as a tool, so the agent cannot promise it: Calendly, for example, has
275
+ * no reschedule API, and callers wanting to move an appointment must cancel and
276
+ * rebook.
277
+ */
278
+ operations: Array<
279
+ 'CHECK_AVAILABILITY' | 'BOOK' | 'LOOKUP_BOOKING' | 'RESCHEDULE' | 'CANCEL' | 'LIST_BOOKINGS'
280
+ >;
281
+
282
+ /**
283
+ * Whether a booking cannot be created without an attendee email address. True for
284
+ * every scheduling system, which decides how an agent has to identify the caller.
285
+ */
286
+ requiresAttendeeEmail: boolean;
287
+
288
+ /**
289
+ * True for a raw calendar, which exposes only events and free/busy. Roark then
290
+ * owns bookable hours, duration, buffers, lead time and horizon, because the
291
+ * provider has no notion of them.
292
+ */
293
+ roarkOwnsBookingPolicy: boolean;
294
+
295
+ /**
296
+ * Whether a slot can be held before committing. RESERVATION blocks other bookers
297
+ * in the provider’s own UI but is not consumed by the booking that follows, so it
298
+ * is a courtesy and not a guarantee.
299
+ */
300
+ slotHold: 'RESERVATION' | 'NONE';
301
+ }
302
+ }
303
+ }
304
+
305
+ export interface CalendarConnectionUpdateResponse {
306
+ /**
307
+ * A project’s credential for one calendar account, the thing a calendar tool books
308
+ * against. The credential itself is never returned.
309
+ */
310
+ data: CalendarConnectionUpdateResponse.Data;
311
+ }
312
+
313
+ export namespace CalendarConnectionUpdateResponse {
314
+ /**
315
+ * A project’s credential for one calendar account, the thing a calendar tool books
316
+ * against. The credential itself is never returned.
317
+ */
318
+ export interface Data {
319
+ /**
320
+ * Unique identifier of the calendar connection.
321
+ */
322
+ id: string;
323
+
324
+ /**
325
+ * How the provider names the connected account (a Cal.com email). Read-only.
326
+ */
327
+ accountLabel: string | null;
328
+
329
+ /**
330
+ * What a calendar provider can actually do. Read this before configuring a
331
+ * calendar tool.
332
+ */
333
+ capabilities: Data.Capabilities;
334
+
335
+ /**
336
+ * Creation timestamp in ISO 8601 format.
337
+ */
338
+ createdAt: string;
339
+
340
+ /**
341
+ * When the credential expires, ISO 8601. Null when it does not expire.
342
+ */
343
+ credentialExpiresAt: string | null;
344
+
345
+ /**
346
+ * Customer-supplied name for this account. Unique within the project.
347
+ */
348
+ label: string;
349
+
350
+ /**
351
+ * When the credential was last verified against the provider, ISO 8601.
352
+ */
353
+ lastCheckedAt: string | null;
354
+
355
+ /**
356
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
357
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
358
+ * connectable.
359
+ */
360
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
361
+
362
+ /**
363
+ * Scopes the credential carries, when the provider issues scoped credentials. Null
364
+ * for an API key.
365
+ */
366
+ scopes: Array<string> | null;
367
+
368
+ /**
369
+ * Whether the stored credential still works, as of `lastCheckedAt`.
370
+ * INVALID_CREDENTIALS means the provider rejected it and the connection needs a
371
+ * new one. A provider outage never changes this.
372
+ */
373
+ status: 'ACTIVE' | 'INVALID_CREDENTIALS' | 'ERROR';
374
+
375
+ /**
376
+ * Why the status is not ACTIVE, in the provider’s words. Null when ACTIVE.
377
+ */
378
+ statusMessage: string | null;
379
+
380
+ /**
381
+ * The IANA timezone slots are offered in: the business’s, not the caller’s. A
382
+ * clinic’s 3pm is 3pm whoever dials it.
383
+ */
384
+ timezone: string;
385
+
386
+ /**
387
+ * Last update timestamp in ISO 8601 format.
388
+ */
389
+ updatedAt: string;
390
+ }
391
+
392
+ export namespace Data {
393
+ /**
394
+ * What a calendar provider can actually do. Read this before configuring a
395
+ * calendar tool.
396
+ */
397
+ export interface Capabilities {
398
+ /**
399
+ * How this provider is authenticated.
400
+ */
401
+ auth: 'API_KEY' | 'OAUTH';
402
+
403
+ /**
404
+ * Hard cap on the width of one availability query, in days, when the provider has
405
+ * one.
406
+ */
407
+ availabilityWindowDays: number | null;
408
+
409
+ /**
410
+ * The operations this provider supports. An operation that is absent is never
411
+ * registered as a tool, so the agent cannot promise it: Calendly, for example, has
412
+ * no reschedule API, and callers wanting to move an appointment must cancel and
413
+ * rebook.
414
+ */
415
+ operations: Array<
416
+ 'CHECK_AVAILABILITY' | 'BOOK' | 'LOOKUP_BOOKING' | 'RESCHEDULE' | 'CANCEL' | 'LIST_BOOKINGS'
417
+ >;
418
+
419
+ /**
420
+ * Whether a booking cannot be created without an attendee email address. True for
421
+ * every scheduling system, which decides how an agent has to identify the caller.
422
+ */
423
+ requiresAttendeeEmail: boolean;
424
+
425
+ /**
426
+ * True for a raw calendar, which exposes only events and free/busy. Roark then
427
+ * owns bookable hours, duration, buffers, lead time and horizon, because the
428
+ * provider has no notion of them.
429
+ */
430
+ roarkOwnsBookingPolicy: boolean;
431
+
432
+ /**
433
+ * Whether a slot can be held before committing. RESERVATION blocks other bookers
434
+ * in the provider’s own UI but is not consumed by the booking that follows, so it
435
+ * is a courtesy and not a guarantee.
436
+ */
437
+ slotHold: 'RESERVATION' | 'NONE';
438
+ }
439
+ }
440
+ }
441
+
442
+ export interface CalendarConnectionListResponse {
443
+ data: Array<CalendarConnectionListResponse.Data>;
444
+
445
+ pagination: CalendarConnectionListResponse.Pagination;
446
+ }
447
+
448
+ export namespace CalendarConnectionListResponse {
449
+ /**
450
+ * A project’s credential for one calendar account, the thing a calendar tool books
451
+ * against. The credential itself is never returned.
452
+ */
453
+ export interface Data {
454
+ /**
455
+ * Unique identifier of the calendar connection.
456
+ */
457
+ id: string;
458
+
459
+ /**
460
+ * How the provider names the connected account (a Cal.com email). Read-only.
461
+ */
462
+ accountLabel: string | null;
463
+
464
+ /**
465
+ * What a calendar provider can actually do. Read this before configuring a
466
+ * calendar tool.
467
+ */
468
+ capabilities: Data.Capabilities;
469
+
470
+ /**
471
+ * Creation timestamp in ISO 8601 format.
472
+ */
473
+ createdAt: string;
474
+
475
+ /**
476
+ * When the credential expires, ISO 8601. Null when it does not expire.
477
+ */
478
+ credentialExpiresAt: string | null;
479
+
480
+ /**
481
+ * Customer-supplied name for this account. Unique within the project.
482
+ */
483
+ label: string;
484
+
485
+ /**
486
+ * When the credential was last verified against the provider, ISO 8601.
487
+ */
488
+ lastCheckedAt: string | null;
489
+
490
+ /**
491
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
492
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
493
+ * connectable.
494
+ */
495
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
496
+
497
+ /**
498
+ * Scopes the credential carries, when the provider issues scoped credentials. Null
499
+ * for an API key.
500
+ */
501
+ scopes: Array<string> | null;
502
+
503
+ /**
504
+ * Whether the stored credential still works, as of `lastCheckedAt`.
505
+ * INVALID_CREDENTIALS means the provider rejected it and the connection needs a
506
+ * new one. A provider outage never changes this.
507
+ */
508
+ status: 'ACTIVE' | 'INVALID_CREDENTIALS' | 'ERROR';
509
+
510
+ /**
511
+ * Why the status is not ACTIVE, in the provider’s words. Null when ACTIVE.
512
+ */
513
+ statusMessage: string | null;
514
+
515
+ /**
516
+ * The IANA timezone slots are offered in: the business’s, not the caller’s. A
517
+ * clinic’s 3pm is 3pm whoever dials it.
518
+ */
519
+ timezone: string;
520
+
521
+ /**
522
+ * Last update timestamp in ISO 8601 format.
523
+ */
524
+ updatedAt: string;
525
+ }
526
+
527
+ export namespace Data {
528
+ /**
529
+ * What a calendar provider can actually do. Read this before configuring a
530
+ * calendar tool.
531
+ */
532
+ export interface Capabilities {
533
+ /**
534
+ * How this provider is authenticated.
535
+ */
536
+ auth: 'API_KEY' | 'OAUTH';
537
+
538
+ /**
539
+ * Hard cap on the width of one availability query, in days, when the provider has
540
+ * one.
541
+ */
542
+ availabilityWindowDays: number | null;
543
+
544
+ /**
545
+ * The operations this provider supports. An operation that is absent is never
546
+ * registered as a tool, so the agent cannot promise it: Calendly, for example, has
547
+ * no reschedule API, and callers wanting to move an appointment must cancel and
548
+ * rebook.
549
+ */
550
+ operations: Array<
551
+ 'CHECK_AVAILABILITY' | 'BOOK' | 'LOOKUP_BOOKING' | 'RESCHEDULE' | 'CANCEL' | 'LIST_BOOKINGS'
552
+ >;
553
+
554
+ /**
555
+ * Whether a booking cannot be created without an attendee email address. True for
556
+ * every scheduling system, which decides how an agent has to identify the caller.
557
+ */
558
+ requiresAttendeeEmail: boolean;
559
+
560
+ /**
561
+ * True for a raw calendar, which exposes only events and free/busy. Roark then
562
+ * owns bookable hours, duration, buffers, lead time and horizon, because the
563
+ * provider has no notion of them.
564
+ */
565
+ roarkOwnsBookingPolicy: boolean;
566
+
567
+ /**
568
+ * Whether a slot can be held before committing. RESERVATION blocks other bookers
569
+ * in the provider’s own UI but is not consumed by the booking that follows, so it
570
+ * is a courtesy and not a guarantee.
571
+ */
572
+ slotHold: 'RESERVATION' | 'NONE';
573
+ }
574
+ }
575
+
576
+ export interface Pagination {
577
+ /**
578
+ * Whether there are more items to fetch
579
+ */
580
+ hasMore: boolean;
581
+
582
+ /**
583
+ * Cursor for the next page of items
584
+ */
585
+ nextCursor: string | null;
586
+
587
+ /**
588
+ * Total number of items
589
+ */
590
+ total: number;
591
+ }
592
+ }
593
+
594
+ export interface CalendarConnectionDeleteResponse {
595
+ data: CalendarConnectionDeleteResponse.Data;
596
+ }
597
+
598
+ export namespace CalendarConnectionDeleteResponse {
599
+ export interface Data {
600
+ /**
601
+ * Identifier of the deleted connection.
602
+ */
603
+ id: string;
604
+
605
+ /**
606
+ * Always true. The credential is hard-deleted, not archived.
607
+ */
608
+ deleted: true;
609
+ }
610
+ }
611
+
612
+ export interface CalendarConnectionCheckResponse {
613
+ /**
614
+ * A project’s credential for one calendar account, the thing a calendar tool books
615
+ * against. The credential itself is never returned.
616
+ */
617
+ data: CalendarConnectionCheckResponse.Data;
618
+ }
619
+
620
+ export namespace CalendarConnectionCheckResponse {
621
+ /**
622
+ * A project’s credential for one calendar account, the thing a calendar tool books
623
+ * against. The credential itself is never returned.
624
+ */
625
+ export interface Data {
626
+ /**
627
+ * Unique identifier of the calendar connection.
628
+ */
629
+ id: string;
630
+
631
+ /**
632
+ * How the provider names the connected account (a Cal.com email). Read-only.
633
+ */
634
+ accountLabel: string | null;
635
+
636
+ /**
637
+ * What a calendar provider can actually do. Read this before configuring a
638
+ * calendar tool.
639
+ */
640
+ capabilities: Data.Capabilities;
641
+
642
+ /**
643
+ * Creation timestamp in ISO 8601 format.
644
+ */
645
+ createdAt: string;
646
+
647
+ /**
648
+ * When the credential expires, ISO 8601. Null when it does not expire.
649
+ */
650
+ credentialExpiresAt: string | null;
651
+
652
+ /**
653
+ * Customer-supplied name for this account. Unique within the project.
654
+ */
655
+ label: string;
656
+
657
+ /**
658
+ * When the credential was last verified against the provider, ISO 8601.
659
+ */
660
+ lastCheckedAt: string | null;
661
+
662
+ /**
663
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
664
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
665
+ * connectable.
666
+ */
667
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
668
+
669
+ /**
670
+ * Scopes the credential carries, when the provider issues scoped credentials. Null
671
+ * for an API key.
672
+ */
673
+ scopes: Array<string> | null;
674
+
675
+ /**
676
+ * Whether the stored credential still works, as of `lastCheckedAt`.
677
+ * INVALID_CREDENTIALS means the provider rejected it and the connection needs a
678
+ * new one. A provider outage never changes this.
679
+ */
680
+ status: 'ACTIVE' | 'INVALID_CREDENTIALS' | 'ERROR';
681
+
682
+ /**
683
+ * Why the status is not ACTIVE, in the provider’s words. Null when ACTIVE.
684
+ */
685
+ statusMessage: string | null;
686
+
687
+ /**
688
+ * The IANA timezone slots are offered in: the business’s, not the caller’s. A
689
+ * clinic’s 3pm is 3pm whoever dials it.
690
+ */
691
+ timezone: string;
692
+
693
+ /**
694
+ * Last update timestamp in ISO 8601 format.
695
+ */
696
+ updatedAt: string;
697
+ }
698
+
699
+ export namespace Data {
700
+ /**
701
+ * What a calendar provider can actually do. Read this before configuring a
702
+ * calendar tool.
703
+ */
704
+ export interface Capabilities {
705
+ /**
706
+ * How this provider is authenticated.
707
+ */
708
+ auth: 'API_KEY' | 'OAUTH';
709
+
710
+ /**
711
+ * Hard cap on the width of one availability query, in days, when the provider has
712
+ * one.
713
+ */
714
+ availabilityWindowDays: number | null;
715
+
716
+ /**
717
+ * The operations this provider supports. An operation that is absent is never
718
+ * registered as a tool, so the agent cannot promise it: Calendly, for example, has
719
+ * no reschedule API, and callers wanting to move an appointment must cancel and
720
+ * rebook.
721
+ */
722
+ operations: Array<
723
+ 'CHECK_AVAILABILITY' | 'BOOK' | 'LOOKUP_BOOKING' | 'RESCHEDULE' | 'CANCEL' | 'LIST_BOOKINGS'
724
+ >;
725
+
726
+ /**
727
+ * Whether a booking cannot be created without an attendee email address. True for
728
+ * every scheduling system, which decides how an agent has to identify the caller.
729
+ */
730
+ requiresAttendeeEmail: boolean;
731
+
732
+ /**
733
+ * True for a raw calendar, which exposes only events and free/busy. Roark then
734
+ * owns bookable hours, duration, buffers, lead time and horizon, because the
735
+ * provider has no notion of them.
736
+ */
737
+ roarkOwnsBookingPolicy: boolean;
738
+
739
+ /**
740
+ * Whether a slot can be held before committing. RESERVATION blocks other bookers
741
+ * in the provider’s own UI but is not consumed by the booking that follows, so it
742
+ * is a courtesy and not a guarantee.
743
+ */
744
+ slotHold: 'RESERVATION' | 'NONE';
745
+ }
746
+ }
747
+ }
748
+
749
+ export interface CalendarConnectionGetByIDResponse {
750
+ /**
751
+ * A project’s credential for one calendar account, the thing a calendar tool books
752
+ * against. The credential itself is never returned.
753
+ */
754
+ data: CalendarConnectionGetByIDResponse.Data;
755
+ }
756
+
757
+ export namespace CalendarConnectionGetByIDResponse {
758
+ /**
759
+ * A project’s credential for one calendar account, the thing a calendar tool books
760
+ * against. The credential itself is never returned.
761
+ */
762
+ export interface Data {
763
+ /**
764
+ * Unique identifier of the calendar connection.
765
+ */
766
+ id: string;
767
+
768
+ /**
769
+ * How the provider names the connected account (a Cal.com email). Read-only.
770
+ */
771
+ accountLabel: string | null;
772
+
773
+ /**
774
+ * What a calendar provider can actually do. Read this before configuring a
775
+ * calendar tool.
776
+ */
777
+ capabilities: Data.Capabilities;
778
+
779
+ /**
780
+ * Creation timestamp in ISO 8601 format.
781
+ */
782
+ createdAt: string;
783
+
784
+ /**
785
+ * When the credential expires, ISO 8601. Null when it does not expire.
786
+ */
787
+ credentialExpiresAt: string | null;
788
+
789
+ /**
790
+ * Customer-supplied name for this account. Unique within the project.
791
+ */
792
+ label: string;
793
+
794
+ /**
795
+ * When the credential was last verified against the provider, ISO 8601.
796
+ */
797
+ lastCheckedAt: string | null;
798
+
799
+ /**
800
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
801
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
802
+ * connectable.
803
+ */
804
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
805
+
806
+ /**
807
+ * Scopes the credential carries, when the provider issues scoped credentials. Null
808
+ * for an API key.
809
+ */
810
+ scopes: Array<string> | null;
811
+
812
+ /**
813
+ * Whether the stored credential still works, as of `lastCheckedAt`.
814
+ * INVALID_CREDENTIALS means the provider rejected it and the connection needs a
815
+ * new one. A provider outage never changes this.
816
+ */
817
+ status: 'ACTIVE' | 'INVALID_CREDENTIALS' | 'ERROR';
818
+
819
+ /**
820
+ * Why the status is not ACTIVE, in the provider’s words. Null when ACTIVE.
821
+ */
822
+ statusMessage: string | null;
823
+
824
+ /**
825
+ * The IANA timezone slots are offered in: the business’s, not the caller’s. A
826
+ * clinic’s 3pm is 3pm whoever dials it.
827
+ */
828
+ timezone: string;
829
+
830
+ /**
831
+ * Last update timestamp in ISO 8601 format.
832
+ */
833
+ updatedAt: string;
834
+ }
835
+
836
+ export namespace Data {
837
+ /**
838
+ * What a calendar provider can actually do. Read this before configuring a
839
+ * calendar tool.
840
+ */
841
+ export interface Capabilities {
842
+ /**
843
+ * How this provider is authenticated.
844
+ */
845
+ auth: 'API_KEY' | 'OAUTH';
846
+
847
+ /**
848
+ * Hard cap on the width of one availability query, in days, when the provider has
849
+ * one.
850
+ */
851
+ availabilityWindowDays: number | null;
852
+
853
+ /**
854
+ * The operations this provider supports. An operation that is absent is never
855
+ * registered as a tool, so the agent cannot promise it: Calendly, for example, has
856
+ * no reschedule API, and callers wanting to move an appointment must cancel and
857
+ * rebook.
858
+ */
859
+ operations: Array<
860
+ 'CHECK_AVAILABILITY' | 'BOOK' | 'LOOKUP_BOOKING' | 'RESCHEDULE' | 'CANCEL' | 'LIST_BOOKINGS'
861
+ >;
862
+
863
+ /**
864
+ * Whether a booking cannot be created without an attendee email address. True for
865
+ * every scheduling system, which decides how an agent has to identify the caller.
866
+ */
867
+ requiresAttendeeEmail: boolean;
868
+
869
+ /**
870
+ * True for a raw calendar, which exposes only events and free/busy. Roark then
871
+ * owns bookable hours, duration, buffers, lead time and horizon, because the
872
+ * provider has no notion of them.
873
+ */
874
+ roarkOwnsBookingPolicy: boolean;
875
+
876
+ /**
877
+ * Whether a slot can be held before committing. RESERVATION blocks other bookers
878
+ * in the provider’s own UI but is not consumed by the booking that follows, so it
879
+ * is a courtesy and not a guarantee.
880
+ */
881
+ slotHold: 'RESERVATION' | 'NONE';
882
+ }
883
+ }
884
+ }
885
+
886
+ export interface CalendarConnectionGetTargetResponse {
887
+ /**
888
+ * Something on a connected account an agent can be pointed at: a Cal.com event
889
+ * type today, a Google calendar when that lands.
890
+ */
891
+ data: CalendarConnectionGetTargetResponse.Data;
892
+ }
893
+
894
+ export namespace CalendarConnectionGetTargetResponse {
895
+ /**
896
+ * Something on a connected account an agent can be pointed at: a Cal.com event
897
+ * type today, a Google calendar when that lands.
898
+ */
899
+ export interface Data {
900
+ /**
901
+ * Identifier within this connection. Pass it back to read one target in detail.
902
+ */
903
+ id: string;
904
+
905
+ /**
906
+ * How long an appointment runs, when the provider fixes one length.
907
+ */
908
+ durationMinutes: number | null;
909
+
910
+ /**
911
+ * Other lengths this target offers, when it offers a choice. A calendar tool pins
912
+ * one of these with `durationMinutes`; an empty list means the length is not the
913
+ * customer’s to choose.
914
+ */
915
+ durationOptions: Array<number>;
916
+
917
+ /**
918
+ * Hidden on the provider’s own booking page. Still bookable through this API.
919
+ */
920
+ isHidden: boolean;
921
+
922
+ /**
923
+ * What the customer called it on the provider.
924
+ */
925
+ label: string;
926
+
927
+ /**
928
+ * Slugs a booking is refused without, as the provider names them (`email`,
929
+ * `name`). The attendee object itself needs only a name and a timezone, so this is
930
+ * the only place that says whether an agent has to collect an email.
931
+ */
932
+ requiredBookingFields: Array<string>;
933
+
934
+ /**
935
+ * The common case of the above, lifted out because it decides the agent’s design:
936
+ * an agent that cannot collect an email cannot book on a target that demands one.
937
+ */
938
+ requiresAttendeeEmail: boolean;
939
+
940
+ /**
941
+ * A human has to accept before it is an appointment. An agent booking one of these
942
+ * must say "requested", never "confirmed".
943
+ */
944
+ requiresConfirmation: boolean;
945
+
946
+ /**
947
+ * Ready to put on a calendar tool, so nothing has to assemble one by hand.
948
+ */
949
+ target: Data.Target;
950
+ }
951
+
952
+ export namespace Data {
953
+ /**
954
+ * Ready to put on a calendar tool, so nothing has to assemble one by hand.
955
+ */
956
+ export interface Target {
957
+ eventTypeId: number;
958
+
959
+ provider: 'CAL_COM';
960
+ }
961
+ }
962
+ }
963
+
964
+ export interface CalendarConnectionListTargetsResponse {
965
+ data: Array<CalendarConnectionListTargetsResponse.Data>;
966
+ }
967
+
968
+ export namespace CalendarConnectionListTargetsResponse {
969
+ /**
970
+ * Something on a connected account an agent can be pointed at: a Cal.com event
971
+ * type today, a Google calendar when that lands.
972
+ */
973
+ export interface Data {
974
+ /**
975
+ * Identifier within this connection. Pass it back to read one target in detail.
976
+ */
977
+ id: string;
978
+
979
+ /**
980
+ * How long an appointment runs, when the provider fixes one length.
981
+ */
982
+ durationMinutes: number | null;
983
+
984
+ /**
985
+ * Other lengths this target offers, when it offers a choice. A calendar tool pins
986
+ * one of these with `durationMinutes`; an empty list means the length is not the
987
+ * customer’s to choose.
988
+ */
989
+ durationOptions: Array<number>;
990
+
991
+ /**
992
+ * Hidden on the provider’s own booking page. Still bookable through this API.
993
+ */
994
+ isHidden: boolean;
995
+
996
+ /**
997
+ * What the customer called it on the provider.
998
+ */
999
+ label: string;
1000
+
1001
+ /**
1002
+ * A human has to accept before it is an appointment. An agent booking one of these
1003
+ * must say "requested", never "confirmed".
1004
+ */
1005
+ requiresConfirmation: boolean;
1006
+
1007
+ /**
1008
+ * Ready to put on a calendar tool, so nothing has to assemble one by hand.
1009
+ */
1010
+ target: Data.Target;
1011
+ }
1012
+
1013
+ export namespace Data {
1014
+ /**
1015
+ * Ready to put on a calendar tool, so nothing has to assemble one by hand.
1016
+ */
1017
+ export interface Target {
1018
+ eventTypeId: number;
1019
+
1020
+ provider: 'CAL_COM';
1021
+ }
1022
+ }
1023
+ }
1024
+
1025
+ export interface CalendarConnectionCreateParams {
1026
+ /**
1027
+ * For CAL*COM: a Cal.com API key (starts with `cal*`). It is verified against
1028
+ * Cal.com before anything is stored, so an invalid key is a 400 and no connection
1029
+ * is created. Stored encrypted and never returned.
1030
+ */
1031
+ apiKey: string;
1032
+
1033
+ /**
1034
+ * Customer-facing name for this account, unique within the project. Required.
1035
+ */
1036
+ label: string;
1037
+
1038
+ /**
1039
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
1040
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
1041
+ * connectable.
1042
+ */
1043
+ provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
1044
+
1045
+ /**
1046
+ * The named IANA timezone to offer slots in, for example `America/Los_Angeles`.
1047
+ * Omit to adopt the provider account’s own timezone. A fixed offset such as
1048
+ * `-08:00` is rejected: it does not observe DST.
1049
+ */
1050
+ timezone?: string | null;
1051
+ }
1052
+
1053
+ export interface CalendarConnectionUpdateParams {
1054
+ /**
1055
+ * Rotate the credential. The new key is verified before it is stored, and a
1056
+ * verified key returns the connection to ACTIVE, which is how a connection
1057
+ * recovers from INVALID_CREDENTIALS.
1058
+ */
1059
+ apiKey?: string | null;
1060
+
1061
+ /**
1062
+ * Rename the connection.
1063
+ */
1064
+ label?: string | null;
1065
+
1066
+ /**
1067
+ * Change the named IANA timezone slots are offered in.
1068
+ */
1069
+ timezone?: string | null;
1070
+ }
1071
+
1072
+ export interface CalendarConnectionListParams {
1073
+ /**
1074
+ * Who holds the calendar. CAL_COM is the only provider that can be connected
1075
+ * today; GOOGLE and CALENDLY are described by `capabilities` but not yet
1076
+ * connectable.
1077
+ */
1078
+ provider?: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
1079
+ }
1080
+
1081
+ export interface CalendarConnectionGetTargetParams {
1082
+ /**
1083
+ * Calendar connection ID
1084
+ */
1085
+ connectionId: string;
1086
+ }
1087
+
1088
+ export declare namespace CalendarConnection {
1089
+ export {
1090
+ type CalendarConnectionCreateResponse as CalendarConnectionCreateResponse,
1091
+ type CalendarConnectionUpdateResponse as CalendarConnectionUpdateResponse,
1092
+ type CalendarConnectionListResponse as CalendarConnectionListResponse,
1093
+ type CalendarConnectionDeleteResponse as CalendarConnectionDeleteResponse,
1094
+ type CalendarConnectionCheckResponse as CalendarConnectionCheckResponse,
1095
+ type CalendarConnectionGetByIDResponse as CalendarConnectionGetByIDResponse,
1096
+ type CalendarConnectionGetTargetResponse as CalendarConnectionGetTargetResponse,
1097
+ type CalendarConnectionListTargetsResponse as CalendarConnectionListTargetsResponse,
1098
+ type CalendarConnectionCreateParams as CalendarConnectionCreateParams,
1099
+ type CalendarConnectionUpdateParams as CalendarConnectionUpdateParams,
1100
+ type CalendarConnectionListParams as CalendarConnectionListParams,
1101
+ type CalendarConnectionGetTargetParams as CalendarConnectionGetTargetParams,
1102
+ };
1103
+ }