@roarkanalytics/sdk 7.9.0 → 8.0.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 (205) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +20 -5
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +20 -5
  5. package/client.d.ts.map +1 -1
  6. package/client.js +18 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +18 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-connection.d.mts +1952 -0
  12. package/resources/agent-connection.d.mts.map +1 -0
  13. package/resources/agent-connection.d.ts +1952 -0
  14. package/resources/agent-connection.d.ts.map +1 -0
  15. package/resources/agent-connection.js +173 -0
  16. package/resources/agent-connection.js.map +1 -0
  17. package/resources/agent-connection.mjs +169 -0
  18. package/resources/agent-connection.mjs.map +1 -0
  19. package/resources/agent-conversation.d.mts +110 -0
  20. package/resources/agent-conversation.d.mts.map +1 -0
  21. package/resources/agent-conversation.d.ts +110 -0
  22. package/resources/agent-conversation.d.ts.map +1 -0
  23. package/resources/agent-conversation.js +41 -0
  24. package/resources/agent-conversation.js.map +1 -0
  25. package/resources/agent-conversation.mjs +37 -0
  26. package/resources/agent-conversation.mjs.map +1 -0
  27. package/resources/agent-draft.d.mts +101 -35
  28. package/resources/agent-draft.d.mts.map +1 -1
  29. package/resources/agent-draft.d.ts +101 -35
  30. package/resources/agent-draft.d.ts.map +1 -1
  31. package/resources/agent-endpoint.d.mts +4 -4
  32. package/resources/agent-endpoint.d.mts.map +1 -1
  33. package/resources/agent-endpoint.d.ts +4 -4
  34. package/resources/agent-endpoint.d.ts.map +1 -1
  35. package/resources/agent-setup.d.mts +1057 -0
  36. package/resources/agent-setup.d.mts.map +1 -0
  37. package/resources/agent-setup.d.ts +1057 -0
  38. package/resources/agent-setup.d.ts.map +1 -0
  39. package/resources/agent-setup.js +113 -0
  40. package/resources/agent-setup.js.map +1 -0
  41. package/resources/agent-setup.mjs +109 -0
  42. package/resources/agent-setup.mjs.map +1 -0
  43. package/resources/agent-version.d.mts +57 -18
  44. package/resources/agent-version.d.mts.map +1 -1
  45. package/resources/agent-version.d.ts +57 -18
  46. package/resources/agent-version.d.ts.map +1 -1
  47. package/resources/agent.d.mts +263 -4
  48. package/resources/agent.d.mts.map +1 -1
  49. package/resources/agent.d.ts +263 -4
  50. package/resources/agent.d.ts.map +1 -1
  51. package/resources/calendar-connection.d.mts +834 -56
  52. package/resources/calendar-connection.d.mts.map +1 -1
  53. package/resources/calendar-connection.d.ts +834 -56
  54. package/resources/calendar-connection.d.ts.map +1 -1
  55. package/resources/calendar-connection.js +127 -8
  56. package/resources/calendar-connection.js.map +1 -1
  57. package/resources/calendar-connection.mjs +127 -8
  58. package/resources/calendar-connection.mjs.map +1 -1
  59. package/resources/call.d.mts +2 -2
  60. package/resources/call.d.mts.map +1 -1
  61. package/resources/call.d.ts +2 -2
  62. package/resources/call.d.ts.map +1 -1
  63. package/resources/config.d.mts +78 -36
  64. package/resources/config.d.mts.map +1 -1
  65. package/resources/config.d.ts +78 -36
  66. package/resources/config.d.ts.map +1 -1
  67. package/resources/conversation.d.mts +156 -0
  68. package/resources/conversation.d.mts.map +1 -0
  69. package/resources/conversation.d.ts +156 -0
  70. package/resources/conversation.d.ts.map +1 -0
  71. package/resources/conversation.js +40 -0
  72. package/resources/conversation.js.map +1 -0
  73. package/resources/conversation.mjs +36 -0
  74. package/resources/conversation.mjs.map +1 -0
  75. package/resources/customer-flow-edge-case.d.mts +637 -40
  76. package/resources/customer-flow-edge-case.d.mts.map +1 -1
  77. package/resources/customer-flow-edge-case.d.ts +637 -40
  78. package/resources/customer-flow-edge-case.d.ts.map +1 -1
  79. package/resources/customer-flow.d.mts +2583 -156
  80. package/resources/customer-flow.d.mts.map +1 -1
  81. package/resources/customer-flow.d.ts +2583 -156
  82. package/resources/customer-flow.d.ts.map +1 -1
  83. package/resources/{customer-profile.d.mts → customer.d.mts} +287 -92
  84. package/resources/customer.d.mts.map +1 -0
  85. package/resources/{customer-profile.d.ts → customer.d.ts} +287 -92
  86. package/resources/customer.d.ts.map +1 -0
  87. package/resources/customer.js +180 -0
  88. package/resources/customer.js.map +1 -0
  89. package/resources/customer.mjs +176 -0
  90. package/resources/customer.mjs.map +1 -0
  91. package/resources/index.d.mts +7 -2
  92. package/resources/index.d.mts.map +1 -1
  93. package/resources/index.d.ts +7 -2
  94. package/resources/index.d.ts.map +1 -1
  95. package/resources/index.js +13 -3
  96. package/resources/index.js.map +1 -1
  97. package/resources/index.mjs +6 -1
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/mcp-server.d.mts +588 -0
  100. package/resources/mcp-server.d.mts.map +1 -0
  101. package/resources/mcp-server.d.ts +588 -0
  102. package/resources/mcp-server.d.ts.map +1 -0
  103. package/resources/mcp-server.js +109 -0
  104. package/resources/mcp-server.js.map +1 -0
  105. package/resources/mcp-server.mjs +105 -0
  106. package/resources/mcp-server.mjs.map +1 -0
  107. package/resources/metric-policy.d.mts +5 -4
  108. package/resources/metric-policy.d.mts.map +1 -1
  109. package/resources/metric-policy.d.ts +5 -4
  110. package/resources/metric-policy.d.ts.map +1 -1
  111. package/resources/metric-policy.js +1 -1
  112. package/resources/metric-policy.mjs +1 -1
  113. package/resources/metric-variant.d.mts +4 -1
  114. package/resources/metric-variant.d.mts.map +1 -1
  115. package/resources/metric-variant.d.ts +4 -1
  116. package/resources/metric-variant.d.ts.map +1 -1
  117. package/resources/metric.d.mts +7 -2
  118. package/resources/metric.d.mts.map +1 -1
  119. package/resources/metric.d.ts +7 -2
  120. package/resources/metric.d.ts.map +1 -1
  121. package/resources/simulation-environment.d.mts +366 -0
  122. package/resources/simulation-environment.d.mts.map +1 -1
  123. package/resources/simulation-environment.d.ts +366 -0
  124. package/resources/simulation-environment.d.ts.map +1 -1
  125. package/resources/simulation-job.d.mts +12 -8
  126. package/resources/simulation-job.d.mts.map +1 -1
  127. package/resources/simulation-job.d.ts +12 -8
  128. package/resources/simulation-job.d.ts.map +1 -1
  129. package/resources/simulation-persona.d.mts +25 -15
  130. package/resources/simulation-persona.d.mts.map +1 -1
  131. package/resources/simulation-persona.d.ts +25 -15
  132. package/resources/simulation-persona.d.ts.map +1 -1
  133. package/resources/simulation-run-plan-job.d.mts +32 -6
  134. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  135. package/resources/simulation-run-plan-job.d.ts +32 -6
  136. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  137. package/resources/simulation-run-plan.d.mts +126 -13
  138. package/resources/simulation-run-plan.d.mts.map +1 -1
  139. package/resources/simulation-run-plan.d.ts +126 -13
  140. package/resources/simulation-run-plan.d.ts.map +1 -1
  141. package/resources/simulation-template.d.mts +1 -1
  142. package/resources/simulation-template.d.mts.map +1 -1
  143. package/resources/simulation-template.d.ts +1 -1
  144. package/resources/simulation-template.d.ts.map +1 -1
  145. package/resources/simulation.d.mts +35 -3
  146. package/resources/simulation.d.mts.map +1 -1
  147. package/resources/simulation.d.ts +35 -3
  148. package/resources/simulation.d.ts.map +1 -1
  149. package/resources/tool.d.mts +565 -6
  150. package/resources/tool.d.mts.map +1 -1
  151. package/resources/tool.d.ts +565 -6
  152. package/resources/tool.d.ts.map +1 -1
  153. package/resources/tool.js +9 -6
  154. package/resources/tool.js.map +1 -1
  155. package/resources/tool.mjs +9 -6
  156. package/resources/tool.mjs.map +1 -1
  157. package/resources/usage.d.mts +1 -1
  158. package/resources/usage.d.mts.map +1 -1
  159. package/resources/usage.d.ts +1 -1
  160. package/resources/usage.d.ts.map +1 -1
  161. package/resources/webhook.d.mts +4 -4
  162. package/resources/webhook.d.mts.map +1 -1
  163. package/resources/webhook.d.ts +4 -4
  164. package/resources/webhook.d.ts.map +1 -1
  165. package/src/client.ts +197 -34
  166. package/src/resources/agent-connection.ts +2523 -0
  167. package/src/resources/agent-conversation.ts +139 -0
  168. package/src/resources/agent-draft.ts +239 -35
  169. package/src/resources/agent-endpoint.ts +8 -4
  170. package/src/resources/agent-setup.ts +1685 -0
  171. package/src/resources/agent-version.ts +126 -18
  172. package/src/resources/agent.ts +506 -4
  173. package/src/resources/calendar-connection.ts +1035 -63
  174. package/src/resources/call.ts +12 -2
  175. package/src/resources/config.ts +198 -36
  176. package/src/resources/conversation.ts +205 -0
  177. package/src/resources/customer-flow-edge-case.ts +709 -40
  178. package/src/resources/customer-flow.ts +3141 -156
  179. package/src/resources/{customer-profile.ts → customer.ts} +406 -294
  180. package/src/resources/index.ts +91 -17
  181. package/src/resources/mcp-server.ts +786 -0
  182. package/src/resources/metric-policy.ts +5 -4
  183. package/src/resources/metric-variant.ts +4 -1
  184. package/src/resources/metric.ts +7 -2
  185. package/src/resources/simulation-environment.ts +414 -0
  186. package/src/resources/simulation-job.ts +14 -8
  187. package/src/resources/simulation-persona.ts +25 -15
  188. package/src/resources/simulation-run-plan-job.ts +47 -6
  189. package/src/resources/simulation-run-plan.ts +140 -0
  190. package/src/resources/simulation-template.ts +1 -0
  191. package/src/resources/simulation.ts +39 -0
  192. package/src/resources/tool.ts +697 -6
  193. package/src/resources/usage.ts +6 -1
  194. package/src/resources/webhook.ts +8 -0
  195. package/src/version.ts +1 -1
  196. package/version.d.mts +1 -1
  197. package/version.d.ts +1 -1
  198. package/version.js +1 -1
  199. package/version.mjs +1 -1
  200. package/resources/customer-profile.d.mts.map +0 -1
  201. package/resources/customer-profile.d.ts.map +0 -1
  202. package/resources/customer-profile.js +0 -141
  203. package/resources/customer-profile.js.map +0 -1
  204. package/resources/customer-profile.mjs +0 -137
  205. package/resources/customer-profile.mjs.map +0 -1
