@recovr/sdk 0.0.0-stage → 1.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 (89) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +307 -2
  4. package/dist/cjs/client.d.ts +36 -0
  5. package/dist/cjs/client.js +100 -0
  6. package/dist/cjs/errors.d.ts +31 -0
  7. package/dist/cjs/errors.js +69 -0
  8. package/dist/cjs/generated/client/client.gen.d.ts +2 -0
  9. package/dist/cjs/generated/client/client.gen.js +220 -0
  10. package/dist/cjs/generated/client/index.d.ts +10 -0
  11. package/dist/cjs/generated/client/index.js +17 -0
  12. package/dist/cjs/generated/client/types.gen.d.ts +120 -0
  13. package/dist/cjs/generated/client/types.gen.js +3 -0
  14. package/dist/cjs/generated/client/utils.gen.d.ts +37 -0
  15. package/dist/cjs/generated/client/utils.gen.js +239 -0
  16. package/dist/cjs/generated/client.gen.d.ts +12 -0
  17. package/dist/cjs/generated/client.gen.js +6 -0
  18. package/dist/cjs/generated/core/auth.gen.d.ts +25 -0
  19. package/dist/cjs/generated/core/auth.gen.js +18 -0
  20. package/dist/cjs/generated/core/bodySerializer.gen.d.ts +25 -0
  21. package/dist/cjs/generated/core/bodySerializer.gen.js +60 -0
  22. package/dist/cjs/generated/core/params.gen.d.ts +43 -0
  23. package/dist/cjs/generated/core/params.gen.js +112 -0
  24. package/dist/cjs/generated/core/pathSerializer.gen.d.ts +33 -0
  25. package/dist/cjs/generated/core/pathSerializer.gen.js +115 -0
  26. package/dist/cjs/generated/core/queryKeySerializer.gen.d.ts +18 -0
  27. package/dist/cjs/generated/core/queryKeySerializer.gen.js +98 -0
  28. package/dist/cjs/generated/core/serverSentEvents.gen.d.ts +71 -0
  29. package/dist/cjs/generated/core/serverSentEvents.gen.js +135 -0
  30. package/dist/cjs/generated/core/types.gen.d.ts +83 -0
  31. package/dist/cjs/generated/core/types.gen.js +3 -0
  32. package/dist/cjs/generated/core/utils.gen.d.ts +19 -0
  33. package/dist/cjs/generated/core/utils.gen.js +93 -0
  34. package/dist/cjs/generated/index.d.ts +2 -0
  35. package/dist/cjs/generated/index.js +6 -0
  36. package/dist/cjs/generated/sdk.gen.d.ts +603 -0
  37. package/dist/cjs/generated/sdk.gen.js +2315 -0
  38. package/dist/cjs/generated/types.gen.d.ts +7658 -0
  39. package/dist/cjs/generated/types.gen.js +3 -0
  40. package/dist/cjs/index.d.ts +4 -0
  41. package/dist/cjs/index.js +11 -0
  42. package/dist/cjs/package.json +3 -0
  43. package/dist/cjs/paginate.d.ts +24 -0
  44. package/dist/cjs/paginate.js +18 -0
  45. package/dist/esm/client.d.ts +36 -0
  46. package/dist/esm/client.js +95 -0
  47. package/dist/esm/errors.d.ts +31 -0
  48. package/dist/esm/errors.js +64 -0
  49. package/dist/esm/generated/client/client.gen.d.ts +2 -0
  50. package/dist/esm/generated/client/client.gen.js +216 -0
  51. package/dist/esm/generated/client/index.d.ts +10 -0
  52. package/dist/esm/generated/client/index.js +6 -0
  53. package/dist/esm/generated/client/types.gen.d.ts +120 -0
  54. package/dist/esm/generated/client/types.gen.js +2 -0
  55. package/dist/esm/generated/client/utils.gen.d.ts +37 -0
  56. package/dist/esm/generated/client/utils.gen.js +228 -0
  57. package/dist/esm/generated/client.gen.d.ts +12 -0
  58. package/dist/esm/generated/client.gen.js +3 -0
  59. package/dist/esm/generated/core/auth.gen.d.ts +25 -0
  60. package/dist/esm/generated/core/auth.gen.js +14 -0
  61. package/dist/esm/generated/core/bodySerializer.gen.d.ts +25 -0
  62. package/dist/esm/generated/core/bodySerializer.gen.js +57 -0
  63. package/dist/esm/generated/core/params.gen.d.ts +43 -0
  64. package/dist/esm/generated/core/params.gen.js +109 -0
  65. package/dist/esm/generated/core/pathSerializer.gen.d.ts +33 -0
  66. package/dist/esm/generated/core/pathSerializer.gen.js +106 -0
  67. package/dist/esm/generated/core/queryKeySerializer.gen.d.ts +18 -0
  68. package/dist/esm/generated/core/queryKeySerializer.gen.js +92 -0
  69. package/dist/esm/generated/core/serverSentEvents.gen.d.ts +71 -0
  70. package/dist/esm/generated/core/serverSentEvents.gen.js +132 -0
  71. package/dist/esm/generated/core/types.gen.d.ts +83 -0
  72. package/dist/esm/generated/core/types.gen.js +2 -0
  73. package/dist/esm/generated/core/utils.gen.d.ts +19 -0
  74. package/dist/esm/generated/core/utils.gen.js +87 -0
  75. package/dist/esm/generated/index.d.ts +2 -0
  76. package/dist/esm/generated/index.js +2 -0
  77. package/dist/esm/generated/sdk.gen.d.ts +603 -0
  78. package/dist/esm/generated/sdk.gen.js +2311 -0
  79. package/dist/esm/generated/types.gen.d.ts +7658 -0
  80. package/dist/esm/generated/types.gen.js +2 -0
  81. package/dist/esm/index.d.ts +4 -0
  82. package/dist/esm/index.js +3 -0
  83. package/dist/esm/paginate.d.ts +24 -0
  84. package/dist/esm/paginate.js +15 -0
  85. package/examples/add-lead.ts +45 -0
  86. package/examples/add-note.ts +34 -0
  87. package/examples/export-health-scores.ts +38 -0
  88. package/examples/set-suspension.ts +38 -0
  89. package/package.json +59 -4