@@ -26,7 +26,7 @@ export class CalendarConnection extends APIResource {
26
26
  body: CalendarConnectionCreateParams,
27
27
  options?: RequestOptions,
28
28
  ): APIPromise<CalendarConnectionCreateResponse> {
29
- return this._client.post('/v1/calendar-connection', { body, ...options });
29
+ return this._client.post('/v1/connections/calendar', { body, ...options });
30
30
  }
31
31
 
32
32
  /**
@@ -45,7 +45,7 @@ export class CalendarConnection extends APIResource {
45
45
  body: CalendarConnectionUpdateParams | null | undefined = {},
46
46
  options?: RequestOptions,
47
47
  ): APIPromise<CalendarConnectionUpdateResponse> {
48
- return this._client.patch(path`/v1/calendar-connection/${connectionID}`, { body, ...options });
48
+ return this._client.patch(path`/v1/connections/calendar/${connectionID}`, { body, ...options });
49
49
  }
50
50
 
51
51
  /**
@@ -63,7 +63,7 @@ export class CalendarConnection extends APIResource {
63
63
  query: CalendarConnectionListParams | null | undefined = {},
64
64
  options?: RequestOptions,
65
65
  ): APIPromise<CalendarConnectionListResponse> {
66
- return this._client.get('/v1/calendar-connection', { query, ...options });
66
+ return this._client.get('/v1/connections/calendar', { query, ...options });
67
67
  }
68
68
 
69
69
  /**
@@ -83,7 +83,7 @@ export class CalendarConnection extends APIResource {
83
83
  * ```
84
84
  */