@@ -0,0 +1,2311 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { client } from './client.gen.js';
3
+ class HeyApiClient {
4
+ client;
5
+ constructor(args) {
6
+ this.client = args?.client ?? client;
7
+ }
8
+ }
9
+ class HeyApiRegistry {
10
+ defaultKey = 'default';
11
+ instances = new Map();
12
+ get(key) {
13
+ const instance = this.instances.get(key ?? this.defaultKey);
14
+ if (!instance) {
15
+ throw new Error(`No SDK client found. Create one with "new RecovrSdk()" to fix this error.`);
16
+ }
17
+ return instance;
18
+ }
19
+ set(value, key) {
20
+ this.instances.set(key ?? this.defaultKey, value);
21
+ }
22
+ }
23
+ export class RecovrSdk extends HeyApiClient {
24
+ static __registry = new HeyApiRegistry();
25
+ constructor(args) {
26
+ super(args);
27
+ RecovrSdk.__registry.set(this, args?.key);
28
+ }
29
+ /**
30
+ * The credential making this request
31
+ *
32
+ * How this request authenticated (a personal access token or an OAuth app), the credential's name, the permissions that apply, its location and rate-limit state. A good first call to check a credential works. Any valid personal access token or OAuth token can call it.
33
+ */
34
+ getMe(options) {
35
+ return (options?.client ?? this.client).get({
36
+ security: [
37
+ {
38
+ key: 'oauth2',
39
+ scheme: 'bearer',
40
+ type: 'http'
41
+ },
42
+ { name: 'x-api-key', type: 'apiKey' },
43
+ {
44
+ key: 'bearerAuth',
45
+ scheme: 'bearer',
46
+ type: 'http'
47
+ }
48
+ ],
49
+ url: '/me',
50
+ ...options
51
+ });
52
+ }
53
+ /**
54
+ * The key's location
55
+ *
56
+ * The one location this key belongs to; every other endpoint reads and writes only there. Any valid key can call it.
57
+ */
58
+ getLocation(options) {
59
+ return (options?.client ?? this.client).get({
60
+ security: [
61
+ {
62
+ key: 'oauth2',
63
+ scheme: 'bearer',
64
+ type: 'http'
65
+ },
66
+ { name: 'x-api-key', type: 'apiKey' },
67
+ {
68
+ key: 'bearerAuth',
69
+ scheme: 'bearer',
70
+ type: 'http'
71
+ }
72
+ ],
73
+ url: '/location',
74
+ ...options
75
+ });
76
+ }
77
+ /**
78
+ * Get a client
79
+ *
80
+ * One client at the key's location, read fresh. Needs `clients:read`; `email` and `phone` are included only with `contact_details:read`. A client at another location is a 404.
81
+ */
82
+ getClient(options) {
83
+ return (options.client ?? this.client).get({
84
+ security: [
85
+ {
86
+ key: 'oauth2',
87
+ scheme: 'bearer',
88
+ type: 'http'
89
+ },
90
+ { name: 'x-api-key', type: 'apiKey' },
91
+ {
92
+ key: 'bearerAuth',
93
+ scheme: 'bearer',
94
+ type: 'http'
95
+ }
96
+ ],
97
+ url: '/clients/{id}',
98
+ ...options
99
+ });
100
+ }
101
+ /**
102
+ * List clients
103
+ *
104
+ * Clients at the key's location, filtered the way the Clients page filters them. Needs `clients:read`; filtering by `email` or `phone` also needs `contact_details:read`.
105
+ *
106
+ * Every filter you send must match (AND). Includes leads and former members unless you filter by `lifecycle_stage` or `is_active_member`. Exact filters (`external_client_id`, `email`, `phone`) can match several clients, for example a family sharing an email: all of them are returned.
107
+ *
108
+ * Pages are stable: a client added or removed between pages doesn't make the next page repeat or skip anyone else. Lists are read from data that can be up to a minute old; GET /clients/{id} reads one client fresh.
109
+ */
110
+ listClients(options) {
111
+ return (options?.client ?? this.client).get({
112
+ security: [
113
+ {
114
+ key: 'oauth2',
115
+ scheme: 'bearer',
116
+ type: 'http'
117
+ },
118
+ { name: 'x-api-key', type: 'apiKey' },
119
+ {
120
+ key: 'bearerAuth',
121
+ scheme: 'bearer',
122
+ type: 'http'
123
+ }
124
+ ],
125
+ url: '/clients',
126
+ ...options
127
+ });
128
+ }
129
+ /**
130
+ * Assign a client to a team member
131
+ *
132
+ * Sets who looks after this client, as assigning a coach does on their profile. The team member is emailed unless they've turned assignment emails off. Send `assigned_to: null` to unassign. An id that isn't on the location's team is a 400. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
133
+ */
134
+ assignClient(options) {
135
+ return (options.client ?? this.client).post({
136
+ security: [
137
+ {
138
+ key: 'oauth2',
139
+ scheme: 'bearer',
140
+ type: 'http'
141
+ },
142
+ { name: 'x-api-key', type: 'apiKey' },
143
+ {
144
+ key: 'bearerAuth',
145
+ scheme: 'bearer',
146
+ type: 'http'
147
+ }
148
+ ],
149
+ url: '/clients/{id}/assign',
150
+ ...options,
151
+ headers: {
152
+ 'Content-Type': 'application/json',
153
+ ...options.headers
154
+ }
155
+ });
156
+ }
157
+ /**
158
+ * Flag a client
159
+ *
160
+ * Flags the client for the team's attention from now, and records it on their timeline. The body is optional. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
161
+ */
162
+ flagClient(options) {
163
+ return (options.client ?? this.client).post({
164
+ security: [
165
+ {
166
+ key: 'oauth2',
167
+ scheme: 'bearer',
168
+ type: 'http'
169
+ },
170
+ { name: 'x-api-key', type: 'apiKey' },
171
+ {
172
+ key: 'bearerAuth',
173
+ scheme: 'bearer',
174
+ type: 'http'
175
+ }
176
+ ],
177
+ url: '/clients/{id}/flag',
178
+ ...options,
179
+ headers: {
180
+ 'Content-Type': 'application/json',
181
+ ...options.headers
182
+ }
183
+ });
184
+ }
185
+ /**
186
+ * Remove a client's flag
187
+ *
188
+ * Unflagging a client who isn't flagged changes nothing. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
189
+ */
190
+ unflagClient(options) {
191
+ return (options.client ?? this.client).post({
192
+ security: [
193
+ {
194
+ key: 'oauth2',
195
+ scheme: 'bearer',
196
+ type: 'http'
197
+ },
198
+ { name: 'x-api-key', type: 'apiKey' },
199
+ {
200
+ key: 'bearerAuth',
201
+ scheme: 'bearer',
202
+ type: 'http'
203
+ }
204
+ ],
205
+ url: '/clients/{id}/unflag',
206
+ ...options
207
+ });
208
+ }
209
+ /**
210
+ * Snooze a client
211
+ *
212
+ * Takes the client out of Next Up until the snooze ends. Send `days` or `until`, not both. Snoozing a snoozed client replaces the end. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
213
+ */
214
+ snoozeClient(options) {
215
+ return (options.client ?? this.client).post({
216
+ security: [
217
+ {
218
+ key: 'oauth2',
219
+ scheme: 'bearer',
220
+ type: 'http'
221
+ },
222
+ { name: 'x-api-key', type: 'apiKey' },
223
+ {
224
+ key: 'bearerAuth',
225
+ scheme: 'bearer',
226
+ type: 'http'
227
+ }
228
+ ],
229
+ url: '/clients/{id}/snooze',
230
+ ...options,
231
+ headers: {
232
+ 'Content-Type': 'application/json',
233
+ ...options.headers
234
+ }
235
+ });
236
+ }
237
+ /**
238
+ * End a client's snooze
239
+ *
240
+ * Ends the snooze now. Unsnoozing a client who isn't snoozed changes nothing. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
241
+ */
242
+ unsnoozeClient(options) {
243
+ return (options.client ?? this.client).post({
244
+ security: [
245
+ {
246
+ key: 'oauth2',
247
+ scheme: 'bearer',
248
+ type: 'http'
249
+ },
250
+ { name: 'x-api-key', type: 'apiKey' },
251
+ {
252
+ key: 'bearerAuth',
253
+ scheme: 'bearer',
254
+ type: 'http'
255
+ }
256
+ ],
257
+ url: '/clients/{id}/unsnooze',
258
+ ...options
259
+ });
260
+ }
261
+ /**
262
+ * Set a client's do-not-contact channels
263
+ *
264
+ * Stops (or allows again) messages and calls to the client on the channels you name; the client's `do_not_contact` shows the result. Every send from Recovr, including workflows, checks this. At a location connected to GoHighLevel, a later sync from GoHighLevel can change it, and this doesn't change it in GoHighLevel. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
265
+ */
266
+ setClientDoNotContact(options) {
267
+ return (options.client ?? this.client).post({
268
+ security: [
269
+ {
270
+ key: 'oauth2',
271
+ scheme: 'bearer',
272
+ type: 'http'
273
+ },
274
+ { name: 'x-api-key', type: 'apiKey' },
275
+ {
276
+ key: 'bearerAuth',
277
+ scheme: 'bearer',
278
+ type: 'http'
279
+ }
280
+ ],
281
+ url: '/clients/{id}/do-not-contact',
282
+ ...options,
283
+ headers: {
284
+ 'Content-Type': 'application/json',
285
+ ...options.headers
286
+ }
287
+ });
288
+ }
289
+ /**
290
+ * Add a label to a client
291
+ *
292
+ * Applies one of the location's labels, which can start workflows that trigger on it. Adding a label the client already has changes nothing. An archived label is restored. Smart labels can't be added by hand. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
293
+ */
294
+ addClientLabel(options) {
295
+ return (options.client ?? this.client).post({
296
+ security: [
297
+ {
298
+ key: 'oauth2',
299
+ scheme: 'bearer',
300
+ type: 'http'
301
+ },
302
+ { name: 'x-api-key', type: 'apiKey' },
303
+ {
304
+ key: 'bearerAuth',
305
+ scheme: 'bearer',
306
+ type: 'http'
307
+ }
308
+ ],
309
+ url: '/clients/{id}/labels',
310
+ ...options,
311
+ headers: {
312
+ 'Content-Type': 'application/json',
313
+ ...options.headers
314
+ }
315
+ });
316
+ }
317
+ /**
318
+ * Remove a label from a client
319
+ *
320
+ * Removing a label the client doesn't have changes nothing. Recovr won't re-apply a label you removed by itself. Smart labels can't be removed by hand. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
321
+ */
322
+ removeClientLabel(options) {
323
+ return (options.client ?? this.client).delete({
324
+ security: [
325
+ {
326
+ key: 'oauth2',
327
+ scheme: 'bearer',
328
+ type: 'http'
329
+ },
330
+ { name: 'x-api-key', type: 'apiKey' },
331
+ {
332
+ key: 'bearerAuth',
333
+ scheme: 'bearer',
334
+ type: 'http'
335
+ }
336
+ ],
337
+ url: '/clients/{id}/labels/{label_id}',
338
+ ...options
339
+ });
340
+ }
341
+ /**
342
+ * Get a client's suspension details
343
+ *
344
+ * The Suspended Member details on the client's profile. A client who isn't suspended has `is_suspended: false`; details from an earlier suspension aren't returned. Needs `clients:read`. Works only on clients at the key's location: any other id is a 404.
345
+ */
346
+ getClientSuspension(options) {
347
+ return (options.client ?? this.client).get({
348
+ security: [
349
+ {
350
+ key: 'oauth2',
351
+ scheme: 'bearer',
352
+ type: 'http'
353
+ },
354
+ { name: 'x-api-key', type: 'apiKey' },
355
+ {
356
+ key: 'bearerAuth',
357
+ scheme: 'bearer',
358
+ type: 'http'
359
+ }
360
+ ],
361
+ url: '/clients/{id}/suspension',
362
+ ...options
363
+ });
364
+ }
365
+ /**
366
+ * Update a client's suspension details
367
+ *
368
+ * Sets the reason, expected return date and notes on the client's Suspended Member card. Fields you leave out keep their value; null clears one. The client must already be Suspended in Recovr, which follows the booking platform: a hold made there shows up after Recovr's next sync of that client, and until then this returns 409 `client_not_suspended`. Needs `clients:write`. Works only on clients at the key's location: any other id is a 404.
369
+ */
370
+ updateClientSuspension(options) {
371
+ return (options.client ?? this.client).patch({
372
+ security: [
373
+ {
374
+ key: 'oauth2',
375
+ scheme: 'bearer',
376
+ type: 'http'
377
+ },
378
+ { name: 'x-api-key', type: 'apiKey' },
379
+ {
380
+ key: 'bearerAuth',
381
+ scheme: 'bearer',
382
+ type: 'http'
383
+ }
384
+ ],
385
+ url: '/clients/{id}/suspension',
386
+ ...options,
387
+ headers: {
388
+ 'Content-Type': 'application/json',
389
+ ...options.headers
390
+ }
391
+ });
392
+ }
393
+ /**
394
+ * List client labels
395
+ *
396
+ * The location's labels, for `label_id` in GET /clients and POST /clients/{id}/labels. Archived labels only with `include_archived=true`. Needs `clients:read`.
397
+ */
398
+ listClientLabels(options) {
399
+ return (options?.client ?? this.client).get({
400
+ security: [
401
+ {
402
+ key: 'oauth2',
403
+ scheme: 'bearer',
404
+ type: 'http'
405
+ },
406
+ { name: 'x-api-key', type: 'apiKey' },
407
+ {
408
+ key: 'bearerAuth',
409
+ scheme: 'bearer',
410
+ type: 'http'
411
+ }
412
+ ],
413
+ url: '/client-labels',
414
+ ...options
415
+ });
416
+ }
417
+ /**
418
+ * Create a label
419
+ *
420
+ * Adds a manual label to the location, as Settings → Labels does, ready for POST /clients/{id}/labels. If the location already has a label of that name (ignoring case), that label is returned instead with a 200, restored if it was archived, and its colour is left as it is. Needs `labels:manage`.
421
+ */
422
+ createClientLabel(options) {
423
+ return (options.client ?? this.client).post({
424
+ security: [
425
+ {
426
+ key: 'oauth2',
427
+ scheme: 'bearer',
428
+ type: 'http'
429
+ },
430
+ { name: 'x-api-key', type: 'apiKey' },
431
+ {
432
+ key: 'bearerAuth',
433
+ scheme: 'bearer',
434
+ type: 'http'
435
+ }
436
+ ],
437
+ url: '/client-labels',
438
+ ...options,
439
+ headers: {
440
+ 'Content-Type': 'application/json',
441
+ ...options.headers
442
+ }
443
+ });
444
+ }
445
+ /**
446
+ * List a client's notes
447
+ *
448
+ * Newest first; pages don't repeat or skip items when new ones are added meanwhile. Includes notes imported from the booking platform. Needs `notes:read`. Only for clients at the key's location: any other id is a 404.
449
+ */
450
+ listClientNotes(options) {
451
+ return (options.client ?? this.client).get({
452
+ security: [
453
+ {
454
+ key: 'oauth2',
455
+ scheme: 'bearer',
456
+ type: 'http'
457
+ },
458
+ { name: 'x-api-key', type: 'apiKey' },
459
+ {
460
+ key: 'bearerAuth',
461
+ scheme: 'bearer',
462
+ type: 'http'
463
+ }
464
+ ],
465
+ url: '/clients/{id}/notes',
466
+ ...options
467
+ });
468
+ }
469
+ /**
470
+ * Add a note
471
+ *
472
+ * Adds a note as the key's owner, exactly as the Note tab does: it shows on the client's timeline and counts as the team being in touch. Needs `notes:write`. Only for clients at the key's location: any other id is a 404.
473
+ */
474
+ createClientNote(options) {
475
+ return (options.client ?? this.client).post({
476
+ security: [
477
+ {
478
+ key: 'oauth2',
479
+ scheme: 'bearer',
480
+ type: 'http'
481
+ },
482
+ { name: 'x-api-key', type: 'apiKey' },
483
+ {
484
+ key: 'bearerAuth',
485
+ scheme: 'bearer',
486
+ type: 'http'
487
+ }
488
+ ],
489
+ url: '/clients/{id}/notes',
490
+ ...options,
491
+ headers: {
492
+ 'Content-Type': 'application/json',
493
+ ...options.headers
494
+ }
495
+ });
496
+ }
497
+ /**
498
+ * Pin a note
499
+ *
500
+ * Pins it to the top of the client's profile, unpinning whichever note was pinned before. Needs `notes:write`. Only for notes at the key's location: any other id is a 404.
501
+ */
502
+ pinNote(options) {
503
+ return (options.client ?? this.client).post({
504
+ security: [
505
+ {
506
+ key: 'oauth2',
507
+ scheme: 'bearer',
508
+ type: 'http'
509
+ },
510
+ { name: 'x-api-key', type: 'apiKey' },
511
+ {
512
+ key: 'bearerAuth',
513
+ scheme: 'bearer',
514
+ type: 'http'
515
+ }
516
+ ],
517
+ url: '/notes/{note_id}/pin',
518
+ ...options
519
+ });
520
+ }
521
+ /**
522
+ * Unpin a note
523
+ *
524
+ * Unpinning a note that isn't pinned changes nothing. Needs `notes:write`. Only for notes at the key's location: any other id is a 404.
525
+ */
526
+ unpinNote(options) {
527
+ return (options.client ?? this.client).post({
528
+ security: [
529
+ {
530
+ key: 'oauth2',
531
+ scheme: 'bearer',
532
+ type: 'http'
533
+ },
534
+ { name: 'x-api-key', type: 'apiKey' },
535
+ {
536
+ key: 'bearerAuth',
537
+ scheme: 'bearer',
538
+ type: 'http'
539
+ }
540
+ ],
541
+ url: '/notes/{note_id}/unpin',
542
+ ...options
543
+ });
544
+ }
545
+ /**
546
+ * List a client's interactions
547
+ *
548
+ * Calls, in-person conversations and messages the team logged, including contact logs imported from the booking platform. Snoozes, flags, assignments and other changes on the profile aren't contact and aren't listed. Newest first; pages don't repeat or skip items when new ones are added meanwhile. (ordered by when they were logged). Notes are at /clients/{id}/notes; messages sent through Recovr aren't listed here. Needs `notes:read`. Only for clients at the key's location: any other id is a 404.
549
+ */
550
+ listClientInteractions(options) {
551
+ return (options.client ?? this.client).get({
552
+ security: [
553
+ {
554
+ key: 'oauth2',
555
+ scheme: 'bearer',
556
+ type: 'http'
557
+ },
558
+ { name: 'x-api-key', type: 'apiKey' },
559
+ {
560
+ key: 'bearerAuth',
561
+ scheme: 'bearer',
562
+ type: 'http'
563
+ }
564
+ ],
565
+ url: '/clients/{id}/interactions',
566
+ ...options
567
+ });
568
+ }
569
+ /**
570
+ * Log an interaction
571
+ *
572
+ * Records contact the team had with the client, as the key's owner: a `call` (as the profile's Call tab logs it), an `in_person` conversation (the Interact tab) or a `message` sent outside Recovr by `email`, `sms` or `whatsapp`. It counts as contact made in reports and Next Up, and doesn't send anything to the client. Needs `notes:write`. Only for clients at the key's location: any other id is a 404.
573
+ */
574
+ createClientInteraction(options) {
575
+ return (options.client ?? this.client).post({
576
+ security: [
577
+ {
578
+ key: 'oauth2',
579
+ scheme: 'bearer',
580
+ type: 'http'
581
+ },
582
+ { name: 'x-api-key', type: 'apiKey' },
583
+ {
584
+ key: 'bearerAuth',
585
+ scheme: 'bearer',
586
+ type: 'http'
587
+ }
588
+ ],
589
+ url: '/clients/{id}/interactions',
590
+ ...options,
591
+ headers: {
592
+ 'Content-Type': 'application/json',
593
+ ...options.headers
594
+ }
595
+ });
596
+ }
597
+ /**
598
+ * List a client's open reminders
599
+ *
600
+ * Reminders the team still has to tick off for this client. Newest first; pages don't repeat or skip items when new ones are added meanwhile. Closed reminders aren't listed. Needs `notes:read`. Only for clients at the key's location: any other id is a 404.
601
+ */
602
+ listClientReminders(options) {
603
+ return (options.client ?? this.client).get({
604
+ security: [
605
+ {
606
+ key: 'oauth2',
607
+ scheme: 'bearer',
608
+ type: 'http'
609
+ },
610
+ { name: 'x-api-key', type: 'apiKey' },
611
+ {
612
+ key: 'bearerAuth',
613
+ scheme: 'bearer',
614
+ type: 'http'
615
+ }
616
+ ],
617
+ url: '/clients/{id}/reminders',
618
+ ...options
619
+ });
620
+ }
621
+ /**
622
+ * Set a reminder
623
+ *
624
+ * A reminder for the team about this client, set as the key's owner: due at a time (`due_kind: "date"`, it comes up in Next Up), at their next class (`due_kind: "next_class"`, it's shown on the class list), or now with no particular time (`due_kind: "now"`). Name a team member in `assigned_to` to give it to them, as the app's Assign picker does. Needs `notes:write`. Only for clients at the key's location: any other id is a 404.
625
+ */
626
+ createClientReminder(options) {
627
+ return (options.client ?? this.client).post({
628
+ security: [
629
+ {
630
+ key: 'oauth2',
631
+ scheme: 'bearer',
632
+ type: 'http'
633
+ },
634
+ { name: 'x-api-key', type: 'apiKey' },
635
+ {
636
+ key: 'bearerAuth',
637
+ scheme: 'bearer',
638
+ type: 'http'
639
+ }
640
+ ],
641
+ url: '/clients/{id}/reminders',
642
+ ...options,
643
+ headers: {
644
+ 'Content-Type': 'application/json',
645
+ ...options.headers
646
+ }
647
+ });
648
+ }
649
+ /**
650
+ * Get a reminder
651
+ *
652
+ * One reminder, open or ticked off. Needs `notes:read`. Only for reminders at the key's location: any other id is a 404.
653
+ */
654
+ getReminder(options) {
655
+ return (options.client ?? this.client).get({
656
+ security: [
657
+ {
658
+ key: 'oauth2',
659
+ scheme: 'bearer',
660
+ type: 'http'
661
+ },
662
+ { name: 'x-api-key', type: 'apiKey' },
663
+ {
664
+ key: 'bearerAuth',
665
+ scheme: 'bearer',
666
+ type: 'http'
667
+ }
668
+ ],
669
+ url: '/reminders/{id}',
670
+ ...options
671
+ });
672
+ }
673
+ /**
674
+ * Change a reminder
675
+ *
676
+ * Changes the due time, the note, or both, on an open dated reminder; what you leave out stays. Moving the time re-arms it. A next-class reminder has no time to change (400). Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
677
+ */
678
+ updateReminder(options) {
679
+ return (options.client ?? this.client).patch({
680
+ security: [
681
+ {
682
+ key: 'oauth2',
683
+ scheme: 'bearer',
684
+ type: 'http'
685
+ },
686
+ { name: 'x-api-key', type: 'apiKey' },
687
+ {
688
+ key: 'bearerAuth',
689
+ scheme: 'bearer',
690
+ type: 'http'
691
+ }
692
+ ],
693
+ url: '/reminders/{id}',
694
+ ...options,
695
+ headers: {
696
+ 'Content-Type': 'application/json',
697
+ ...options.headers
698
+ }
699
+ });
700
+ }
701
+ /**
702
+ * Close a reminder
703
+ *
704
+ * Ticks it off as the key's owner. It doesn't snooze the client. The body is optional. Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
705
+ */
706
+ closeReminder(options) {
707
+ return (options.client ?? this.client).post({
708
+ security: [
709
+ {
710
+ key: 'oauth2',
711
+ scheme: 'bearer',
712
+ type: 'http'
713
+ },
714
+ { name: 'x-api-key', type: 'apiKey' },
715
+ {
716
+ key: 'bearerAuth',
717
+ scheme: 'bearer',
718
+ type: 'http'
719
+ }
720
+ ],
721
+ url: '/reminders/{id}/close',
722
+ ...options,
723
+ headers: {
724
+ 'Content-Type': 'application/json',
725
+ ...options.headers
726
+ }
727
+ });
728
+ }
729
+ /**
730
+ * Reassign a reminder
731
+ *
732
+ * Gives an open reminder to another team member, or to the whole team with `assigned_to: null`, as the key's owner. The new person is told it was given to them, as when a reminder is set for them, unless they're the key's owner. Giving it to whoever has it already changes nothing. A ticked-off reminder can't be reassigned (409). Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
733
+ */
734
+ assignReminder(options) {
735
+ return (options.client ?? this.client).post({
736
+ security: [
737
+ {
738
+ key: 'oauth2',
739
+ scheme: 'bearer',
740
+ type: 'http'
741
+ },
742
+ { name: 'x-api-key', type: 'apiKey' },
743
+ {
744
+ key: 'bearerAuth',
745
+ scheme: 'bearer',
746
+ type: 'http'
747
+ }
748
+ ],
749
+ url: '/reminders/{id}/assign',
750
+ ...options,
751
+ headers: {
752
+ 'Content-Type': 'application/json',
753
+ ...options.headers
754
+ }
755
+ });
756
+ }
757
+ /**
758
+ * List the location's reminders
759
+ *
760
+ * Every reminder at the key's location, for any client still on the books: the team's task list. Filter by who it's for, the client, how and when it's due, and whether it's done. Pages don't repeat or skip items when new ones are added meanwhile. Today's due reminders, ranked with the rest of the day's work, are in GET /next-up. Needs `notes:read`.
761
+ */
762
+ listReminders(options) {
763
+ return (options?.client ?? this.client).get({
764
+ security: [
765
+ {
766
+ key: 'oauth2',
767
+ scheme: 'bearer',
768
+ type: 'http'
769
+ },
770
+ { name: 'x-api-key', type: 'apiKey' },
771
+ {
772
+ key: 'bearerAuth',
773
+ scheme: 'bearer',
774
+ type: 'http'
775
+ }
776
+ ],
777
+ url: '/reminders',
778
+ ...options
779
+ });
780
+ }
781
+ /**
782
+ * List forms
783
+ *
784
+ * The location's published forms, newest first. Use a form's id to list its submissions. Needs `forms:read`.
785
+ */
786
+ listForms(options) {
787
+ return (options?.client ?? this.client).get({
788
+ security: [
789
+ {
790
+ key: 'oauth2',
791
+ scheme: 'bearer',
792
+ type: 'http'
793
+ },
794
+ { name: 'x-api-key', type: 'apiKey' },
795
+ {
796
+ key: 'bearerAuth',
797
+ scheme: 'bearer',
798
+ type: 'http'
799
+ }
800
+ ],
801
+ url: '/forms',
802
+ ...options
803
+ });
804
+ }
805
+ /**
806
+ * Get a form
807
+ *
808
+ * One form with the questions it asks. Works for forms that are no longer published, so older submissions can still be read. Needs `forms:read`.
809
+ */
810
+ getForm(options) {
811
+ return (options.client ?? this.client).get({
812
+ security: [
813
+ {
814
+ key: 'oauth2',
815
+ scheme: 'bearer',
816
+ type: 'http'
817
+ },
818
+ { name: 'x-api-key', type: 'apiKey' },
819
+ {
820
+ key: 'bearerAuth',
821
+ scheme: 'bearer',
822
+ type: 'http'
823
+ }
824
+ ],
825
+ url: '/forms/{id}',
826
+ ...options
827
+ });
828
+ }
829
+ /**
830
+ * List a form's submissions
831
+ *
832
+ * Newest first, or with `after_id` oldest first from that id, which is how to fetch new submissions. Includes anonymous answers (for example to the Feedback form), which have a null `client_id`. Answers can contain contact and health details. Pages hold steady while new submissions arrive: none is repeated or skipped. Needs `forms:read`.
833
+ */
834
+ listFormSubmissions(options) {
835
+ return (options.client ?? this.client).get({
836
+ security: [
837
+ {
838
+ key: 'oauth2',
839
+ scheme: 'bearer',
840
+ type: 'http'
841
+ },
842
+ { name: 'x-api-key', type: 'apiKey' },
843
+ {
844
+ key: 'bearerAuth',
845
+ scheme: 'bearer',
846
+ type: 'http'
847
+ }
848
+ ],
849
+ url: '/forms/{id}/submissions',
850
+ ...options
851
+ });
852
+ }
853
+ /**
854
+ * List a client's form submissions
855
+ *
856
+ * Every form this client has submitted, newest first (or with `after_id`, oldest first from that id), with their answers. Anonymous answers are never attached to a client. Answers can contain contact and health details. Needs `forms:read`.
857
+ */
858
+ listClientFormSubmissions(options) {
859
+ return (options.client ?? this.client).get({
860
+ security: [
861
+ {
862
+ key: 'oauth2',
863
+ scheme: 'bearer',
864
+ type: 'http'
865
+ },
866
+ { name: 'x-api-key', type: 'apiKey' },
867
+ {
868
+ key: 'bearerAuth',
869
+ scheme: 'bearer',
870
+ type: 'http'
871
+ }
872
+ ],
873
+ url: '/clients/{id}/form-submissions',
874
+ ...options
875
+ });
876
+ }
877
+ /**
878
+ * Get a form submission
879
+ *
880
+ * One submission with its answers. Answers can contain contact and health details. Needs `forms:read`.
881
+ */
882
+ getFormSubmission(options) {
883
+ return (options.client ?? this.client).get({
884
+ security: [
885
+ {
886
+ key: 'oauth2',
887
+ scheme: 'bearer',
888
+ type: 'http'
889
+ },
890
+ { name: 'x-api-key', type: 'apiKey' },
891
+ {
892
+ key: 'bearerAuth',
893
+ scheme: 'bearer',
894
+ type: 'http'
895
+ }
896
+ ],
897
+ url: '/form-submissions/{id}',
898
+ ...options
899
+ });
900
+ }
901
+ /**
902
+ * Member and risk counts
903
+ *
904
+ * The location's counts as of now: active members (the gym's member count), trials and holds beside it, and how many clients are in each risk band, non-attenders, conversions and renewals. These are the numbers Recovr's own reports, Recovr AI and its MCP retention summary give. Needs `clients:read`.
905
+ *
906
+ * The risk, non-attender, conversion and renewal counts hold only clients the gym shows in reports, as the Clients page's counts do, so they don't add up to `active_members`. GET /clients with the matching `risk_level` lists the same people: its `total` is the count.
907
+ */
908
+ getSummary(options) {
909
+ return (options?.client ?? this.client).get({
910
+ security: [
911
+ {
912
+ key: 'oauth2',
913
+ scheme: 'bearer',
914
+ type: 'http'
915
+ },
916
+ { name: 'x-api-key', type: 'apiKey' },
917
+ {
918
+ key: 'bearerAuth',
919
+ scheme: 'bearer',
920
+ type: 'http'
921
+ }
922
+ ],
923
+ url: '/summary',
924
+ ...options
925
+ });
926
+ }
927
+ /**
928
+ * List the team's activity
929
+ *
930
+ * Everything the team did with clients at the key's location, newest first: messages sent through Recovr, calls, visits and messages logged, notes, snoozes, assignments, flags and Next Up cards ticked off, each with the team member who did it. For team dashboards and KPIs; GET /reports/actions has the Actions Report's totals. Needs `notes:read`.
931
+ *
932
+ * Messages sent through Recovr: every SMS, and emails, WhatsApp, Instagram and Messenger messages a team member or Recovr AI sent. A workflow's email and other non-SMS messages aren't listed. Messages a client sends aren't activity. Label changes aren't listed yet.
933
+ *
934
+ * Pages don't repeat or skip items when new ones are added meanwhile.
935
+ */
936
+ listActivity(options) {
937
+ return (options?.client ?? this.client).get({
938
+ security: [
939
+ {
940
+ key: 'oauth2',
941
+ scheme: 'bearer',
942
+ type: 'http'
943
+ },
944
+ { name: 'x-api-key', type: 'apiKey' },
945
+ {
946
+ key: 'bearerAuth',
947
+ scheme: 'bearer',
948
+ type: 'http'
949
+ }
950
+ ],
951
+ url: '/activity',
952
+ ...options
953
+ });
954
+ }
955
+ /**
956
+ * Actions Report
957
+ *
958
+ * The app's Actions Report for a date range: texts, calls and notes, per team member and per day, week or month, counted exactly as the report in Recovr counts them. Dates are the location's. For each action itself, use GET /activity. Needs `notes:read`.
959
+ */
960
+ getActionsReport(options) {
961
+ return (options.client ?? this.client).get({
962
+ security: [
963
+ {
964
+ key: 'oauth2',
965
+ scheme: 'bearer',
966
+ type: 'http'
967
+ },
968
+ { name: 'x-api-key', type: 'apiKey' },
969
+ {
970
+ key: 'bearerAuth',
971
+ scheme: 'bearer',
972
+ type: 'http'
973
+ }
974
+ ],
975
+ url: '/reports/actions',
976
+ ...options
977
+ });
978
+ }
979
+ /**
980
+ * List leads
981
+ *
982
+ * Leads at the credential's location, newest enquiry first, filtered the way the Leads page filters them. Every filter you send must match (AND). Needs `leads:read`; `answers` and searching by email or phone also need `contact_details:read`.
983
+ *
984
+ * One lead is one enquiry, so a person who enquired twice appears twice; the Leads page groups them by person. Filter by `client_id` for one person's enquiries.
985
+ */
986
+ listLeads(options) {
987
+ return (options?.client ?? this.client).get({
988
+ security: [
989
+ {
990
+ key: 'oauth2',
991
+ scheme: 'bearer',
992
+ type: 'http'
993
+ },
994
+ { name: 'x-api-key', type: 'apiKey' },
995
+ {
996
+ key: 'bearerAuth',
997
+ scheme: 'bearer',
998
+ type: 'http'
999
+ }
1000
+ ],
1001
+ url: '/leads',
1002
+ ...options
1003
+ });
1004
+ }
1005
+ /**
1006
+ * Add a lead
1007
+ *
1008
+ * Adds a lead from another system, such as a quiz or a website form. Recovr matches it to an existing client at the location by email (or by phone, when the first name matches too); otherwise it makes a new client, who appears on the Leads board. A new lead starts the location's Lead received workflows once, with the source "Recovr API". Sending the same `external_id` again is safe: it adds nothing and starts nothing. Send an email or a phone number. Needs `clients:write` and `contact_details:read`. At most 60 leads a minute per location (`rate_limited`). Refusals: `invalid_phone` (a phone-only lead whose number can't be read).
1009
+ */
1010
+ createLead(options) {
1011
+ return (options.client ?? this.client).post({
1012
+ security: [
1013
+ {
1014
+ key: 'oauth2',
1015
+ scheme: 'bearer',
1016
+ type: 'http'
1017
+ },
1018
+ { name: 'x-api-key', type: 'apiKey' },
1019
+ {
1020
+ key: 'bearerAuth',
1021
+ scheme: 'bearer',
1022
+ type: 'http'
1023
+ }
1024
+ ],
1025
+ url: '/leads',
1026
+ ...options,
1027
+ headers: {
1028
+ 'Content-Type': 'application/json',
1029
+ ...options.headers
1030
+ }
1031
+ });
1032
+ }
1033
+ /**
1034
+ * Get a lead
1035
+ *
1036
+ * One lead at the credential's location. Needs `leads:read`; `answers` is included only with `contact_details:read`. A lead at another location is a 404.
1037
+ */
1038
+ getLead(options) {
1039
+ return (options.client ?? this.client).get({
1040
+ security: [
1041
+ {
1042
+ key: 'oauth2',
1043
+ scheme: 'bearer',
1044
+ type: 'http'
1045
+ },
1046
+ { name: 'x-api-key', type: 'apiKey' },
1047
+ {
1048
+ key: 'bearerAuth',
1049
+ scheme: 'bearer',
1050
+ type: 'http'
1051
+ }
1052
+ ],
1053
+ url: '/leads/{id}',
1054
+ ...options
1055
+ });
1056
+ }
1057
+ /**
1058
+ * List lead sources
1059
+ *
1060
+ * Where this location's leads have come from: the sources, forms, campaigns, ad sets and ads the Leads page offers as filters, each usable as a GET /leads filter. Lead statuses aren't configured per location: they are `new`, `visited` and `member` everywhere (see `status` on a Lead). Needs `leads:read`.
1061
+ */
1062
+ listLeadSources(options) {
1063
+ return (options?.client ?? this.client).get({
1064
+ security: [
1065
+ {
1066
+ key: 'oauth2',
1067
+ scheme: 'bearer',
1068
+ type: 'http'
1069
+ },
1070
+ { name: 'x-api-key', type: 'apiKey' },
1071
+ {
1072
+ key: 'bearerAuth',
1073
+ scheme: 'bearer',
1074
+ type: 'http'
1075
+ }
1076
+ ],
1077
+ url: '/lead-sources',
1078
+ ...options
1079
+ });
1080
+ }
1081
+ /**
1082
+ * Archive a lead
1083
+ *
1084
+ * Archives one enquiry, as the Leads page's archive does for a junk or dealt-with lead: it leaves the list (unless asked for) and is never deleted. Archiving an archived lead changes nothing. The client, their other enquiries and their workflows aren't touched. Needs `leads:write`. A lead at another location is a 404.
1085
+ */
1086
+ archiveLead(options) {
1087
+ return (options.client ?? this.client).post({
1088
+ security: [
1089
+ {
1090
+ key: 'oauth2',
1091
+ scheme: 'bearer',
1092
+ type: 'http'
1093
+ },
1094
+ { name: 'x-api-key', type: 'apiKey' },
1095
+ {
1096
+ key: 'bearerAuth',
1097
+ scheme: 'bearer',
1098
+ type: 'http'
1099
+ }
1100
+ ],
1101
+ url: '/leads/{id}/archive',
1102
+ ...options
1103
+ });
1104
+ }
1105
+ /**
1106
+ * Restore a lead
1107
+ *
1108
+ * Restores an archived enquiry to the Leads list. Restoring a lead that isn't archived changes nothing. Needs `leads:write`. A lead at another location is a 404.
1109
+ */
1110
+ unarchiveLead(options) {
1111
+ return (options.client ?? this.client).post({
1112
+ security: [
1113
+ {
1114
+ key: 'oauth2',
1115
+ scheme: 'bearer',
1116
+ type: 'http'
1117
+ },
1118
+ { name: 'x-api-key', type: 'apiKey' },
1119
+ {
1120
+ key: 'bearerAuth',
1121
+ scheme: 'bearer',
1122
+ type: 'http'
1123
+ }
1124
+ ],
1125
+ url: '/leads/{id}/unarchive',
1126
+ ...options
1127
+ });
1128
+ }
1129
+ /**
1130
+ * Archive a client's leads
1131
+ *
1132
+ * Archives every enquiry this client has at the location, as archiving a person's row on the Leads page does, whatever filters you used to find them. Needs `leads:write`. A client at another location, or with no leads here, is a 404.
1133
+ */
1134
+ archiveClientLeads(options) {
1135
+ return (options.client ?? this.client).post({
1136
+ security: [
1137
+ {
1138
+ key: 'oauth2',
1139
+ scheme: 'bearer',
1140
+ type: 'http'
1141
+ },
1142
+ { name: 'x-api-key', type: 'apiKey' },
1143
+ {
1144
+ key: 'bearerAuth',
1145
+ scheme: 'bearer',
1146
+ type: 'http'
1147
+ }
1148
+ ],
1149
+ url: '/clients/{id}/leads/archive',
1150
+ ...options
1151
+ });
1152
+ }
1153
+ /**
1154
+ * Restore a client's leads
1155
+ *
1156
+ * Restores every archived enquiry this client has at the location. Needs `leads:write`. A client at another location, or with no leads here, is a 404.
1157
+ */
1158
+ unarchiveClientLeads(options) {
1159
+ return (options.client ?? this.client).post({
1160
+ security: [
1161
+ {
1162
+ key: 'oauth2',
1163
+ scheme: 'bearer',
1164
+ type: 'http'
1165
+ },
1166
+ { name: 'x-api-key', type: 'apiKey' },
1167
+ {
1168
+ key: 'bearerAuth',
1169
+ scheme: 'bearer',
1170
+ type: 'http'
1171
+ }
1172
+ ],
1173
+ url: '/clients/{id}/leads/unarchive',
1174
+ ...options
1175
+ });
1176
+ }
1177
+ /**
1178
+ * List a client's possible duplicates
1179
+ *
1180
+ * Other clients at the location who share this client's email or phone (at most 5): who a lead's Needs merge flag is about. Merging happens in the booking platform; if they aren't the same person, POST /clients/{id}/not-duplicate clears the flag. Needs `leads:read`. A client at another location is a 404.
1181
+ */
1182
+ listPossibleDuplicates(options) {
1183
+ return (options.client ?? this.client).get({
1184
+ security: [
1185
+ {
1186
+ key: 'oauth2',
1187
+ scheme: 'bearer',
1188
+ type: 'http'
1189
+ },
1190
+ { name: 'x-api-key', type: 'apiKey' },
1191
+ {
1192
+ key: 'bearerAuth',
1193
+ scheme: 'bearer',
1194
+ type: 'http'
1195
+ }
1196
+ ],
1197
+ url: '/clients/{id}/possible-duplicates',
1198
+ ...options
1199
+ });
1200
+ }
1201
+ /**
1202
+ * Clear Needs merge
1203
+ *
1204
+ * Records that this client isn't the same person as the clients sharing their email or phone, as "Not the same person" on the Leads page does: Needs merge is cleared on all of the client's leads. Clearing it when nothing is flagged changes nothing. Needs `leads:write`. A client at another location is a 404.
1205
+ */
1206
+ markNotDuplicate(options) {
1207
+ return (options.client ?? this.client).post({
1208
+ security: [
1209
+ {
1210
+ key: 'oauth2',
1211
+ scheme: 'bearer',
1212
+ type: 'http'
1213
+ },
1214
+ { name: 'x-api-key', type: 'apiKey' },
1215
+ {
1216
+ key: 'bearerAuth',
1217
+ scheme: 'bearer',
1218
+ type: 'http'
1219
+ }
1220
+ ],
1221
+ url: '/clients/{id}/not-duplicate',
1222
+ ...options
1223
+ });
1224
+ }
1225
+ /**
1226
+ * List conversations (the inbox)
1227
+ *
1228
+ * The location's inbox, newest activity first: one conversation per client per channel (SMS, email, WhatsApp, Instagram, Messenger and the rest), with the newest message and whether it's unread or awaiting a reply. Only conversations with at least one message are listed. Needs `conversations:read`; `contact_address` also needs `contact_details:read`.
1229
+ *
1230
+ * Pages don't repeat or skip conversations when new messages arrive meanwhile: a conversation that gets a new message moves to the top, ahead of the page you are on.
1231
+ *
1232
+ * Filter by `status`, `unread`, `awaiting_reply`, `needs_reply`, `client_id`, the kind of `channel` (`sms`, `email`…) or one `channel_id` from GET /channels. Filters combine with AND.
1233
+ */
1234
+ listConversations(options) {
1235
+ return (options?.client ?? this.client).get({
1236
+ security: [
1237
+ {
1238
+ key: 'oauth2',
1239
+ scheme: 'bearer',
1240
+ type: 'http'
1241
+ },
1242
+ { name: 'x-api-key', type: 'apiKey' },
1243
+ {
1244
+ key: 'bearerAuth',
1245
+ scheme: 'bearer',
1246
+ type: 'http'
1247
+ }
1248
+ ],
1249
+ url: '/conversations',
1250
+ ...options
1251
+ });
1252
+ }
1253
+ /**
1254
+ * Get a conversation
1255
+ *
1256
+ * One conversation at the credential's location. Needs `conversations:read`. A conversation at another location is a 404.
1257
+ */
1258
+ getConversation(options) {
1259
+ return (options.client ?? this.client).get({
1260
+ security: [
1261
+ {
1262
+ key: 'oauth2',
1263
+ scheme: 'bearer',
1264
+ type: 'http'
1265
+ },
1266
+ { name: 'x-api-key', type: 'apiKey' },
1267
+ {
1268
+ key: 'bearerAuth',
1269
+ scheme: 'bearer',
1270
+ type: 'http'
1271
+ }
1272
+ ],
1273
+ url: '/conversations/{id}',
1274
+ ...options
1275
+ });
1276
+ }
1277
+ /**
1278
+ * List a conversation's messages
1279
+ *
1280
+ * Every message in one conversation, newest first: what the client sent in (`inbound`) and what the location sent (`outbound`, by staff, Recovr AI, a workflow, or from outside Recovr). Drafts not yet sent aren't listed. Needs `conversations:read`; `from_address` and `to_address` also need `contact_details:read`. A conversation at another location is a 404.
1281
+ *
1282
+ * Filter by `direction`, delivery `status` (`failed` finds sends that didn't arrive) or `channel_id` (one number of several in an SMS conversation). A client's conversations on other channels are listed by GET /conversations?client_id=…. Reading messages here doesn't mark them read in Recovr; POST /conversations/{id}/read does.
1283
+ */
1284
+ listConversationMessages(options) {
1285
+ return (options.client ?? this.client).get({
1286
+ security: [
1287
+ {
1288
+ key: 'oauth2',
1289
+ scheme: 'bearer',
1290
+ type: 'http'
1291
+ },
1292
+ { name: 'x-api-key', type: 'apiKey' },
1293
+ {
1294
+ key: 'bearerAuth',
1295
+ scheme: 'bearer',
1296
+ type: 'http'
1297
+ }
1298
+ ],
1299
+ url: '/conversations/{id}/messages',
1300
+ ...options
1301
+ });
1302
+ }
1303
+ /**
1304
+ * Reply to a conversation
1305
+ *
1306
+ * Sends a message to the client in this conversation, on its own channel (SMS, email, WhatsApp, Instagram, Messenger…), from the channel it last used unless you name one. It reaches a real person and can't be undone, and it appears in the inbox and the client's timeline as sent by you through this app or token. Needs `messages:send`. A conversation at another location is a 404.
1307
+ *
1308
+ * The send is checked as one from Recovr AI is: a client with do-not-contact on for the channel is refused (`do_not_contact`); a client on a bulk send that is waiting, going or paused is refused (`in_bulk_send`); and, unless the client messaged the location in the last day, the same text can't go to more than 3 other people a day (`same_text_limit`) and only a limited number of messages can go out in any ten minutes (`outreach_limited`, with `Retry-After`). The location's own sending rules then apply: a channel with sending turned off, an opted-out client, Meta's reply window for Instagram, Messenger and WhatsApp, credits. Those refusals are a 422 with the reason (`send_refused` or a more specific code).
1309
+ *
1310
+ * Send an `Idempotency-Key` and never retry a send without one: after a timeout or a 5xx, read the conversation's messages to see whether it went before sending again.
1311
+ */
1312
+ replyToConversation(options) {
1313
+ return (options.client ?? this.client).post({
1314
+ security: [
1315
+ {
1316
+ key: 'oauth2',
1317
+ scheme: 'bearer',
1318
+ type: 'http'
1319
+ },
1320
+ { name: 'x-api-key', type: 'apiKey' },
1321
+ {
1322
+ key: 'bearerAuth',
1323
+ scheme: 'bearer',
1324
+ type: 'http'
1325
+ }
1326
+ ],
1327
+ url: '/conversations/{id}/messages',
1328
+ ...options,
1329
+ headers: {
1330
+ 'Content-Type': 'application/json',
1331
+ ...options.headers
1332
+ }
1333
+ });
1334
+ }
1335
+ /**
1336
+ * Send a message to a client
1337
+ *
1338
+ * Sends one text or email to a client, as the message box on a client's profile does, whether or not you've messaged them before. Name the channel by `channel_id` (GET /channels) or by kind with `channel`. A new message goes by SMS or email only, the channels the outreach checks cover; on WhatsApp, Instagram or Messenger, reply in the client's conversation instead. It goes to the client's phone number or email, lands in their conversation for it (a new one if there is none), reaches a real person and can't be undone. It appears in the inbox and the client's timeline as sent by you through this app or token. Needs `messages:send`. A client at another location is a 404.
1339
+ *
1340
+ * The same checks apply as to a reply: do-not-contact for the channel (`do_not_contact`), an open bulk send (`in_bulk_send`), the same text to many people (`same_text_limit`), the outreach cap (`outreach_limited`, with `Retry-After`), then the location's own sending rules (sending turned off, an opted-out client, Meta's messaging window, credits), refused as a 422 with the reason. A message to someone who hasn't written in the last day counts toward the outreach cap.
1341
+ *
1342
+ * Send an `Idempotency-Key` and never retry a send without one: after a timeout or a 5xx, check the client's conversations before sending again.
1343
+ */
1344
+ sendClientMessage(options) {
1345
+ return (options.client ?? this.client).post({
1346
+ security: [
1347
+ {
1348
+ key: 'oauth2',
1349
+ scheme: 'bearer',
1350
+ type: 'http'
1351
+ },
1352
+ { name: 'x-api-key', type: 'apiKey' },
1353
+ {
1354
+ key: 'bearerAuth',
1355
+ scheme: 'bearer',
1356
+ type: 'http'
1357
+ }
1358
+ ],
1359
+ url: '/clients/{id}/messages',
1360
+ ...options,
1361
+ headers: {
1362
+ 'Content-Type': 'application/json',
1363
+ ...options.headers
1364
+ }
1365
+ });
1366
+ }
1367
+ /**
1368
+ * Mark a conversation read
1369
+ *
1370
+ * Marks the conversation's messages read, as opening it in the inbox does, and clears its unread badge for the team. For an Instagram or Messenger conversation the change is passed on to the platform where the connection supports it. Marking a read conversation read changes nothing. Needs `conversations:write`. A conversation at another location is a 404.
1371
+ */
1372
+ markConversationRead(options) {
1373
+ return (options.client ?? this.client).post({
1374
+ security: [
1375
+ {
1376
+ key: 'oauth2',
1377
+ scheme: 'bearer',
1378
+ type: 'http'
1379
+ },
1380
+ { name: 'x-api-key', type: 'apiKey' },
1381
+ {
1382
+ key: 'bearerAuth',
1383
+ scheme: 'bearer',
1384
+ type: 'http'
1385
+ }
1386
+ ],
1387
+ url: '/conversations/{id}/read',
1388
+ ...options
1389
+ });
1390
+ }
1391
+ /**
1392
+ * Mark a conversation unread
1393
+ *
1394
+ * Marks the client's newest message unread, as Mark as unread in the inbox does, so the conversation shows as unread for the team. A conversation with no message from the client is left as it is. Needs `conversations:write`. A conversation at another location is a 404.
1395
+ */
1396
+ markConversationUnread(options) {
1397
+ return (options.client ?? this.client).post({
1398
+ security: [
1399
+ {
1400
+ key: 'oauth2',
1401
+ scheme: 'bearer',
1402
+ type: 'http'
1403
+ },
1404
+ { name: 'x-api-key', type: 'apiKey' },
1405
+ {
1406
+ key: 'bearerAuth',
1407
+ scheme: 'bearer',
1408
+ type: 'http'
1409
+ }
1410
+ ],
1411
+ url: '/conversations/{id}/unread',
1412
+ ...options
1413
+ });
1414
+ }
1415
+ /**
1416
+ * Archive a conversation
1417
+ *
1418
+ * Moves the conversation out of the inbox into Archived, as Archive in the inbox does. It no longer awaits a reply, and it keeps its read or unread state. It comes back to the inbox by itself when the client writes again. For an Instagram or Messenger conversation the change is passed on to the platform where the connection supports it. Needs `conversations:write`. A conversation at another location is a 404.
1419
+ */
1420
+ archiveConversation(options) {
1421
+ return (options.client ?? this.client).post({
1422
+ security: [
1423
+ {
1424
+ key: 'oauth2',
1425
+ scheme: 'bearer',
1426
+ type: 'http'
1427
+ },
1428
+ { name: 'x-api-key', type: 'apiKey' },
1429
+ {
1430
+ key: 'bearerAuth',
1431
+ scheme: 'bearer',
1432
+ type: 'http'
1433
+ }
1434
+ ],
1435
+ url: '/conversations/{id}/archive',
1436
+ ...options
1437
+ });
1438
+ }
1439
+ /**
1440
+ * Unarchive a conversation
1441
+ *
1442
+ * Brings the conversation back to the inbox, as Unarchive does. When the client's message is still the newest it awaits a reply again, unless it was marked as needing no reply. Needs `conversations:write`. A conversation at another location is a 404.
1443
+ */
1444
+ unarchiveConversation(options) {
1445
+ return (options.client ?? this.client).post({
1446
+ security: [
1447
+ {
1448
+ key: 'oauth2',
1449
+ scheme: 'bearer',
1450
+ type: 'http'
1451
+ },
1452
+ { name: 'x-api-key', type: 'apiKey' },
1453
+ {
1454
+ key: 'bearerAuth',
1455
+ scheme: 'bearer',
1456
+ type: 'http'
1457
+ }
1458
+ ],
1459
+ url: '/conversations/{id}/unarchive',
1460
+ ...options
1461
+ });
1462
+ }
1463
+ /**
1464
+ * Undo no reply needed
1465
+ *
1466
+ * Clears the mark. When the client's message is still the newest and the conversation isn't archived, it awaits a reply again. A conversation with no mark is left as it is. Needs `conversations:write`. A conversation at another location is a 404.
1467
+ */
1468
+ undoConversationNoReplyNeeded(options) {
1469
+ return (options.client ?? this.client).delete({
1470
+ security: [
1471
+ {
1472
+ key: 'oauth2',
1473
+ scheme: 'bearer',
1474
+ type: 'http'
1475
+ },
1476
+ { name: 'x-api-key', type: 'apiKey' },
1477
+ {
1478
+ key: 'bearerAuth',
1479
+ scheme: 'bearer',
1480
+ type: 'http'
1481
+ }
1482
+ ],
1483
+ url: '/conversations/{id}/no-reply-needed',
1484
+ ...options
1485
+ });
1486
+ }
1487
+ /**
1488
+ * Mark a conversation as needing no reply
1489
+ *
1490
+ * Marks the client's waiting message as needing no answer, as Mark done does in the inbox: the conversation stops awaiting a reply until the client writes again, so it leaves Awaiting Reply and the client's "Owed a reply" Next Up moment, and Recovr AI's unsent reply draft for it is discarded.
1491
+ *
1492
+ * A conversation whose newest message isn't the client's is a 409 `not_awaiting_reply`. DELETE on the same path undoes it. Needs `conversations:write`. A conversation at another location is a 404.
1493
+ */
1494
+ markConversationNoReplyNeeded(options) {
1495
+ return (options.client ?? this.client).post({
1496
+ security: [
1497
+ {
1498
+ key: 'oauth2',
1499
+ scheme: 'bearer',
1500
+ type: 'http'
1501
+ },
1502
+ { name: 'x-api-key', type: 'apiKey' },
1503
+ {
1504
+ key: 'bearerAuth',
1505
+ scheme: 'bearer',
1506
+ type: 'http'
1507
+ }
1508
+ ],
1509
+ url: '/conversations/{id}/no-reply-needed',
1510
+ ...options,
1511
+ headers: {
1512
+ 'Content-Type': 'application/json',
1513
+ ...options.headers
1514
+ }
1515
+ });
1516
+ }
1517
+ /**
1518
+ * Link a conversation to a client
1519
+ *
1520
+ * Files the conversation and its messages under a client, as Assign to client in the inbox does: use it for a message from a number or account Recovr didn't match. Recovr remembers the match for later conversations: the phone number for SMS, WhatsApp and calls, the account for Instagram and Messenger. Linking to another client moves it; `null` unlinks it and forgets the match.
1521
+ *
1522
+ * A group conversation has many people in it, so it can't be linked (422 `group_conversation`). A `client_id` that isn't a client at the location is a 400. Needs `conversations:write`. A conversation at another location is a 404.
1523
+ */
1524
+ linkConversationToClient(options) {
1525
+ return (options.client ?? this.client).post({
1526
+ security: [
1527
+ {
1528
+ key: 'oauth2',
1529
+ scheme: 'bearer',
1530
+ type: 'http'
1531
+ },
1532
+ { name: 'x-api-key', type: 'apiKey' },
1533
+ {
1534
+ key: 'bearerAuth',
1535
+ scheme: 'bearer',
1536
+ type: 'http'
1537
+ }
1538
+ ],
1539
+ url: '/conversations/{id}/link-client',
1540
+ ...options,
1541
+ headers: {
1542
+ 'Content-Type': 'application/json',
1543
+ ...options.headers
1544
+ }
1545
+ });
1546
+ }
1547
+ /**
1548
+ * List communication channels
1549
+ *
1550
+ * The location's communication channels: SMS numbers, email addresses, WhatsApp, Instagram and Messenger accounts and the rest, with whether each is connected and can send. Default channels first. Every conversation and message names its channel as `channel_id`. Needs `channels:read`.
1551
+ */
1552
+ listChannels(options) {
1553
+ return (options?.client ?? this.client).get({
1554
+ security: [
1555
+ {
1556
+ key: 'oauth2',
1557
+ scheme: 'bearer',
1558
+ type: 'http'
1559
+ },
1560
+ { name: 'x-api-key', type: 'apiKey' },
1561
+ {
1562
+ key: 'bearerAuth',
1563
+ scheme: 'bearer',
1564
+ type: 'http'
1565
+ }
1566
+ ],
1567
+ url: '/channels',
1568
+ ...options
1569
+ });
1570
+ }
1571
+ /**
1572
+ * Get a communication channel
1573
+ *
1574
+ * One of the location's channels, connected or not, for resolving the `channel_id` on a conversation or message. Needs `channels:read`. A channel at another location, or one removed in Settings → Communication Channels, is a 404.
1575
+ */
1576
+ getChannel(options) {
1577
+ return (options.client ?? this.client).get({
1578
+ security: [
1579
+ {
1580
+ key: 'oauth2',
1581
+ scheme: 'bearer',
1582
+ type: 'http'
1583
+ },
1584
+ { name: 'x-api-key', type: 'apiKey' },
1585
+ {
1586
+ key: 'bearerAuth',
1587
+ scheme: 'bearer',
1588
+ type: 'http'
1589
+ }
1590
+ ],
1591
+ url: '/channels/{id}',
1592
+ ...options
1593
+ });
1594
+ }
1595
+ /**
1596
+ * Get today's Next Up list
1597
+ *
1598
+ * Who to contact today and what is waiting for a person, in the order the app's Next Up page shows them: moments, approvals and due reminders together, ranked. The whole list comes back in one response. Items you skipped are left out for you only. Reading it never uses AI credits. Needs `next_up:read`; `why`, `callout` and an approval's message text also need `conversations:read`, and a reminder's `note` needs `notes:read`.
1599
+ */
1600
+ listNextUp(options) {
1601
+ return (options?.client ?? this.client).get({
1602
+ security: [
1603
+ {
1604
+ key: 'oauth2',
1605
+ scheme: 'bearer',
1606
+ type: 'http'
1607
+ },
1608
+ { name: 'x-api-key', type: 'apiKey' },
1609
+ {
1610
+ key: 'bearerAuth',
1611
+ scheme: 'bearer',
1612
+ type: 'http'
1613
+ }
1614
+ ],
1615
+ url: '/next-up',
1616
+ ...options
1617
+ });
1618
+ }
1619
+ /**
1620
+ * Open the next batch of moments
1621
+ *
1622
+ * Moments come in batches from today's committed order (`batch` on GET /next-up). Once you've worked through one, this opens the next lot, as Keep going does in the app, and returns the list. A batch belongs to the list, so it opens for the whole team. Never uses AI credits. Needs `next_up:write`.
1623
+ */
1624
+ openNextUpBatch(options) {
1625
+ return (options.client ?? this.client).post({
1626
+ security: [
1627
+ {
1628
+ key: 'oauth2',
1629
+ scheme: 'bearer',
1630
+ type: 'http'
1631
+ },
1632
+ { name: 'x-api-key', type: 'apiKey' },
1633
+ {
1634
+ key: 'bearerAuth',
1635
+ scheme: 'bearer',
1636
+ type: 'http'
1637
+ }
1638
+ ],
1639
+ url: '/next-up/next-batch',
1640
+ ...options,
1641
+ headers: {
1642
+ 'Content-Type': 'application/json',
1643
+ ...options.headers
1644
+ }
1645
+ });
1646
+ }
1647
+ /**
1648
+ * Get a client's open Next Up items
1649
+ *
1650
+ * The client's items on today's list that nobody has dealt with yet: their moment, if today's order includes them, their approvals and their due reminders. For a sidebar or a check-in screen. Moments appear once today's list is built, which Recovr does early each morning. Never uses AI credits. Needs `next_up:read`, with the same extra permissions as GET /next-up for `why`, `callout`, message text and `note`. A client at another location is a 404.
1651
+ */
1652
+ getClientNextUp(options) {
1653
+ return (options.client ?? this.client).get({
1654
+ security: [
1655
+ {
1656
+ key: 'oauth2',
1657
+ scheme: 'bearer',
1658
+ type: 'http'
1659
+ },
1660
+ { name: 'x-api-key', type: 'apiKey' },
1661
+ {
1662
+ key: 'bearerAuth',
1663
+ scheme: 'bearer',
1664
+ type: 'http'
1665
+ }
1666
+ ],
1667
+ url: '/clients/{id}/next-up',
1668
+ ...options
1669
+ });
1670
+ }
1671
+ /**
1672
+ * Mark a Next Up item done
1673
+ *
1674
+ * Ticks the item off as the credential's owner, as Done does in the app. A moment leaves the list and stays off it until something new happens for the client, and "Marked done in Next Up" goes on their timeline. Done on an "Owed a reply" moment also marks the conversation as needing no reply. An alert closes its reminder. An `agent_could_not_reply` or `human_handoff` approval is marked answered, with an optional `reason`. Done never snoozes the client. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1675
+ */
1676
+ markNextUpItemDone(options) {
1677
+ return (options.client ?? this.client).post({
1678
+ security: [
1679
+ {
1680
+ key: 'oauth2',
1681
+ scheme: 'bearer',
1682
+ type: 'http'
1683
+ },
1684
+ { name: 'x-api-key', type: 'apiKey' },
1685
+ {
1686
+ key: 'bearerAuth',
1687
+ scheme: 'bearer',
1688
+ type: 'http'
1689
+ }
1690
+ ],
1691
+ url: '/next-up/{item_id}/done',
1692
+ ...options,
1693
+ headers: {
1694
+ 'Content-Type': 'application/json',
1695
+ ...options.headers
1696
+ }
1697
+ });
1698
+ }
1699
+ /**
1700
+ * Skip a Next Up item for today
1701
+ *
1702
+ * Hides the item from the credential owner's list for the rest of today, as Skip does in the app. It stays on everyone else's list, and nothing changes for the client. Moments and held drafts. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1703
+ */
1704
+ skipNextUpItem(options) {
1705
+ return (options.client ?? this.client).post({
1706
+ security: [
1707
+ {
1708
+ key: 'oauth2',
1709
+ scheme: 'bearer',
1710
+ type: 'http'
1711
+ },
1712
+ { name: 'x-api-key', type: 'apiKey' },
1713
+ {
1714
+ key: 'bearerAuth',
1715
+ scheme: 'bearer',
1716
+ type: 'http'
1717
+ }
1718
+ ],
1719
+ url: '/next-up/{item_id}/skip',
1720
+ ...options
1721
+ });
1722
+ }
1723
+ /**
1724
+ * Snooze a Next Up item's client
1725
+ *
1726
+ * Snoozes the client, as Snooze does on a Next Up card: they leave the list until the snooze ends, and the snooze goes on their timeline. Send `days` or `until`, or neither for the location's default snooze for the client's risk level (Settings → Snooze; 7 days when it's never been set). Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1727
+ */
1728
+ snoozeNextUpItem(options) {
1729
+ return (options.client ?? this.client).post({
1730
+ security: [
1731
+ {
1732
+ key: 'oauth2',
1733
+ scheme: 'bearer',
1734
+ type: 'http'
1735
+ },
1736
+ { name: 'x-api-key', type: 'apiKey' },
1737
+ {
1738
+ key: 'bearerAuth',
1739
+ scheme: 'bearer',
1740
+ type: 'http'
1741
+ }
1742
+ ],
1743
+ url: '/next-up/{item_id}/snooze',
1744
+ ...options,
1745
+ headers: {
1746
+ 'Content-Type': 'application/json',
1747
+ ...options.headers
1748
+ }
1749
+ });
1750
+ }
1751
+ /**
1752
+ * Approve a Next Up approval
1753
+ *
1754
+ * Approves an approval, as Approve does in the app. A held draft is sent to the client, with your own `text` if you send one (edit and send); that also needs `messages:send`, and the send is checked as POST /conversations/{id}/messages is (`do_not_contact`, `in_bulk_send`, `same_text_limit`, `outreach_limited`, then the location's own sending rules). A booking, platform action or task is approved and starts: it writes to the booking platform as the credential's owner. A sent message reaches a real person and a platform change can't be undone from here. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1755
+ */
1756
+ approveNextUpItem(options) {
1757
+ return (options.client ?? this.client).post({
1758
+ security: [
1759
+ {
1760
+ key: 'oauth2',
1761
+ scheme: 'bearer',
1762
+ type: 'http'
1763
+ },
1764
+ { name: 'x-api-key', type: 'apiKey' },
1765
+ {
1766
+ key: 'bearerAuth',
1767
+ scheme: 'bearer',
1768
+ type: 'http'
1769
+ }
1770
+ ],
1771
+ url: '/next-up/{item_id}/approve',
1772
+ ...options,
1773
+ headers: {
1774
+ 'Content-Type': 'application/json',
1775
+ ...options.headers
1776
+ }
1777
+ });
1778
+ }
1779
+ /**
1780
+ * Reject a Next Up approval
1781
+ *
1782
+ * Rejects an approval, as Reject does in the app. A held draft is discarded and never sent, with an optional `reason`. A booking, platform action or task is not done. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1783
+ */
1784
+ rejectNextUpItem(options) {
1785
+ return (options.client ?? this.client).post({
1786
+ security: [
1787
+ {
1788
+ key: 'oauth2',
1789
+ scheme: 'bearer',
1790
+ type: 'http'
1791
+ },
1792
+ { name: 'x-api-key', type: 'apiKey' },
1793
+ {
1794
+ key: 'bearerAuth',
1795
+ scheme: 'bearer',
1796
+ type: 'http'
1797
+ }
1798
+ ],
1799
+ url: '/next-up/{item_id}/reject',
1800
+ ...options,
1801
+ headers: {
1802
+ 'Content-Type': 'application/json',
1803
+ ...options.headers
1804
+ }
1805
+ });
1806
+ }
1807
+ /**
1808
+ * Recheck an uncertain booking
1809
+ *
1810
+ * For a booking Recovr couldn't confirm (`action.status` `uncertain`): reads the booking platform again and settles it to what the platform shows. Writes nothing to the platform. `settled` is false when the platform couldn't be read. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1811
+ */
1812
+ recheckNextUpItem(options) {
1813
+ return (options.client ?? this.client).post({
1814
+ security: [
1815
+ {
1816
+ key: 'oauth2',
1817
+ scheme: 'bearer',
1818
+ type: 'http'
1819
+ },
1820
+ { name: 'x-api-key', type: 'apiKey' },
1821
+ {
1822
+ key: 'bearerAuth',
1823
+ scheme: 'bearer',
1824
+ type: 'http'
1825
+ }
1826
+ ],
1827
+ url: '/next-up/{item_id}/recheck',
1828
+ ...options
1829
+ });
1830
+ }
1831
+ /**
1832
+ * Settle an uncertain booking
1833
+ *
1834
+ * For a change Recovr couldn't confirm (`action.status` `uncertain`): records what the booking platform shows, as the card's answer does in the app. Needs the credential to act as a team member. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1835
+ */
1836
+ settleNextUpItem(options) {
1837
+ return (options.client ?? this.client).post({
1838
+ security: [
1839
+ {
1840
+ key: 'oauth2',
1841
+ scheme: 'bearer',
1842
+ type: 'http'
1843
+ },
1844
+ { name: 'x-api-key', type: 'apiKey' },
1845
+ {
1846
+ key: 'bearerAuth',
1847
+ scheme: 'bearer',
1848
+ type: 'http'
1849
+ }
1850
+ ],
1851
+ url: '/next-up/{item_id}/settle',
1852
+ ...options,
1853
+ headers: {
1854
+ 'Content-Type': 'application/json',
1855
+ ...options.headers
1856
+ }
1857
+ });
1858
+ }
1859
+ /**
1860
+ * List a client's sessions
1861
+ *
1862
+ * The client's bookings on the location's days from `from` to `to`, every status, newest first: what the attendance calendar on their profile shows. Read-only, because the booking platform owns bookings. Needs `clients:read`. A client at another location is a 404.
1863
+ */
1864
+ listClientSessions(options) {
1865
+ return (options.client ?? this.client).get({
1866
+ security: [
1867
+ {
1868
+ key: 'oauth2',
1869
+ scheme: 'bearer',
1870
+ type: 'http'
1871
+ },
1872
+ { name: 'x-api-key', type: 'apiKey' },
1873
+ {
1874
+ key: 'bearerAuth',
1875
+ scheme: 'bearer',
1876
+ type: 'http'
1877
+ }
1878
+ ],
1879
+ url: '/clients/{id}/sessions',
1880
+ ...options
1881
+ });
1882
+ }
1883
+ /**
1884
+ * Get a client's attendance summary
1885
+ *
1886
+ * How many sessions the client booked, attended, cancelled and missed on the location's days from `from` to `to` (the 30 days to today when you send neither), with the figures their profile shows: lifetime sessions attended, last visit, next booking and attendance trend. Needs `clients:read`. A client at another location is a 404.
1887
+ */
1888
+ getClientAttendance(options) {
1889
+ return (options.client ?? this.client).get({
1890
+ security: [
1891
+ {
1892
+ key: 'oauth2',
1893
+ scheme: 'bearer',
1894
+ type: 'http'
1895
+ },
1896
+ { name: 'x-api-key', type: 'apiKey' },
1897
+ {
1898
+ key: 'bearerAuth',
1899
+ scheme: 'bearer',
1900
+ type: 'http'
1901
+ }
1902
+ ],
1903
+ url: '/clients/{id}/attendance',
1904
+ ...options
1905
+ });
1906
+ }
1907
+ /**
1908
+ * Get a client's session milestones
1909
+ *
1910
+ * The client's lifetime milestone count, the gym's milestones they've reached and when, and how far they are from the next: the Milestones section of their profile, counted as the Milestones report counts. The gym sets its milestones and exclusions in Settings → Milestones. Needs `clients:read`. A client at another location is a 404.
1911
+ */
1912
+ getClientMilestones(options) {
1913
+ return (options.client ?? this.client).get({
1914
+ security: [
1915
+ {
1916
+ key: 'oauth2',
1917
+ scheme: 'bearer',
1918
+ type: 'http'
1919
+ },
1920
+ { name: 'x-api-key', type: 'apiKey' },
1921
+ {
1922
+ key: 'bearerAuth',
1923
+ scheme: 'bearer',
1924
+ type: 'http'
1925
+ }
1926
+ ],
1927
+ url: '/clients/{id}/milestones',
1928
+ ...options
1929
+ });
1930
+ }
1931
+ /**
1932
+ * List the location's classes and their bookings
1933
+ *
1934
+ * The location's classes on its days from `from` to `to`, each with its bookings by status: the app's Session Report. Door check-ins and visits to other sites are left out, as they are there. Up to 14 days in one request. Needs `sessions:read`; who booked (`attendees`) also needs `clients:read`. For classes nobody has booked, use GET /class-timetable.
1935
+ */
1936
+ listSessions(options) {
1937
+ return (options?.client ?? this.client).get({
1938
+ security: [
1939
+ {
1940
+ key: 'oauth2',
1941
+ scheme: 'bearer',
1942
+ type: 'http'
1943
+ },
1944
+ { name: 'x-api-key', type: 'apiKey' },
1945
+ {
1946
+ key: 'bearerAuth',
1947
+ scheme: 'bearer',
1948
+ type: 'http'
1949
+ }
1950
+ ],
1951
+ url: '/sessions',
1952
+ ...options
1953
+ });
1954
+ }
1955
+ /**
1956
+ * Get the class timetable
1957
+ *
1958
+ * The classes the studio's booking platform publishes on the location's days from `from` to `to`, booked or not, with capacity and the platform's booked count. Recovr reads the timetable from the platform (daily for most, weekly for Mindbody API sites), so check `trusted` before treating a missing class as not running. Not every booking platform sends a timetable: without one, `classes` is empty and `last_read_at` is null. Up to 42 days in one request. Needs `sessions:read`.
1959
+ */
1960
+ getClassTimetable(options) {
1961
+ return (options?.client ?? this.client).get({
1962
+ security: [
1963
+ {
1964
+ key: 'oauth2',
1965
+ scheme: 'bearer',
1966
+ type: 'http'
1967
+ },
1968
+ { name: 'x-api-key', type: 'apiKey' },
1969
+ {
1970
+ key: 'bearerAuth',
1971
+ scheme: 'bearer',
1972
+ type: 'http'
1973
+ }
1974
+ ],
1975
+ url: '/class-timetable',
1976
+ ...options
1977
+ });
1978
+ }
1979
+ /**
1980
+ * List custom fields
1981
+ *
1982
+ * The location's custom fields, in the order profiles show them. Archived fields only with `include_archived=true`. Fields are set up in the app (Settings → Custom Fields). Needs `clients:read`.
1983
+ */
1984
+ listCustomFields(options) {
1985
+ return (options?.client ?? this.client).get({
1986
+ security: [
1987
+ {
1988
+ key: 'oauth2',
1989
+ scheme: 'bearer',
1990
+ type: 'http'
1991
+ },
1992
+ { name: 'x-api-key', type: 'apiKey' },
1993
+ {
1994
+ key: 'bearerAuth',
1995
+ scheme: 'bearer',
1996
+ type: 'http'
1997
+ }
1998
+ ],
1999
+ url: '/custom-fields',
2000
+ ...options
2001
+ });
2002
+ }
2003
+ /**
2004
+ * Get a client's custom field values
2005
+ *
2006
+ * Every live custom field with this client's value, null where it isn't set, in the order the profile shows them. Archived fields are left out. Needs `clients:read`. Works only on clients at the credential's location: any other id is a 404.
2007
+ */
2008
+ getClientCustomFields(options) {
2009
+ return (options.client ?? this.client).get({
2010
+ security: [
2011
+ {
2012
+ key: 'oauth2',
2013
+ scheme: 'bearer',
2014
+ type: 'http'
2015
+ },
2016
+ { name: 'x-api-key', type: 'apiKey' },
2017
+ {
2018
+ key: 'bearerAuth',
2019
+ scheme: 'bearer',
2020
+ type: 'http'
2021
+ }
2022
+ ],
2023
+ url: '/clients/{id}/custom-fields',
2024
+ ...options
2025
+ });
2026
+ }
2027
+ /**
2028
+ * Set or clear a client's custom field value
2029
+ *
2030
+ * Sets one field's value for one client, as editing it on their profile does, or clears it with `value: null`. Setting the value a field already holds changes nothing. A value the field can't hold (text in a `number` field, a `select` value that isn't one of its `options`) is a 400. An archived field, or a field or client at another location, is a 404. Needs `clients:write`.
2031
+ */
2032
+ setClientCustomField(options) {
2033
+ return (options.client ?? this.client).patch({
2034
+ security: [
2035
+ {
2036
+ key: 'oauth2',
2037
+ scheme: 'bearer',
2038
+ type: 'http'
2039
+ },
2040
+ { name: 'x-api-key', type: 'apiKey' },
2041
+ {
2042
+ key: 'bearerAuth',
2043
+ scheme: 'bearer',
2044
+ type: 'http'
2045
+ }
2046
+ ],
2047
+ url: '/clients/{id}/custom-fields/{field_id}',
2048
+ ...options,
2049
+ headers: {
2050
+ 'Content-Type': 'application/json',
2051
+ ...options.headers
2052
+ }
2053
+ });
2054
+ }
2055
+ /**
2056
+ * Rename or recolour a label
2057
+ *
2058
+ * Renames a label or changes its colour, as Settings → Labels does. Every client with the label keeps it, and workflows that use it follow the new name. A name another label at the location already has (ignoring case) is a 409 `label_name_exists`. Works on manual and smart labels. Needs `labels:manage`.
2059
+ */
2060
+ updateClientLabel(options) {
2061
+ return (options.client ?? this.client).patch({
2062
+ security: [
2063
+ {
2064
+ key: 'oauth2',
2065
+ scheme: 'bearer',
2066
+ type: 'http'
2067
+ },
2068
+ { name: 'x-api-key', type: 'apiKey' },
2069
+ {
2070
+ key: 'bearerAuth',
2071
+ scheme: 'bearer',
2072
+ type: 'http'
2073
+ }
2074
+ ],
2075
+ url: '/client-labels/{label_id}',
2076
+ ...options,
2077
+ headers: {
2078
+ 'Content-Type': 'application/json',
2079
+ ...options.headers
2080
+ }
2081
+ });
2082
+ }
2083
+ /**
2084
+ * Archive a label
2085
+ *
2086
+ * Archives a label, as Settings → Labels does: it leaves the label pickers and **comes off every client who has it**. Their timelines keep the history. The app lists the workflows that use a label before you archive it there, so check those first. Restore it with POST /client-labels/{label_id}/restore (clients don't get it back). Archiving an archived label changes nothing. Needs `labels:manage`.
2087
+ */
2088
+ archiveClientLabel(options) {
2089
+ return (options.client ?? this.client).post({
2090
+ security: [
2091
+ {
2092
+ key: 'oauth2',
2093
+ scheme: 'bearer',
2094
+ type: 'http'
2095
+ },
2096
+ { name: 'x-api-key', type: 'apiKey' },
2097
+ {
2098
+ key: 'bearerAuth',
2099
+ scheme: 'bearer',
2100
+ type: 'http'
2101
+ }
2102
+ ],
2103
+ url: '/client-labels/{label_id}/archive',
2104
+ ...options
2105
+ });
2106
+ }
2107
+ /**
2108
+ * Restore an archived label
2109
+ *
2110
+ * Brings an archived label back to the pickers, as Settings → Labels does. A manual label comes back on nobody; a smart label goes back on the clients its rule matches, without starting workflows. Restoring a label that isn't archived changes nothing. Needs `labels:manage`.
2111
+ */
2112
+ restoreClientLabel(options) {
2113
+ return (options.client ?? this.client).post({
2114
+ security: [
2115
+ {
2116
+ key: 'oauth2',
2117
+ scheme: 'bearer',
2118
+ type: 'http'
2119
+ },
2120
+ { name: 'x-api-key', type: 'apiKey' },
2121
+ {
2122
+ key: 'bearerAuth',
2123
+ scheme: 'bearer',
2124
+ type: 'http'
2125
+ }
2126
+ ],
2127
+ url: '/client-labels/{label_id}/restore',
2128
+ ...options
2129
+ });
2130
+ }
2131
+ /**
2132
+ * Get a client's timeline
2133
+ *
2134
+ * Everything that happened with a client, newest first, as their profile's timeline shows it: messages, calls, notes, logged contact, reminders, sessions, labels, suspensions, forms and more. Each message in a bulk send is listed on its own rather than folded into a group, and drafts aren't listed.
2135
+ *
2136
+ * Needs `clients:read`. An entry's text needs the permission that guards it elsewhere: `conversations:read` for messages, `notes:read` for notes, calls, logged contact and reminders, `forms:read` for form submissions. Without it the entry is still listed, without `content`. Only for clients at the key's location: any other id is a 404.
2137
+ *
2138
+ * Pages don't repeat or skip entries when new ones are added meanwhile.
2139
+ */
2140
+ getClientTimeline(options) {
2141
+ return (options.client ?? this.client).get({
2142
+ security: [
2143
+ {
2144
+ key: 'oauth2',
2145
+ scheme: 'bearer',
2146
+ type: 'http'
2147
+ },
2148
+ { name: 'x-api-key', type: 'apiKey' },
2149
+ {
2150
+ key: 'bearerAuth',
2151
+ scheme: 'bearer',
2152
+ type: 'http'
2153
+ }
2154
+ ],
2155
+ url: '/clients/{id}/timeline',
2156
+ ...options
2157
+ });
2158
+ }
2159
+ /**
2160
+ * List team members
2161
+ *
2162
+ * The team at the credential's location, oldest first: the `id` every endpoint uses for a team member (`assigned_to`, an author's or activity's `team_member`, GET /activity `team_member_id`), each person's role, and whether they're still an open invite. Someone removed from the team isn't listed, though their past activity keeps their id and name. Needs `clients:read`.
2163
+ */
2164
+ listTeamMembers(options) {
2165
+ return (options?.client ?? this.client).get({
2166
+ security: [
2167
+ {
2168
+ key: 'oauth2',
2169
+ scheme: 'bearer',
2170
+ type: 'http'
2171
+ },
2172
+ { name: 'x-api-key', type: 'apiKey' },
2173
+ {
2174
+ key: 'bearerAuth',
2175
+ scheme: 'bearer',
2176
+ type: 'http'
2177
+ }
2178
+ ],
2179
+ url: '/team-members',
2180
+ ...options
2181
+ });
2182
+ }
2183
+ /**
2184
+ * Invite a team member
2185
+ *
2186
+ * Invites one person to the location's team with a role, as the app's Team page does: Recovr emails them an invite with a link to set their password, and they're listed with `status: invited` until they sign in. Refusals: `already_on_team` (that email is already on the team; resend their invite instead), `team_not_supported` (the location's team is still managed outside Recovr). Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2187
+ */
2188
+ inviteTeamMember(options) {
2189
+ return (options.client ?? this.client).post({
2190
+ security: [
2191
+ {
2192
+ key: 'oauth2',
2193
+ scheme: 'bearer',
2194
+ type: 'http'
2195
+ },
2196
+ { name: 'x-api-key', type: 'apiKey' },
2197
+ {
2198
+ key: 'bearerAuth',
2199
+ scheme: 'bearer',
2200
+ type: 'http'
2201
+ }
2202
+ ],
2203
+ url: '/team-members',
2204
+ ...options,
2205
+ headers: {
2206
+ 'Content-Type': 'application/json',
2207
+ ...options.headers
2208
+ }
2209
+ });
2210
+ }
2211
+ /**
2212
+ * Remove a team member
2213
+ *
2214
+ * Removes someone from the location's team, as the Team page's Remove does: they lose access to the location at once, including every personal access token and app connection they hold for it, and leave Team Chat. Their past activity keeps their id and name. Recovr has no separate deactivate; inviting them again later gives them a new id. Removing someone already removed is a 404. Refusals: `last_owner`. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2215
+ */
2216
+ removeTeamMember(options) {
2217
+ return (options.client ?? this.client).delete({
2218
+ security: [
2219
+ {
2220
+ key: 'oauth2',
2221
+ scheme: 'bearer',
2222
+ type: 'http'
2223
+ },
2224
+ { name: 'x-api-key', type: 'apiKey' },
2225
+ {
2226
+ key: 'bearerAuth',
2227
+ scheme: 'bearer',
2228
+ type: 'http'
2229
+ }
2230
+ ],
2231
+ url: '/team-members/{id}',
2232
+ ...options
2233
+ });
2234
+ }
2235
+ /**
2236
+ * Change a team member's role
2237
+ *
2238
+ * Makes a team member a Manager or a Team member. Their new role applies from their next request, in the app and through any token they hold. Setting the role they already have changes nothing. Refusals: `no_membership` (they have no Recovr login at this location to give a role to), `last_owner`. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2239
+ */
2240
+ updateTeamMember(options) {
2241
+ return (options.client ?? this.client).patch({
2242
+ security: [
2243
+ {
2244
+ key: 'oauth2',
2245
+ scheme: 'bearer',
2246
+ type: 'http'
2247
+ },
2248
+ { name: 'x-api-key', type: 'apiKey' },
2249
+ {
2250
+ key: 'bearerAuth',
2251
+ scheme: 'bearer',
2252
+ type: 'http'
2253
+ }
2254
+ ],
2255
+ url: '/team-members/{id}',
2256
+ ...options,
2257
+ headers: {
2258
+ 'Content-Type': 'application/json',
2259
+ ...options.headers
2260
+ }
2261
+ });
2262
+ }
2263
+ /**
2264
+ * Resend an invite
2265
+ *
2266
+ * Emails an invited team member their invite again, with a new link to set their password, as the Team page's Resend does. Refusals: `not_an_invite` (they've already signed in), `no_login` (they have no Recovr login to invite; remove and invite them again). Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2267
+ */
2268
+ resendTeamMemberInvite(options) {
2269
+ return (options.client ?? this.client).post({
2270
+ security: [
2271
+ {
2272
+ key: 'oauth2',
2273
+ scheme: 'bearer',
2274
+ type: 'http'
2275
+ },
2276
+ { name: 'x-api-key', type: 'apiKey' },
2277
+ {
2278
+ key: 'bearerAuth',
2279
+ scheme: 'bearer',
2280
+ type: 'http'
2281
+ }
2282
+ ],
2283
+ url: '/team-members/{id}/resend-invite',
2284
+ ...options
2285
+ });
2286
+ }
2287
+ /**
2288
+ * Cancel an invite
2289
+ *
2290
+ * Takes back an invite someone hasn't accepted: they leave the team list and their invite link stops giving them access to the location. Someone who has already signed in is refused with `not_an_invite`; remove them with DELETE /team-members/{id} instead. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2291
+ */
2292
+ cancelTeamMemberInvite(options) {
2293
+ return (options.client ?? this.client).post({
2294
+ security: [
2295
+ {
2296
+ key: 'oauth2',
2297
+ scheme: 'bearer',
2298
+ type: 'http'
2299
+ },
2300
+ { name: 'x-api-key', type: 'apiKey' },
2301
+ {
2302
+ key: 'bearerAuth',
2303
+ scheme: 'bearer',
2304
+ type: 'http'
2305
+ }
2306
+ ],
2307
+ url: '/team-members/{id}/cancel-invite',
2308
+ ...options
2309
+ });
2310
+ }
2311
+ }