85
85
  delete(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionDeleteResponse> {
86
- return this._client.delete(path`/v1/calendar-connection/${connectionID}`, options);
86
+ return this._client.delete(path`/v1/connections/calendar/${connectionID}`, options);
87
87
  }
88
88
 
89
89
  /**
@@ -100,7 +100,59 @@ export class CalendarConnection extends APIResource {
100
100
  * ```
101
101
  */
102
102
  check(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionCheckResponse> {
103
- return this._client.post(path`/v1/calendar-connection/${connectionID}/check`, options);
103
+ return this._client.post(path`/v1/connections/calendar/${connectionID}/check`, options);
104
+ }
105
+
106
+ /**
107
+ * Only for a connection whose `capabilities.roarkOwnsBookingPolicy` is true. A
108
+ * calendar with no scheduling of its own has nothing an agent can be pointed at,
109
+ * so the thing a calendar tool books into is created here: the calendar, how long
110
+ * an appointment runs, and the hours it is offered in. The policy and the hours
111
+ * are written together, because a target with no hours offers nothing. Refused if
112
+ * the calendar is one the account can only read.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const response =
117
+ * await client.calendarConnection.createTarget(
118
+ * 'connectionId',
119
+ * {
120
+ * calendarId: 'clinic@example.com',
121
+ * durationMinutes: 30,
122
+ * name: 'Front desk',
123
+ * },
124
+ * );
125
+ * ```
126
+ */
127
+ createTarget(
128
+ connectionID: string,
129
+ body: CalendarConnectionCreateTargetParams,
130
+ options?: RequestOptions,
131
+ ): APIPromise<CalendarConnectionCreateTargetResponse> {
132
+ return this._client.post(path`/v1/connections/calendar/${connectionID}/targets`, { body, ...options });
133
+ }
134
+
135
+ /**
136
+ * Refused while a calendar tool still books into it, naming the tools. A dangling
137
+ * binding would otherwise be found by whoever next tried to ship the agent, who is
138
+ * not the person who deleted the target. Appointments already recorded against it
139
+ * are kept.
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * const response =
144
+ * await client.calendarConnection.deleteTarget('targetId', {
145
+ * connectionId: 'connectionId',
146
+ * });
147
+ * ```
148
+ */
149
+ deleteTarget(
150
+ targetID: string,
151
+ params: CalendarConnectionDeleteTargetParams,
152
+ options?: RequestOptions,
153
+ ): APIPromise<CalendarConnectionDeleteTargetResponse> {
154
+ const { connectionId } = params;
155
+ return this._client.delete(path`/v1/connections/calendar/${connectionId}/targets/${targetID}`, options);
104
156
  }
105
157
 
106
158
  /**
@@ -113,7 +165,7 @@ export class CalendarConnection extends APIResource {
113
165
  * ```
114
166
  */
115
167
  getByID(connectionID: string, options?: RequestOptions): APIPromise<CalendarConnectionGetByIDResponse> {
116
- return this._client.get(path`/v1/calendar-connection/${connectionID}`, options);
168
+ return this._client.get(path`/v1/connections/calendar/${connectionID}`, options);
117
169
  }
118
170
 
119
171
  /**
@@ -139,7 +191,29 @@ export class CalendarConnection extends APIResource {
139
191
  options?: RequestOptions,
140
192
  ): APIPromise<CalendarConnectionGetTargetResponse> {
141
193
  const { connectionId } = params;
142
- return this._client.get(path`/v1/calendar-connection/${connectionId}/targets/${targetID}`, options);
194
+ return this._client.get(path`/v1/connections/calendar/${connectionId}/targets/${targetID}`, options);
195
+ }
196
+
197
+ /**
198
+ * Only for a connection whose `capabilities.roarkOwnsBookingPolicy` is true: on a
199
+ * scheduling system the bookable things already exist and `GET /targets` returns
200
+ * them. Calendars the account can only read are left out rather than listed and
201
+ * refused: one would answer availability perfectly well and then fail the booking,
202
+ * mid-call, with a caller on the line.
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const response =
207
+ * await client.calendarConnection.listCalendars(
208
+ * 'connectionId',
209
+ * );
210
+ * ```
211
+ */
212
+ listCalendars(
213
+ connectionID: string,
214
+ options?: RequestOptions,
215
+ ): APIPromise<CalendarConnectionListCalendarsResponse> {
216
+ return this._client.get(path`/v1/connections/calendar/${connectionID}/calendars`, options);
143
217
  }
144
218
 
145
219
  /**
@@ -161,7 +235,79 @@ export class CalendarConnection extends APIResource {
161
235
  connectionID: string,
162
236
  options?: RequestOptions,
163
237
  ): APIPromise<CalendarConnectionListTargetsResponse> {
164
- return this._client.get(path`/v1/calendar-connection/${connectionID}/targets`, options);
238
+ return this._client.get(path`/v1/connections/calendar/${connectionID}/targets`, options);
239
+ }
240
+
241
+ /**
242
+ * Returns a URL to open in a browser. Calendly has no credential a request body
243
+ * can carry, so connecting one is two steps: ask for this URL, let the customer
244
+ * consent, and Roark finishes the rest server-side (it exchanges the code,
245
+ * verifies the credential, reads the account’s own timezone when none was given,
246
+ * and stores the connection). Nothing is created until the customer consents, and
247
+ * a link that is not used expires. Read the result with
248
+ * `GET /v1/connections/calendar?provider=CALENDLY`.
249
+ *
250
+ * @example
251
+ * ```ts
252
+ * const response =
253
+ * await client.calendarConnection.startCalendlyOauth();
254
+ * ```
255
+ */
256
+ startCalendlyOauth(
257
+ body: CalendarConnectionStartCalendlyOauthParams | null | undefined = {},
258
+ options?: RequestOptions,
259
+ ): APIPromise<CalendarConnectionStartCalendlyOauthResponse> {
260
+ return this._client.post('/v1/connections/calendar/calendly/authorize-url', { body, ...options });
261
+ }
262
+
263
+ /**
264
+ * Returns a URL to open in a browser. Google has no credential a request body can
265
+ * carry, so connecting one is two steps: ask for this URL, let the customer
266
+ * consent, and Roark finishes the rest server-side (it exchanges the code,
267
+ * verifies that both calendar permissions were granted, reads the account’s own
268
+ * timezone when none was given, and stores the connection). Nothing is created
269
+ * until the customer consents, and a link that is not used expires. Read the
270
+ * result with `GET /v1/connections/calendar?provider=GOOGLE`.
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * const response =
275
+ * await client.calendarConnection.startGoogleOauth();
276
+ * ```
277
+ */
278
+ startGoogleOauth(
279
+ body: CalendarConnectionStartGoogleOauthParams | null | undefined = {},
280
+ options?: RequestOptions,
281
+ ): APIPromise<CalendarConnectionStartGoogleOauthResponse> {
282
+ return this._client.post('/v1/connections/calendar/google/authorize-url', { body, ...options });
283
+ }
284
+
285
+ /**
286
+ * Changes what agents ALREADY PUBLISHED against this target book, with no new tool
287
+ * version, the same thing editing a Cal.com event type on cal.com does. `hours`
288
+ * replaces the whole week when present, because a rota is described as a week and
289
+ * a partial update of one window has no meaning anybody would expect. The calendar
290
+ * cannot be changed: it is the target’s identity for the booking ledger, so moving
291
+ * it would orphan every appointment made on the old one.
292
+ *
293
+ * @example
294
+ * ```ts
295
+ * const response =
296
+ * await client.calendarConnection.updateTarget('targetId', {
297
+ * connectionId: 'connectionId',
298
+ * });
299
+ * ```
300
+ */
301
+ updateTarget(
302
+ targetID: string,
303
+ params: CalendarConnectionUpdateTargetParams,
304
+ options?: RequestOptions,
305
+ ): APIPromise<CalendarConnectionUpdateTargetResponse> {
306
+ const { connectionId, ...body } = params;
307
+ return this._client.put(path`/v1/connections/calendar/${connectionId}/targets/${targetID}`, {
308
+ body,
309
+ ...options,
310
+ });
165
311
  }
166
312
  }
167
313
 
@@ -216,9 +362,10 @@ export namespace CalendarConnectionCreateResponse {
216
362
  lastCheckedAt: string | null;
217
363
 
218
364
  /**
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.
365
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
366
+ * CALENDLY are connected by consent, through
367
+ * `POST /v1/connections/calendar/google/authorize-url` and
368
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
222
369
  */
223
370
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
224
371
 
@@ -259,7 +406,9 @@ export namespace CalendarConnectionCreateResponse {
259
406
  */
260
407
  export interface Capabilities {
261
408
  /**
262
- * How this provider is authenticated.
409
+ * How a credential is obtained, which is the whole of what connecting looks like:
410
+ * API_KEY takes a key in the create body, OAUTH sends the customer to the provider
411
+ * and Roark stores the result itself.
263
412
  */
264
413
  auth: 'API_KEY' | 'OAUTH';
265
414
 
@@ -286,9 +435,11 @@ export namespace CalendarConnectionCreateResponse {
286
435
  requiresAttendeeEmail: boolean;
287
436
 
288
437
  /**
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.
438
+ * True for a calendar that exposes only events and free/busy. Roark then owns the
439
+ * bookable hours, duration, buffers, lead time and horizon, because the provider
440
+ * has no notion of them. A tool on one of these is pointed at a bookable target
441
+ * you create through this API, rather than at something that already exists on the
442
+ * account. Read this instead of matching on the provider name.
292
443
  */
293
444
  roarkOwnsBookingPolicy: boolean;
294
445
 
@@ -353,9 +504,10 @@ export namespace CalendarConnectionUpdateResponse {
353
504
  lastCheckedAt: string | null;
354
505
 
355
506
  /**
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.
507
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
508
+ * CALENDLY are connected by consent, through
509
+ * `POST /v1/connections/calendar/google/authorize-url` and
510
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
359
511
  */
360
512
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
361
513
 
@@ -396,7 +548,9 @@ export namespace CalendarConnectionUpdateResponse {
396
548
  */
397
549
  export interface Capabilities {
398
550
  /**
399
- * How this provider is authenticated.
551
+ * How a credential is obtained, which is the whole of what connecting looks like:
552
+ * API_KEY takes a key in the create body, OAUTH sends the customer to the provider
553
+ * and Roark stores the result itself.
400
554
  */
401
555
  auth: 'API_KEY' | 'OAUTH';
402
556
 
@@ -423,9 +577,11 @@ export namespace CalendarConnectionUpdateResponse {
423
577
  requiresAttendeeEmail: boolean;
424
578
 
425
579
  /**
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.
580
+ * True for a calendar that exposes only events and free/busy. Roark then owns the
581
+ * bookable hours, duration, buffers, lead time and horizon, because the provider
582
+ * has no notion of them. A tool on one of these is pointed at a bookable target
583
+ * you create through this API, rather than at something that already exists on the
584
+ * account. Read this instead of matching on the provider name.
429
585
  */
430
586
  roarkOwnsBookingPolicy: boolean;
431
587
 
@@ -488,9 +644,10 @@ export namespace CalendarConnectionListResponse {
488
644
  lastCheckedAt: string | null;
489
645
 
490
646
  /**
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.
647
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
648
+ * CALENDLY are connected by consent, through
649
+ * `POST /v1/connections/calendar/google/authorize-url` and
650
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
494
651
  */
495
652
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
496
653
 
@@ -531,7 +688,9 @@ export namespace CalendarConnectionListResponse {
531
688
  */
532
689
  export interface Capabilities {
533
690
  /**
534
- * How this provider is authenticated.
691
+ * How a credential is obtained, which is the whole of what connecting looks like:
692
+ * API_KEY takes a key in the create body, OAUTH sends the customer to the provider
693
+ * and Roark stores the result itself.
535
694
  */
536
695
  auth: 'API_KEY' | 'OAUTH';
537
696
 
@@ -558,9 +717,11 @@ export namespace CalendarConnectionListResponse {
558
717
  requiresAttendeeEmail: boolean;
559
718
 
560
719
  /**
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.
720
+ * True for a calendar that exposes only events and free/busy. Roark then owns the
721
+ * bookable hours, duration, buffers, lead time and horizon, because the provider
722
+ * has no notion of them. A tool on one of these is pointed at a bookable target
723
+ * you create through this API, rather than at something that already exists on the
724
+ * account. Read this instead of matching on the provider name.
564
725
  */
565
726
  roarkOwnsBookingPolicy: boolean;
566
727
 
@@ -660,9 +821,10 @@ export namespace CalendarConnectionCheckResponse {
660
821
  lastCheckedAt: string | null;
661
822
 
662
823
  /**
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.
824
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
825
+ * CALENDLY are connected by consent, through
826
+ * `POST /v1/connections/calendar/google/authorize-url` and
827
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
666
828
  */
667
829
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
668
830
 
@@ -703,7 +865,9 @@ export namespace CalendarConnectionCheckResponse {
703
865
  */
704
866
  export interface Capabilities {
705
867
  /**
706
- * How this provider is authenticated.
868
+ * How a credential is obtained, which is the whole of what connecting looks like:
869
+ * API_KEY takes a key in the create body, OAUTH sends the customer to the provider
870
+ * and Roark stores the result itself.
707
871
  */
708
872
  auth: 'API_KEY' | 'OAUTH';
709
873
 
@@ -730,9 +894,11 @@ export namespace CalendarConnectionCheckResponse {
730
894
  requiresAttendeeEmail: boolean;
731
895
 
732
896
  /**
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.
897
+ * True for a calendar that exposes only events and free/busy. Roark then owns the
898
+ * bookable hours, duration, buffers, lead time and horizon, because the provider
899
+ * has no notion of them. A tool on one of these is pointed at a bookable target
900
+ * you create through this API, rather than at something that already exists on the
901
+ * account. Read this instead of matching on the provider name.
736
902
  */
737
903
  roarkOwnsBookingPolicy: boolean;
738
904
 
@@ -746,6 +912,170 @@ export namespace CalendarConnectionCheckResponse {
746
912
  }
747
913
  }
748
914
 
915
+ export interface CalendarConnectionCreateTargetResponse {
916
+ /**
917
+ * Something on a connected account an agent can be pointed at: a Cal.com event
918
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
919
+ */
920
+ data: CalendarConnectionCreateTargetResponse.Data;
921
+ }
922
+
923
+ export namespace CalendarConnectionCreateTargetResponse {
924
+ /**
925
+ * Something on a connected account an agent can be pointed at: a Cal.com event
926
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
927
+ */
928
+ export interface Data {
929
+ /**
930
+ * Identifier within this connection. Pass it back to read one target in detail.
931
+ */
932
+ id: string;
933
+
934
+ /**
935
+ * How long an appointment runs, when the provider fixes one length.
936
+ */
937
+ durationMinutes: number | null;
938
+
939
+ /**
940
+ * Other lengths this target offers, when it offers a choice. A calendar tool pins
941
+ * one of these with `durationMinutes`; an empty list means the length is not the
942
+ * customer’s to choose.
943
+ */
944
+ durationOptions: Array<number>;
945
+
946
+ /**
947
+ * Hidden on the provider’s own booking page. Still bookable through this API.
948
+ */
949
+ isHidden: boolean;
950
+
951
+ /**
952
+ * What the customer called it on the provider.
953
+ */
954
+ label: string;
955
+
956
+ /**
957
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
958
+ * Null on a scheduling system, which owns its own rules, so this one field says
959
+ * which kind of provider you are looking at without matching on the provider name.
960
+ */
961
+ policy: Data.Policy | null;
962
+
963
+ /**
964
+ * A human has to accept before it is an appointment. An agent booking one of these
965
+ * must say "requested", never "confirmed".
966
+ */
967
+ requiresConfirmation: boolean;
968
+
969
+ /**
970
+ * Ready to put on a calendar tool, so nothing has to assemble one by hand.
971
+ */
972
+ target: Data.UnionMember0 | Data.UnionMember1 | Data.UnionMember2;
973
+ }
974
+
975
+ export namespace Data {
976
+ /**
977
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
978
+ * Null on a scheduling system, which owns its own rules, so this one field says
979
+ * which kind of provider you are looking at without matching on the provider name.
980
+ */
981
+ export interface Policy {
982
+ /**
983
+ * Whether an all-day event closes the day. On by default: a calendar marks all-day
984
+ * events free unless their creator says otherwise, so a public holiday entered as
985
+ * one would otherwise still be bookable.
986
+ */
987
+ allDayEventsBlock: boolean;
988
+
989
+ bufferAfterMinutes: number;
990
+
991
+ /**
992
+ * Dead time before an appointment, counted as busy.
993
+ */
994
+ bufferBeforeMinutes: number;
995
+
996
+ durationMinutes: number;
997
+
998
+ /**
999
+ * How far ahead appointments may be made.
1000
+ */
1001
+ horizonDays: number;
1002
+
1003
+ hours: Array<Policy.Hour>;
1004
+
1005
+ /**
1006
+ * How soon from now an appointment may be made.
1007
+ */
1008
+ minNoticeMinutes: number;
1009
+
1010
+ /**
1011
+ * The grid slots are offered on, measured from each bookable window’s own start
1012
+ * rather than the hour.
1013
+ */
1014
+ slotIntervalMinutes: number;
1015
+ }
1016
+
1017
+ export namespace Policy {
1018
+ /**
1019
+ * One window of the week appointments are offered in. A window that runs past
1020
+ * midnight is two entries on two weekdays; a day the business is closed is simply
1021
+ * absent.
1022
+ */
1023
+ export interface Hour {
1024
+ endMinute: number;
1025
+
1026
+ /**
1027
+ * Minutes from local midnight, in the connection’s timezone.
1028
+ */
1029
+ startMinute: number;
1030
+
1031
+ /**
1032
+ * ISO weekday: Monday is 1, Sunday is 7.
1033
+ */
1034
+ weekday: number;
1035
+ }
1036
+ }
1037
+
1038
+ export interface UnionMember0 {
1039
+ eventTypeId: number;
1040
+
1041
+ provider: 'CAL_COM';
1042
+ }
1043
+
1044
+ export interface UnionMember1 {
1045
+ calendarId: string;
1046
+
1047
+ provider: 'GOOGLE';
1048
+
1049
+ targetId: string;
1050
+ }
1051
+
1052
+ export interface UnionMember2 {
1053
+ /**
1054
+ * The event type, by URI rather than by id: Calendly names every resource with an
1055
+ * absolute URL and its own API takes that URL back.
1056
+ */
1057
+ eventTypeUri: string;
1058
+
1059
+ provider: 'CALENDLY';
1060
+ }
1061
+ }
1062
+ }
1063
+
1064
+ export interface CalendarConnectionDeleteTargetResponse {
1065
+ data: CalendarConnectionDeleteTargetResponse.Data;
1066
+ }
1067
+
1068
+ export namespace CalendarConnectionDeleteTargetResponse {
1069
+ export interface Data {
1070
+ /**
1071
+ * Identifier of the deleted target.
1072
+ */
1073
+ id: string;
1074
+
1075
+ deleted: true;
1076
+ }
1077
+ }
1078
+
749
1079
  export interface CalendarConnectionGetByIDResponse {
750
1080
  /**
751
1081
  * A project’s credential for one calendar account, the thing a calendar tool books
@@ -797,9 +1127,10 @@ export namespace CalendarConnectionGetByIDResponse {
797
1127
  lastCheckedAt: string | null;
798
1128
 
799
1129
  /**
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.
1130
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
1131
+ * CALENDLY are connected by consent, through
1132
+ * `POST /v1/connections/calendar/google/authorize-url` and
1133
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
803
1134
  */
804
1135
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
805
1136
 
@@ -840,7 +1171,9 @@ export namespace CalendarConnectionGetByIDResponse {
840
1171
  */
841
1172
  export interface Capabilities {
842
1173
  /**
843
- * How this provider is authenticated.
1174
+ * How a credential is obtained, which is the whole of what connecting looks like:
1175
+ * API_KEY takes a key in the create body, OAUTH sends the customer to the provider
1176
+ * and Roark stores the result itself.
844
1177
  */
845
1178
  auth: 'API_KEY' | 'OAUTH';
846
1179
 
@@ -867,9 +1200,11 @@ export namespace CalendarConnectionGetByIDResponse {
867
1200
  requiresAttendeeEmail: boolean;
868
1201
 
869
1202
  /**
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.
1203
+ * True for a calendar that exposes only events and free/busy. Roark then owns the
1204
+ * bookable hours, duration, buffers, lead time and horizon, because the provider
1205
+ * has no notion of them. A tool on one of these is pointed at a bookable target
1206
+ * you create through this API, rather than at something that already exists on the
1207
+ * account. Read this instead of matching on the provider name.
873
1208
  */
874
1209
  roarkOwnsBookingPolicy: boolean;
875
1210
 
@@ -886,7 +1221,7 @@ export namespace CalendarConnectionGetByIDResponse {
886
1221
  export interface CalendarConnectionGetTargetResponse {
887
1222
  /**
888
1223
  * Something on a connected account an agent can be pointed at: a Cal.com event
889
- * type today, a Google calendar when that lands.
1224
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
890
1225
  */
891
1226
  data: CalendarConnectionGetTargetResponse.Data;
892
1227
  }
@@ -894,7 +1229,7 @@ export interface CalendarConnectionGetTargetResponse {
894
1229
  export namespace CalendarConnectionGetTargetResponse {
895
1230
  /**
896
1231
  * Something on a connected account an agent can be pointed at: a Cal.com event
897
- * type today, a Google calendar when that lands.
1232
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
898
1233
  */
899
1234
  export interface Data {
900
1235
  /**
@@ -925,9 +1260,17 @@ export namespace CalendarConnectionGetTargetResponse {
925
1260
  label: string;
926
1261
 
927
1262
  /**
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.
1263
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1264
+ * Null on a scheduling system, which owns its own rules, so this one field says
1265
+ * which kind of provider you are looking at without matching on the provider name.
1266
+ */
1267
+ policy: Data.Policy | null;
1268
+
1269
+ /**
1270
+ * What a booking is refused without, as the provider names it (`email`, `name`, or
1271
+ * a Calendly event type’s own required questions). On Cal.com the attendee object
1272
+ * itself needs only a name and a timezone, so this is the only place that says
1273
+ * whether an agent has to collect an email; on Calendly both are always required.
931
1274
  */
932
1275
  requiredBookingFields: Array<string>;
933
1276
 
@@ -946,18 +1289,128 @@ export namespace CalendarConnectionGetTargetResponse {
946
1289
  /**
947
1290
  * Ready to put on a calendar tool, so nothing has to assemble one by hand.
948
1291
  */
949
- target: Data.Target;
1292
+ target: Data.UnionMember0 | Data.UnionMember1 | Data.UnionMember2;
950
1293
  }
951
1294
 
952
1295
  export namespace Data {
953
1296
  /**
954
- * Ready to put on a calendar tool, so nothing has to assemble one by hand.
1297
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1298
+ * Null on a scheduling system, which owns its own rules, so this one field says
1299
+ * which kind of provider you are looking at without matching on the provider name.
955
1300
  */
956
- export interface Target {
1301
+ export interface Policy {
1302
+ /**
1303
+ * Whether an all-day event closes the day. On by default: a calendar marks all-day
1304
+ * events free unless their creator says otherwise, so a public holiday entered as
1305
+ * one would otherwise still be bookable.
1306
+ */
1307
+ allDayEventsBlock: boolean;
1308
+
1309
+ bufferAfterMinutes: number;
1310
+
1311
+ /**
1312
+ * Dead time before an appointment, counted as busy.
1313
+ */
1314
+ bufferBeforeMinutes: number;
1315
+
1316
+ durationMinutes: number;
1317
+
1318
+ /**
1319
+ * How far ahead appointments may be made.
1320
+ */
1321
+ horizonDays: number;
1322
+
1323
+ hours: Array<Policy.Hour>;
1324
+
1325
+ /**
1326
+ * How soon from now an appointment may be made.
1327
+ */
1328
+ minNoticeMinutes: number;
1329
+
1330
+ /**
1331
+ * The grid slots are offered on, measured from each bookable window’s own start
1332
+ * rather than the hour.
1333
+ */
1334
+ slotIntervalMinutes: number;
1335
+ }
1336
+
1337
+ export namespace Policy {
1338
+ /**
1339
+ * One window of the week appointments are offered in. A window that runs past
1340
+ * midnight is two entries on two weekdays; a day the business is closed is simply
1341
+ * absent.
1342
+ */
1343
+ export interface Hour {
1344
+ endMinute: number;
1345
+
1346
+ /**
1347
+ * Minutes from local midnight, in the connection’s timezone.
1348
+ */
1349
+ startMinute: number;
1350
+
1351
+ /**
1352
+ * ISO weekday: Monday is 1, Sunday is 7.
1353
+ */
1354
+ weekday: number;
1355
+ }
1356
+ }
1357
+
1358
+ export interface UnionMember0 {
957
1359
  eventTypeId: number;
958
1360
 
959
1361
  provider: 'CAL_COM';
960
1362
  }
1363
+
1364
+ export interface UnionMember1 {
1365
+ calendarId: string;
1366
+
1367
+ provider: 'GOOGLE';
1368
+
1369
+ targetId: string;
1370
+ }
1371
+
1372
+ export interface UnionMember2 {
1373
+ /**
1374
+ * The event type, by URI rather than by id: Calendly names every resource with an
1375
+ * absolute URL and its own API takes that URL back.
1376
+ */
1377
+ eventTypeUri: string;
1378
+
1379
+ provider: 'CALENDLY';
1380
+ }
1381
+ }
1382
+ }
1383
+
1384
+ export interface CalendarConnectionListCalendarsResponse {
1385
+ data: Array<CalendarConnectionListCalendarsResponse.Data>;
1386
+ }
1387
+
1388
+ export namespace CalendarConnectionListCalendarsResponse {
1389
+ /**
1390
+ * A calendar on the connected account that a bookable target can be created on.
1391
+ */
1392
+ export interface Data {
1393
+ /**
1394
+ * Pass this as `calendarId` when creating a target.
1395
+ */
1396
+ id: string;
1397
+
1398
+ /**
1399
+ * Always true: a calendar that cannot be written to is not listed.
1400
+ */
1401
+ canWrite: boolean;
1402
+
1403
+ isPrimary: boolean;
1404
+
1405
+ /**
1406
+ * What the calendar is called on the account.
1407
+ */
1408
+ label: string;
1409
+
1410
+ /**
1411
+ * The calendar’s own timezone, when it reports one.
1412
+ */
1413
+ timezone: string | null;
961
1414
  }
962
1415
  }
963
1416
 
@@ -968,7 +1421,7 @@ export interface CalendarConnectionListTargetsResponse {
968
1421
  export namespace CalendarConnectionListTargetsResponse {
969
1422
  /**
970
1423
  * Something on a connected account an agent can be pointed at: a Cal.com event
971
- * type today, a Google calendar when that lands.
1424
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
972
1425
  */
973
1426
  export interface Data {
974
1427
  /**
@@ -998,6 +1451,13 @@ export namespace CalendarConnectionListTargetsResponse {
998
1451
  */
999
1452
  label: string;
1000
1453
 
1454
+ /**
1455
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1456
+ * Null on a scheduling system, which owns its own rules, so this one field says
1457
+ * which kind of provider you are looking at without matching on the provider name.
1458
+ */
1459
+ policy: Data.Policy | null;
1460
+
1001
1461
  /**
1002
1462
  * A human has to accept before it is an appointment. An agent booking one of these
1003
1463
  * must say "requested", never "confirmed".
@@ -1007,26 +1467,305 @@ export namespace CalendarConnectionListTargetsResponse {
1007
1467
  /**
1008
1468
  * Ready to put on a calendar tool, so nothing has to assemble one by hand.
1009
1469
  */
1010
- target: Data.Target;
1470
+ target: Data.UnionMember0 | Data.UnionMember1 | Data.UnionMember2;
1011
1471
  }
1012
1472
 
1013
1473
  export namespace Data {
1474
+ /**
1475
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1476
+ * Null on a scheduling system, which owns its own rules, so this one field says
1477
+ * which kind of provider you are looking at without matching on the provider name.
1478
+ */
1479
+ export interface Policy {
1480
+ /**
1481
+ * Whether an all-day event closes the day. On by default: a calendar marks all-day
1482
+ * events free unless their creator says otherwise, so a public holiday entered as
1483
+ * one would otherwise still be bookable.
1484
+ */
1485
+ allDayEventsBlock: boolean;
1486
+
1487
+ bufferAfterMinutes: number;
1488
+
1489
+ /**
1490
+ * Dead time before an appointment, counted as busy.
1491
+ */
1492
+ bufferBeforeMinutes: number;
1493
+
1494
+ durationMinutes: number;
1495
+
1496
+ /**
1497
+ * How far ahead appointments may be made.
1498
+ */
1499
+ horizonDays: number;
1500
+
1501
+ hours: Array<Policy.Hour>;
1502
+
1503
+ /**
1504
+ * How soon from now an appointment may be made.
1505
+ */
1506
+ minNoticeMinutes: number;
1507
+
1508
+ /**
1509
+ * The grid slots are offered on, measured from each bookable window’s own start
1510
+ * rather than the hour.
1511
+ */
1512
+ slotIntervalMinutes: number;
1513
+ }
1514
+
1515
+ export namespace Policy {
1516
+ /**
1517
+ * One window of the week appointments are offered in. A window that runs past
1518
+ * midnight is two entries on two weekdays; a day the business is closed is simply
1519
+ * absent.
1520
+ */
1521
+ export interface Hour {
1522
+ endMinute: number;
1523
+
1524
+ /**
1525
+ * Minutes from local midnight, in the connection’s timezone.
1526
+ */
1527
+ startMinute: number;
1528
+
1529
+ /**
1530
+ * ISO weekday: Monday is 1, Sunday is 7.
1531
+ */
1532
+ weekday: number;
1533
+ }
1534
+ }
1535
+
1536
+ export interface UnionMember0 {
1537
+ eventTypeId: number;
1538
+
1539
+ provider: 'CAL_COM';
1540
+ }
1541
+
1542
+ export interface UnionMember1 {
1543
+ calendarId: string;
1544
+
1545
+ provider: 'GOOGLE';
1546
+
1547
+ targetId: string;
1548
+ }
1549
+
1550
+ export interface UnionMember2 {
1551
+ /**
1552
+ * The event type, by URI rather than by id: Calendly names every resource with an
1553
+ * absolute URL and its own API takes that URL back.
1554
+ */
1555
+ eventTypeUri: string;
1556
+
1557
+ provider: 'CALENDLY';
1558
+ }
1559
+ }
1560
+ }
1561
+
1562
+ export interface CalendarConnectionStartCalendlyOauthResponse {
1563
+ data: CalendarConnectionStartCalendlyOauthResponse.Data;
1564
+ }
1565
+
1566
+ export namespace CalendarConnectionStartCalendlyOauthResponse {
1567
+ export interface Data {
1568
+ /**
1569
+ * Open this in a browser. After the customer consents, the provider returns to
1570
+ * Roark, which exchanges the code, verifies the credential and stores the
1571
+ * connection. Read the result with `GET /v1/connections/calendar?provider=…`.
1572
+ */
1573
+ authorizeUrl: string;
1574
+
1575
+ /**
1576
+ * When the link stops working, ISO 8601. Start again after that.
1577
+ */
1578
+ expiresAt: string;
1579
+
1580
+ /**
1581
+ * The opaque single-use value this flow is identified by, echoed so a caller can
1582
+ * correlate its own UI. Not a credential and not accepted anywhere as one.
1583
+ */
1584
+ state: string;
1585
+ }
1586
+ }
1587
+
1588
+ export interface CalendarConnectionStartGoogleOauthResponse {
1589
+ data: CalendarConnectionStartGoogleOauthResponse.Data;
1590
+ }
1591
+
1592
+ export namespace CalendarConnectionStartGoogleOauthResponse {
1593
+ export interface Data {
1594
+ /**
1595
+ * Open this in a browser. After the customer consents, the provider returns to
1596
+ * Roark, which exchanges the code, verifies the credential and stores the
1597
+ * connection. Read the result with `GET /v1/connections/calendar?provider=…`.
1598
+ */
1599
+ authorizeUrl: string;
1600
+
1601
+ /**
1602
+ * When the link stops working, ISO 8601. Start again after that.
1603
+ */
1604
+ expiresAt: string;
1605
+
1606
+ /**
1607
+ * The opaque single-use value this flow is identified by, echoed so a caller can
1608
+ * correlate its own UI. Not a credential and not accepted anywhere as one.
1609
+ */
1610
+ state: string;
1611
+ }
1612
+ }
1613
+
1614
+ export interface CalendarConnectionUpdateTargetResponse {
1615
+ /**
1616
+ * Something on a connected account an agent can be pointed at: a Cal.com event
1617
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
1618
+ */
1619
+ data: CalendarConnectionUpdateTargetResponse.Data;
1620
+ }
1621
+
1622
+ export namespace CalendarConnectionUpdateTargetResponse {
1623
+ /**
1624
+ * Something on a connected account an agent can be pointed at: a Cal.com event
1625
+ * type, or a bookable target on a calendar whose booking policy Roark owns.
1626
+ */
1627
+ export interface Data {
1628
+ /**
1629
+ * Identifier within this connection. Pass it back to read one target in detail.
1630
+ */
1631
+ id: string;
1632
+
1633
+ /**
1634
+ * How long an appointment runs, when the provider fixes one length.
1635
+ */
1636
+ durationMinutes: number | null;
1637
+
1638
+ /**
1639
+ * Other lengths this target offers, when it offers a choice. A calendar tool pins
1640
+ * one of these with `durationMinutes`; an empty list means the length is not the
1641
+ * customer’s to choose.
1642
+ */
1643
+ durationOptions: Array<number>;
1644
+
1645
+ /**
1646
+ * Hidden on the provider’s own booking page. Still bookable through this API.
1647
+ */
1648
+ isHidden: boolean;
1649
+
1650
+ /**
1651
+ * What the customer called it on the provider.
1652
+ */
1653
+ label: string;
1654
+
1655
+ /**
1656
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1657
+ * Null on a scheduling system, which owns its own rules, so this one field says
1658
+ * which kind of provider you are looking at without matching on the provider name.
1659
+ */
1660
+ policy: Data.Policy | null;
1661
+
1662
+ /**
1663
+ * A human has to accept before it is an appointment. An agent booking one of these
1664
+ * must say "requested", never "confirmed".
1665
+ */
1666
+ requiresConfirmation: boolean;
1667
+
1014
1668
  /**
1015
1669
  * Ready to put on a calendar tool, so nothing has to assemble one by hand.
1016
1670
  */
1017
- export interface Target {
1671
+ target: Data.UnionMember0 | Data.UnionMember1 | Data.UnionMember2;
1672
+ }
1673
+
1674
+ export namespace Data {
1675
+ /**
1676
+ * The booking policy Roark applies, for a calendar with no scheduling of its own.
1677
+ * Null on a scheduling system, which owns its own rules, so this one field says
1678
+ * which kind of provider you are looking at without matching on the provider name.
1679
+ */
1680
+ export interface Policy {
1681
+ /**
1682
+ * Whether an all-day event closes the day. On by default: a calendar marks all-day
1683
+ * events free unless their creator says otherwise, so a public holiday entered as
1684
+ * one would otherwise still be bookable.
1685
+ */
1686
+ allDayEventsBlock: boolean;
1687
+
1688
+ bufferAfterMinutes: number;
1689
+
1690
+ /**
1691
+ * Dead time before an appointment, counted as busy.
1692
+ */
1693
+ bufferBeforeMinutes: number;
1694
+
1695
+ durationMinutes: number;
1696
+
1697
+ /**
1698
+ * How far ahead appointments may be made.
1699
+ */
1700
+ horizonDays: number;
1701
+
1702
+ hours: Array<Policy.Hour>;
1703
+
1704
+ /**
1705
+ * How soon from now an appointment may be made.
1706
+ */
1707
+ minNoticeMinutes: number;
1708
+
1709
+ /**
1710
+ * The grid slots are offered on, measured from each bookable window’s own start
1711
+ * rather than the hour.
1712
+ */
1713
+ slotIntervalMinutes: number;
1714
+ }
1715
+
1716
+ export namespace Policy {
1717
+ /**
1718
+ * One window of the week appointments are offered in. A window that runs past
1719
+ * midnight is two entries on two weekdays; a day the business is closed is simply
1720
+ * absent.
1721
+ */
1722
+ export interface Hour {
1723
+ endMinute: number;
1724
+
1725
+ /**
1726
+ * Minutes from local midnight, in the connection’s timezone.
1727
+ */
1728
+ startMinute: number;
1729
+
1730
+ /**
1731
+ * ISO weekday: Monday is 1, Sunday is 7.
1732
+ */
1733
+ weekday: number;
1734
+ }
1735
+ }
1736
+
1737
+ export interface UnionMember0 {
1018
1738
  eventTypeId: number;
1019
1739
 
1020
1740
  provider: 'CAL_COM';
1021
1741
  }
1742
+
1743
+ export interface UnionMember1 {
1744
+ calendarId: string;
1745
+
1746
+ provider: 'GOOGLE';
1747
+
1748
+ targetId: string;
1749
+ }
1750
+
1751
+ export interface UnionMember2 {
1752
+ /**
1753
+ * The event type, by URI rather than by id: Calendly names every resource with an
1754
+ * absolute URL and its own API takes that URL back.
1755
+ */
1756
+ eventTypeUri: string;
1757
+
1758
+ provider: 'CALENDLY';
1759
+ }
1022
1760
  }
1023
1761
  }
1024
1762
 
1025
1763
  export interface CalendarConnectionCreateParams {
1026
1764
  /**
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.
1765
+ * The provider account’s API key. For CAL*COM, a Cal.com API key (starts with
1766
+ * `cal*`). It is verified against the provider before anything is stored, so an
1767
+ * invalid key is a 400 and no connection is created. Stored encrypted and never
1768
+ * returned.
1030
1769
  */
1031
1770
  apiKey: string;
1032
1771
 
@@ -1036,9 +1775,10 @@ export interface CalendarConnectionCreateParams {
1036
1775
  label: string;
1037
1776
 
1038
1777
  /**
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.
1778
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
1779
+ * CALENDLY are connected by consent, through
1780
+ * `POST /v1/connections/calendar/google/authorize-url` and
1781
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
1042
1782
  */
1043
1783
  provider: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
1044
1784
 
@@ -1071,13 +1811,97 @@ export interface CalendarConnectionUpdateParams {
1071
1811
 
1072
1812
  export interface CalendarConnectionListParams {
1073
1813
  /**
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.
1814
+ * Who holds the calendar. CAL_COM is connected with an API key; GOOGLE and
1815
+ * CALENDLY are connected by consent, through
1816
+ * `POST /v1/connections/calendar/google/authorize-url` and
1817
+ * `POST /v1/connections/calendar/calendly/authorize-url`.
1077
1818
  */
1078
1819
  provider?: 'CAL_COM' | 'GOOGLE' | 'CALENDLY';
1079
1820
  }
1080
1821
 
1822
+ export interface CalendarConnectionCreateTargetParams {
1823
+ /**
1824
+ * The calendar to write appointments to, from
1825
+ * `GET /v1/connections/calendar/{connectionId}/calendars`. `primary` is accepted
1826
+ * and stored as the account’s own id.
1827
+ */
1828
+ calendarId: string;
1829
+
1830
+ durationMinutes: number;
1831
+
1832
+ /**
1833
+ * Unique within the connection, and how a config file refers to this target.
1834
+ * Letters, digits, spaces, \_ or -.
1835
+ */
1836
+ name: string;
1837
+
1838
+ /**
1839
+ * Whether an all-day event closes the day. Defaults to true, because a calendar
1840
+ * marks all-day events free unless their creator says otherwise and a public
1841
+ * holiday entered as one would otherwise be bookable.
1842
+ */
1843
+ allDayEventsBlock?: boolean | null;
1844
+
1845
+ bufferAfterMinutes?: number | null;
1846
+
1847
+ /**
1848
+ * Dead time before an appointment, counted as busy when a slot is offered.
1849
+ * Defaults to 0.
1850
+ */
1851
+ bufferBeforeMinutes?: number | null;
1852
+
1853
+ /**
1854
+ * How far ahead appointments may be made. Defaults to 30.
1855
+ */
1856
+ horizonDays?: number | null;
1857
+
1858
+ /**
1859
+ * The windows of the week appointments are offered in. Omit to adopt Monday to
1860
+ * Friday, 09:00 to 17:00. A target with no windows offers nothing at all, which
1861
+ * reads to a caller as a permanently full diary.
1862
+ */
1863
+ hours?: Array<CalendarConnectionCreateTargetParams.Hour> | null;
1864
+
1865
+ /**
1866
+ * How soon from now an appointment may be made. Defaults to 120.
1867
+ */
1868
+ minNoticeMinutes?: number | null;
1869
+
1870
+ /**
1871
+ * The grid slots are offered on. Defaults to the duration, which gives
1872
+ * back-to-back appointments.
1873
+ */
1874
+ slotIntervalMinutes?: number | null;
1875
+ }
1876
+
1877
+ export namespace CalendarConnectionCreateTargetParams {
1878
+ /**
1879
+ * One window of the week appointments are offered in. A window that runs past
1880
+ * midnight is two entries on two weekdays; a day the business is closed is simply
1881
+ * absent.
1882
+ */
1883
+ export interface Hour {
1884
+ endMinute: number;
1885
+
1886
+ /**
1887
+ * Minutes from local midnight, in the connection’s timezone.
1888
+ */
1889
+ startMinute: number;
1890
+
1891
+ /**
1892
+ * ISO weekday: Monday is 1, Sunday is 7.
1893
+ */
1894
+ weekday: number;
1895
+ }
1896
+ }
1897
+
1898
+ export interface CalendarConnectionDeleteTargetParams {
1899
+ /**
1900
+ * Calendar connection ID
1901
+ */
1902
+ connectionId: string;
1903
+ }
1904
+
1081
1905
  export interface CalendarConnectionGetTargetParams {
1082
1906
  /**
1083
1907
  * Calendar connection ID
@@ -1085,6 +1909,143 @@ export interface CalendarConnectionGetTargetParams {
1085
1909
  connectionId: string;
1086
1910
  }
1087
1911
 
1912
+ export interface CalendarConnectionStartCalendlyOauthParams {
1913
+ /**
1914
+ * Reconnect an existing connection instead of creating one: the consent screen
1915
+ * replaces that connection’s credential in place, so every tool bound to it keeps
1916
+ * working. Use this when a connection reports `INVALID_CREDENTIALS`. The
1917
+ * connection’s existing name and timezone are kept, so `label` is ignored when
1918
+ * this is set.
1919
+ */
1920
+ calendarConnectionId?: string | null;
1921
+
1922
+ /**
1923
+ * Customer-facing name for the connection, unique within the project. Required
1924
+ * unless `calendarConnectionId` is set, and decided now because the consent screen
1925
+ * has nowhere to carry it.
1926
+ */
1927
+ label?: string | null;
1928
+
1929
+ /**
1930
+ * The named IANA timezone to offer slots in, for example `America/Los_Angeles`.
1931
+ * Omit to adopt the Calendly account’s own. A fixed offset such as `-08:00` is
1932
+ * rejected: it does not observe DST.
1933
+ */
1934
+ timezone?: string | null;
1935
+ }
1936
+
1937
+ export interface CalendarConnectionStartGoogleOauthParams {
1938
+ /**
1939
+ * Reconnect an existing connection instead of creating one: the consent screen
1940
+ * replaces that connection’s credential in place, so every tool bound to it keeps
1941
+ * working. Use this when a connection reports `INVALID_CREDENTIALS`. The
1942
+ * connection’s existing name and timezone are kept, so `label` is ignored when
1943
+ * this is set.
1944
+ */
1945
+ calendarConnectionId?: string | null;
1946
+
1947
+ /**
1948
+ * Customer-facing name for the connection, unique within the project. Required
1949
+ * unless `calendarConnectionId` is set, and decided now because the consent screen
1950
+ * has nowhere to carry it.
1951
+ */
1952
+ label?: string | null;
1953
+
1954
+ /**
1955
+ * The Google account to preselect on the consent screen. A hint only: it is
1956
+ * ignored if the user is signed into another account, and nothing is authorized by
1957
+ * it.
1958
+ */
1959
+ loginHint?: string | null;
1960
+
1961
+ /**
1962
+ * The named IANA timezone to offer slots in, for example `America/Los_Angeles`.
1963
+ * Omit to adopt the Google account’s own. A fixed offset such as `-08:00` is
1964
+ * rejected: it does not observe DST.
1965
+ */
1966
+ timezone?: string | null;
1967
+ }
1968
+
1969
+ export interface CalendarConnectionUpdateTargetParams {
1970
+ /**
1971
+ * Path param: Calendar connection ID
1972
+ */
1973
+ connectionId: string;
1974
+
1975
+ /**
1976
+ * Body param: Whether an all-day event closes the day. Defaults to true, because a
1977
+ * calendar marks all-day events free unless their creator says otherwise and a
1978
+ * public holiday entered as one would otherwise be bookable.
1979
+ */
1980
+ allDayEventsBlock?: boolean | null;
1981
+
1982
+ /**
1983
+ * Body param
1984
+ */
1985
+ bufferAfterMinutes?: number | null;
1986
+
1987
+ /**
1988
+ * Body param: Dead time before an appointment, counted as busy when a slot is
1989
+ * offered. Defaults to 0.
1990
+ */
1991
+ bufferBeforeMinutes?: number | null;
1992
+
1993
+ /**
1994
+ * Body param
1995
+ */
1996
+ durationMinutes?: number;
1997
+
1998
+ /**
1999
+ * Body param: How far ahead appointments may be made. Defaults to 30.
2000
+ */
2001
+ horizonDays?: number | null;
2002
+
2003
+ /**
2004
+ * Body param: The windows of the week appointments are offered in. Omit to adopt
2005
+ * Monday to Friday, 09:00 to 17:00. A target with no windows offers nothing at
2006
+ * all, which reads to a caller as a permanently full diary.
2007
+ */
2008
+ hours?: Array<CalendarConnectionUpdateTargetParams.Hour> | null;
2009
+
2010
+ /**
2011
+ * Body param: How soon from now an appointment may be made. Defaults to 120.
2012
+ */
2013
+ minNoticeMinutes?: number | null;
2014
+
2015
+ /**
2016
+ * Body param: Unique within the connection, and how a config file refers to this
2017
+ * target. Letters, digits, spaces, \_ or -.
2018
+ */
2019
+ name?: string;
2020
+
2021
+ /**
2022
+ * Body param: The grid slots are offered on. Defaults to the duration, which gives
2023
+ * back-to-back appointments.
2024
+ */
2025
+ slotIntervalMinutes?: number | null;
2026
+ }
2027
+
2028
+ export namespace CalendarConnectionUpdateTargetParams {
2029
+ /**
2030
+ * One window of the week appointments are offered in. A window that runs past
2031
+ * midnight is two entries on two weekdays; a day the business is closed is simply
2032
+ * absent.
2033
+ */
2034
+ export interface Hour {
2035
+ endMinute: number;
2036
+
2037
+ /**
2038
+ * Minutes from local midnight, in the connection’s timezone.
2039
+ */
2040
+ startMinute: number;
2041
+
2042
+ /**
2043
+ * ISO weekday: Monday is 1, Sunday is 7.
2044
+ */
2045
+ weekday: number;
2046
+ }
2047
+ }
2048
+
1088
2049
  export declare namespace CalendarConnection {
1089
2050
  export {
1090
2051
  type CalendarConnectionCreateResponse as CalendarConnectionCreateResponse,
@@ -1092,12 +2053,23 @@ export declare namespace CalendarConnection {
1092
2053
  type CalendarConnectionListResponse as CalendarConnectionListResponse,
1093
2054
  type CalendarConnectionDeleteResponse as CalendarConnectionDeleteResponse,
1094
2055
  type CalendarConnectionCheckResponse as CalendarConnectionCheckResponse,
2056
+ type CalendarConnectionCreateTargetResponse as CalendarConnectionCreateTargetResponse,
2057
+ type CalendarConnectionDeleteTargetResponse as CalendarConnectionDeleteTargetResponse,
1095
2058
  type CalendarConnectionGetByIDResponse as CalendarConnectionGetByIDResponse,
1096
2059
  type CalendarConnectionGetTargetResponse as CalendarConnectionGetTargetResponse,
2060
+ type CalendarConnectionListCalendarsResponse as CalendarConnectionListCalendarsResponse,
1097
2061
  type CalendarConnectionListTargetsResponse as CalendarConnectionListTargetsResponse,
2062
+ type CalendarConnectionStartCalendlyOauthResponse as CalendarConnectionStartCalendlyOauthResponse,
2063
+ type CalendarConnectionStartGoogleOauthResponse as CalendarConnectionStartGoogleOauthResponse,
2064
+ type CalendarConnectionUpdateTargetResponse as CalendarConnectionUpdateTargetResponse,
1098
2065
  type CalendarConnectionCreateParams as CalendarConnectionCreateParams,
1099
2066
  type CalendarConnectionUpdateParams as CalendarConnectionUpdateParams,
1100
2067
  type CalendarConnectionListParams as CalendarConnectionListParams,
2068
+ type CalendarConnectionCreateTargetParams as CalendarConnectionCreateTargetParams,
2069
+ type CalendarConnectionDeleteTargetParams as CalendarConnectionDeleteTargetParams,
1101
2070
  type CalendarConnectionGetTargetParams as CalendarConnectionGetTargetParams,
2071
+ type CalendarConnectionStartCalendlyOauthParams as CalendarConnectionStartCalendlyOauthParams,
2072
+ type CalendarConnectionStartGoogleOauthParams as CalendarConnectionStartGoogleOauthParams,
2073
+ type CalendarConnectionUpdateTargetParams as CalendarConnectionUpdateTargetParams,
1102
2074
  };
1103
2075
  }