@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.
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +307 -2
- package/dist/cjs/client.d.ts +36 -0
- package/dist/cjs/client.js +100 -0
- package/dist/cjs/errors.d.ts +31 -0
- package/dist/cjs/errors.js +69 -0
- package/dist/cjs/generated/client/client.gen.d.ts +2 -0
- package/dist/cjs/generated/client/client.gen.js +220 -0
- package/dist/cjs/generated/client/index.d.ts +10 -0
- package/dist/cjs/generated/client/index.js +17 -0
- package/dist/cjs/generated/client/types.gen.d.ts +120 -0
- package/dist/cjs/generated/client/types.gen.js +3 -0
- package/dist/cjs/generated/client/utils.gen.d.ts +37 -0
- package/dist/cjs/generated/client/utils.gen.js +239 -0
- package/dist/cjs/generated/client.gen.d.ts +12 -0
- package/dist/cjs/generated/client.gen.js +6 -0
- package/dist/cjs/generated/core/auth.gen.d.ts +25 -0
- package/dist/cjs/generated/core/auth.gen.js +18 -0
- package/dist/cjs/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/cjs/generated/core/bodySerializer.gen.js +60 -0
- package/dist/cjs/generated/core/params.gen.d.ts +43 -0
- package/dist/cjs/generated/core/params.gen.js +112 -0
- package/dist/cjs/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/cjs/generated/core/pathSerializer.gen.js +115 -0
- package/dist/cjs/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/cjs/generated/core/queryKeySerializer.gen.js +98 -0
- package/dist/cjs/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/cjs/generated/core/serverSentEvents.gen.js +135 -0
- package/dist/cjs/generated/core/types.gen.d.ts +83 -0
- package/dist/cjs/generated/core/types.gen.js +3 -0
- package/dist/cjs/generated/core/utils.gen.d.ts +19 -0
- package/dist/cjs/generated/core/utils.gen.js +93 -0
- package/dist/cjs/generated/index.d.ts +2 -0
- package/dist/cjs/generated/index.js +6 -0
- package/dist/cjs/generated/sdk.gen.d.ts +603 -0
- package/dist/cjs/generated/sdk.gen.js +2315 -0
- package/dist/cjs/generated/types.gen.d.ts +7658 -0
- package/dist/cjs/generated/types.gen.js +3 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/paginate.d.ts +24 -0
- package/dist/cjs/paginate.js +18 -0
- package/dist/esm/client.d.ts +36 -0
- package/dist/esm/client.js +95 -0
- package/dist/esm/errors.d.ts +31 -0
- package/dist/esm/errors.js +64 -0
- package/dist/esm/generated/client/client.gen.d.ts +2 -0
- package/dist/esm/generated/client/client.gen.js +216 -0
- package/dist/esm/generated/client/index.d.ts +10 -0
- package/dist/esm/generated/client/index.js +6 -0
- package/dist/esm/generated/client/types.gen.d.ts +120 -0
- package/dist/esm/generated/client/types.gen.js +2 -0
- package/dist/esm/generated/client/utils.gen.d.ts +37 -0
- package/dist/esm/generated/client/utils.gen.js +228 -0
- package/dist/esm/generated/client.gen.d.ts +12 -0
- package/dist/esm/generated/client.gen.js +3 -0
- package/dist/esm/generated/core/auth.gen.d.ts +25 -0
- package/dist/esm/generated/core/auth.gen.js +14 -0
- package/dist/esm/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/esm/generated/core/bodySerializer.gen.js +57 -0
- package/dist/esm/generated/core/params.gen.d.ts +43 -0
- package/dist/esm/generated/core/params.gen.js +109 -0
- package/dist/esm/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/esm/generated/core/pathSerializer.gen.js +106 -0
- package/dist/esm/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/esm/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/esm/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/esm/generated/core/serverSentEvents.gen.js +132 -0
- package/dist/esm/generated/core/types.gen.d.ts +83 -0
- package/dist/esm/generated/core/types.gen.js +2 -0
- package/dist/esm/generated/core/utils.gen.d.ts +19 -0
- package/dist/esm/generated/core/utils.gen.js +87 -0
- package/dist/esm/generated/index.d.ts +2 -0
- package/dist/esm/generated/index.js +2 -0
- package/dist/esm/generated/sdk.gen.d.ts +603 -0
- package/dist/esm/generated/sdk.gen.js +2311 -0
- package/dist/esm/generated/types.gen.d.ts +7658 -0
- package/dist/esm/generated/types.gen.js +2 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/paginate.d.ts +24 -0
- package/dist/esm/paginate.js +15 -0
- package/examples/add-lead.ts +45 -0
- package/examples/add-note.ts +34 -0
- package/examples/export-health-scores.ts +38 -0
- package/examples/set-suspension.ts +38 -0
- package/package.json +59 -4
|
@@ -0,0 +1,2315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RecovrSdk = void 0;
|
|
5
|
+
const client_gen_js_1 = require("./client.gen.js");
|
|
6
|
+
class HeyApiClient {
|
|
7
|
+
client;
|
|
8
|
+
constructor(args) {
|
|
9
|
+
this.client = args?.client ?? client_gen_js_1.client;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class HeyApiRegistry {
|
|
13
|
+
defaultKey = 'default';
|
|
14
|
+
instances = new Map();
|
|
15
|
+
get(key) {
|
|
16
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
17
|
+
if (!instance) {
|
|
18
|
+
throw new Error(`No SDK client found. Create one with "new RecovrSdk()" to fix this error.`);
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
set(value, key) {
|
|
23
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class RecovrSdk extends HeyApiClient {
|
|
27
|
+
static __registry = new HeyApiRegistry();
|
|
28
|
+
constructor(args) {
|
|
29
|
+
super(args);
|
|
30
|
+
RecovrSdk.__registry.set(this, args?.key);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The credential making this request
|
|
34
|
+
*
|
|
35
|
+
* 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.
|
|
36
|
+
*/
|
|
37
|
+
getMe(options) {
|
|
38
|
+
return (options?.client ?? this.client).get({
|
|
39
|
+
security: [
|
|
40
|
+
{
|
|
41
|
+
key: 'oauth2',
|
|
42
|
+
scheme: 'bearer',
|
|
43
|
+
type: 'http'
|
|
44
|
+
},
|
|
45
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
46
|
+
{
|
|
47
|
+
key: 'bearerAuth',
|
|
48
|
+
scheme: 'bearer',
|
|
49
|
+
type: 'http'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
url: '/me',
|
|
53
|
+
...options
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The key's location
|
|
58
|
+
*
|
|
59
|
+
* The one location this key belongs to; every other endpoint reads and writes only there. Any valid key can call it.
|
|
60
|
+
*/
|
|
61
|
+
getLocation(options) {
|
|
62
|
+
return (options?.client ?? this.client).get({
|
|
63
|
+
security: [
|
|
64
|
+
{
|
|
65
|
+
key: 'oauth2',
|
|
66
|
+
scheme: 'bearer',
|
|
67
|
+
type: 'http'
|
|
68
|
+
},
|
|
69
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
70
|
+
{
|
|
71
|
+
key: 'bearerAuth',
|
|
72
|
+
scheme: 'bearer',
|
|
73
|
+
type: 'http'
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
url: '/location',
|
|
77
|
+
...options
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get a client
|
|
82
|
+
*
|
|
83
|
+
* 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.
|
|
84
|
+
*/
|
|
85
|
+
getClient(options) {
|
|
86
|
+
return (options.client ?? this.client).get({
|
|
87
|
+
security: [
|
|
88
|
+
{
|
|
89
|
+
key: 'oauth2',
|
|
90
|
+
scheme: 'bearer',
|
|
91
|
+
type: 'http'
|
|
92
|
+
},
|
|
93
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
94
|
+
{
|
|
95
|
+
key: 'bearerAuth',
|
|
96
|
+
scheme: 'bearer',
|
|
97
|
+
type: 'http'
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
url: '/clients/{id}',
|
|
101
|
+
...options
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* List clients
|
|
106
|
+
*
|
|
107
|
+
* 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`.
|
|
108
|
+
*
|
|
109
|
+
* 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.
|
|
110
|
+
*
|
|
111
|
+
* 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.
|
|
112
|
+
*/
|
|
113
|
+
listClients(options) {
|
|
114
|
+
return (options?.client ?? this.client).get({
|
|
115
|
+
security: [
|
|
116
|
+
{
|
|
117
|
+
key: 'oauth2',
|
|
118
|
+
scheme: 'bearer',
|
|
119
|
+
type: 'http'
|
|
120
|
+
},
|
|
121
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
122
|
+
{
|
|
123
|
+
key: 'bearerAuth',
|
|
124
|
+
scheme: 'bearer',
|
|
125
|
+
type: 'http'
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
url: '/clients',
|
|
129
|
+
...options
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Assign a client to a team member
|
|
134
|
+
*
|
|
135
|
+
* 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.
|
|
136
|
+
*/
|
|
137
|
+
assignClient(options) {
|
|
138
|
+
return (options.client ?? this.client).post({
|
|
139
|
+
security: [
|
|
140
|
+
{
|
|
141
|
+
key: 'oauth2',
|
|
142
|
+
scheme: 'bearer',
|
|
143
|
+
type: 'http'
|
|
144
|
+
},
|
|
145
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
146
|
+
{
|
|
147
|
+
key: 'bearerAuth',
|
|
148
|
+
scheme: 'bearer',
|
|
149
|
+
type: 'http'
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
url: '/clients/{id}/assign',
|
|
153
|
+
...options,
|
|
154
|
+
headers: {
|
|
155
|
+
'Content-Type': 'application/json',
|
|
156
|
+
...options.headers
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Flag a client
|
|
162
|
+
*
|
|
163
|
+
* 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.
|
|
164
|
+
*/
|
|
165
|
+
flagClient(options) {
|
|
166
|
+
return (options.client ?? this.client).post({
|
|
167
|
+
security: [
|
|
168
|
+
{
|
|
169
|
+
key: 'oauth2',
|
|
170
|
+
scheme: 'bearer',
|
|
171
|
+
type: 'http'
|
|
172
|
+
},
|
|
173
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
174
|
+
{
|
|
175
|
+
key: 'bearerAuth',
|
|
176
|
+
scheme: 'bearer',
|
|
177
|
+
type: 'http'
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
url: '/clients/{id}/flag',
|
|
181
|
+
...options,
|
|
182
|
+
headers: {
|
|
183
|
+
'Content-Type': 'application/json',
|
|
184
|
+
...options.headers
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Remove a client's flag
|
|
190
|
+
*
|
|
191
|
+
* 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.
|
|
192
|
+
*/
|
|
193
|
+
unflagClient(options) {
|
|
194
|
+
return (options.client ?? this.client).post({
|
|
195
|
+
security: [
|
|
196
|
+
{
|
|
197
|
+
key: 'oauth2',
|
|
198
|
+
scheme: 'bearer',
|
|
199
|
+
type: 'http'
|
|
200
|
+
},
|
|
201
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
202
|
+
{
|
|
203
|
+
key: 'bearerAuth',
|
|
204
|
+
scheme: 'bearer',
|
|
205
|
+
type: 'http'
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
url: '/clients/{id}/unflag',
|
|
209
|
+
...options
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Snooze a client
|
|
214
|
+
*
|
|
215
|
+
* 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.
|
|
216
|
+
*/
|
|
217
|
+
snoozeClient(options) {
|
|
218
|
+
return (options.client ?? this.client).post({
|
|
219
|
+
security: [
|
|
220
|
+
{
|
|
221
|
+
key: 'oauth2',
|
|
222
|
+
scheme: 'bearer',
|
|
223
|
+
type: 'http'
|
|
224
|
+
},
|
|
225
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
226
|
+
{
|
|
227
|
+
key: 'bearerAuth',
|
|
228
|
+
scheme: 'bearer',
|
|
229
|
+
type: 'http'
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
url: '/clients/{id}/snooze',
|
|
233
|
+
...options,
|
|
234
|
+
headers: {
|
|
235
|
+
'Content-Type': 'application/json',
|
|
236
|
+
...options.headers
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* End a client's snooze
|
|
242
|
+
*
|
|
243
|
+
* 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.
|
|
244
|
+
*/
|
|
245
|
+
unsnoozeClient(options) {
|
|
246
|
+
return (options.client ?? this.client).post({
|
|
247
|
+
security: [
|
|
248
|
+
{
|
|
249
|
+
key: 'oauth2',
|
|
250
|
+
scheme: 'bearer',
|
|
251
|
+
type: 'http'
|
|
252
|
+
},
|
|
253
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
254
|
+
{
|
|
255
|
+
key: 'bearerAuth',
|
|
256
|
+
scheme: 'bearer',
|
|
257
|
+
type: 'http'
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
url: '/clients/{id}/unsnooze',
|
|
261
|
+
...options
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Set a client's do-not-contact channels
|
|
266
|
+
*
|
|
267
|
+
* 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.
|
|
268
|
+
*/
|
|
269
|
+
setClientDoNotContact(options) {
|
|
270
|
+
return (options.client ?? this.client).post({
|
|
271
|
+
security: [
|
|
272
|
+
{
|
|
273
|
+
key: 'oauth2',
|
|
274
|
+
scheme: 'bearer',
|
|
275
|
+
type: 'http'
|
|
276
|
+
},
|
|
277
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
278
|
+
{
|
|
279
|
+
key: 'bearerAuth',
|
|
280
|
+
scheme: 'bearer',
|
|
281
|
+
type: 'http'
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
url: '/clients/{id}/do-not-contact',
|
|
285
|
+
...options,
|
|
286
|
+
headers: {
|
|
287
|
+
'Content-Type': 'application/json',
|
|
288
|
+
...options.headers
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Add a label to a client
|
|
294
|
+
*
|
|
295
|
+
* 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.
|
|
296
|
+
*/
|
|
297
|
+
addClientLabel(options) {
|
|
298
|
+
return (options.client ?? this.client).post({
|
|
299
|
+
security: [
|
|
300
|
+
{
|
|
301
|
+
key: 'oauth2',
|
|
302
|
+
scheme: 'bearer',
|
|
303
|
+
type: 'http'
|
|
304
|
+
},
|
|
305
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
306
|
+
{
|
|
307
|
+
key: 'bearerAuth',
|
|
308
|
+
scheme: 'bearer',
|
|
309
|
+
type: 'http'
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
url: '/clients/{id}/labels',
|
|
313
|
+
...options,
|
|
314
|
+
headers: {
|
|
315
|
+
'Content-Type': 'application/json',
|
|
316
|
+
...options.headers
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Remove a label from a client
|
|
322
|
+
*
|
|
323
|
+
* 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.
|
|
324
|
+
*/
|
|
325
|
+
removeClientLabel(options) {
|
|
326
|
+
return (options.client ?? this.client).delete({
|
|
327
|
+
security: [
|
|
328
|
+
{
|
|
329
|
+
key: 'oauth2',
|
|
330
|
+
scheme: 'bearer',
|
|
331
|
+
type: 'http'
|
|
332
|
+
},
|
|
333
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
334
|
+
{
|
|
335
|
+
key: 'bearerAuth',
|
|
336
|
+
scheme: 'bearer',
|
|
337
|
+
type: 'http'
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
url: '/clients/{id}/labels/{label_id}',
|
|
341
|
+
...options
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Get a client's suspension details
|
|
346
|
+
*
|
|
347
|
+
* 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.
|
|
348
|
+
*/
|
|
349
|
+
getClientSuspension(options) {
|
|
350
|
+
return (options.client ?? this.client).get({
|
|
351
|
+
security: [
|
|
352
|
+
{
|
|
353
|
+
key: 'oauth2',
|
|
354
|
+
scheme: 'bearer',
|
|
355
|
+
type: 'http'
|
|
356
|
+
},
|
|
357
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
358
|
+
{
|
|
359
|
+
key: 'bearerAuth',
|
|
360
|
+
scheme: 'bearer',
|
|
361
|
+
type: 'http'
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
url: '/clients/{id}/suspension',
|
|
365
|
+
...options
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Update a client's suspension details
|
|
370
|
+
*
|
|
371
|
+
* 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.
|
|
372
|
+
*/
|
|
373
|
+
updateClientSuspension(options) {
|
|
374
|
+
return (options.client ?? this.client).patch({
|
|
375
|
+
security: [
|
|
376
|
+
{
|
|
377
|
+
key: 'oauth2',
|
|
378
|
+
scheme: 'bearer',
|
|
379
|
+
type: 'http'
|
|
380
|
+
},
|
|
381
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
382
|
+
{
|
|
383
|
+
key: 'bearerAuth',
|
|
384
|
+
scheme: 'bearer',
|
|
385
|
+
type: 'http'
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
url: '/clients/{id}/suspension',
|
|
389
|
+
...options,
|
|
390
|
+
headers: {
|
|
391
|
+
'Content-Type': 'application/json',
|
|
392
|
+
...options.headers
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* List client labels
|
|
398
|
+
*
|
|
399
|
+
* 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`.
|
|
400
|
+
*/
|
|
401
|
+
listClientLabels(options) {
|
|
402
|
+
return (options?.client ?? this.client).get({
|
|
403
|
+
security: [
|
|
404
|
+
{
|
|
405
|
+
key: 'oauth2',
|
|
406
|
+
scheme: 'bearer',
|
|
407
|
+
type: 'http'
|
|
408
|
+
},
|
|
409
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
410
|
+
{
|
|
411
|
+
key: 'bearerAuth',
|
|
412
|
+
scheme: 'bearer',
|
|
413
|
+
type: 'http'
|
|
414
|
+
}
|
|
415
|
+
],
|
|
416
|
+
url: '/client-labels',
|
|
417
|
+
...options
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Create a label
|
|
422
|
+
*
|
|
423
|
+
* 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`.
|
|
424
|
+
*/
|
|
425
|
+
createClientLabel(options) {
|
|
426
|
+
return (options.client ?? this.client).post({
|
|
427
|
+
security: [
|
|
428
|
+
{
|
|
429
|
+
key: 'oauth2',
|
|
430
|
+
scheme: 'bearer',
|
|
431
|
+
type: 'http'
|
|
432
|
+
},
|
|
433
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
434
|
+
{
|
|
435
|
+
key: 'bearerAuth',
|
|
436
|
+
scheme: 'bearer',
|
|
437
|
+
type: 'http'
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
url: '/client-labels',
|
|
441
|
+
...options,
|
|
442
|
+
headers: {
|
|
443
|
+
'Content-Type': 'application/json',
|
|
444
|
+
...options.headers
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* List a client's notes
|
|
450
|
+
*
|
|
451
|
+
* 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.
|
|
452
|
+
*/
|
|
453
|
+
listClientNotes(options) {
|
|
454
|
+
return (options.client ?? this.client).get({
|
|
455
|
+
security: [
|
|
456
|
+
{
|
|
457
|
+
key: 'oauth2',
|
|
458
|
+
scheme: 'bearer',
|
|
459
|
+
type: 'http'
|
|
460
|
+
},
|
|
461
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
462
|
+
{
|
|
463
|
+
key: 'bearerAuth',
|
|
464
|
+
scheme: 'bearer',
|
|
465
|
+
type: 'http'
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
url: '/clients/{id}/notes',
|
|
469
|
+
...options
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Add a note
|
|
474
|
+
*
|
|
475
|
+
* 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.
|
|
476
|
+
*/
|
|
477
|
+
createClientNote(options) {
|
|
478
|
+
return (options.client ?? this.client).post({
|
|
479
|
+
security: [
|
|
480
|
+
{
|
|
481
|
+
key: 'oauth2',
|
|
482
|
+
scheme: 'bearer',
|
|
483
|
+
type: 'http'
|
|
484
|
+
},
|
|
485
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
486
|
+
{
|
|
487
|
+
key: 'bearerAuth',
|
|
488
|
+
scheme: 'bearer',
|
|
489
|
+
type: 'http'
|
|
490
|
+
}
|
|
491
|
+
],
|
|
492
|
+
url: '/clients/{id}/notes',
|
|
493
|
+
...options,
|
|
494
|
+
headers: {
|
|
495
|
+
'Content-Type': 'application/json',
|
|
496
|
+
...options.headers
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Pin a note
|
|
502
|
+
*
|
|
503
|
+
* 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.
|
|
504
|
+
*/
|
|
505
|
+
pinNote(options) {
|
|
506
|
+
return (options.client ?? this.client).post({
|
|
507
|
+
security: [
|
|
508
|
+
{
|
|
509
|
+
key: 'oauth2',
|
|
510
|
+
scheme: 'bearer',
|
|
511
|
+
type: 'http'
|
|
512
|
+
},
|
|
513
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
514
|
+
{
|
|
515
|
+
key: 'bearerAuth',
|
|
516
|
+
scheme: 'bearer',
|
|
517
|
+
type: 'http'
|
|
518
|
+
}
|
|
519
|
+
],
|
|
520
|
+
url: '/notes/{note_id}/pin',
|
|
521
|
+
...options
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Unpin a note
|
|
526
|
+
*
|
|
527
|
+
* 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.
|
|
528
|
+
*/
|
|
529
|
+
unpinNote(options) {
|
|
530
|
+
return (options.client ?? this.client).post({
|
|
531
|
+
security: [
|
|
532
|
+
{
|
|
533
|
+
key: 'oauth2',
|
|
534
|
+
scheme: 'bearer',
|
|
535
|
+
type: 'http'
|
|
536
|
+
},
|
|
537
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
538
|
+
{
|
|
539
|
+
key: 'bearerAuth',
|
|
540
|
+
scheme: 'bearer',
|
|
541
|
+
type: 'http'
|
|
542
|
+
}
|
|
543
|
+
],
|
|
544
|
+
url: '/notes/{note_id}/unpin',
|
|
545
|
+
...options
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* List a client's interactions
|
|
550
|
+
*
|
|
551
|
+
* 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.
|
|
552
|
+
*/
|
|
553
|
+
listClientInteractions(options) {
|
|
554
|
+
return (options.client ?? this.client).get({
|
|
555
|
+
security: [
|
|
556
|
+
{
|
|
557
|
+
key: 'oauth2',
|
|
558
|
+
scheme: 'bearer',
|
|
559
|
+
type: 'http'
|
|
560
|
+
},
|
|
561
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
562
|
+
{
|
|
563
|
+
key: 'bearerAuth',
|
|
564
|
+
scheme: 'bearer',
|
|
565
|
+
type: 'http'
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
url: '/clients/{id}/interactions',
|
|
569
|
+
...options
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Log an interaction
|
|
574
|
+
*
|
|
575
|
+
* 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.
|
|
576
|
+
*/
|
|
577
|
+
createClientInteraction(options) {
|
|
578
|
+
return (options.client ?? this.client).post({
|
|
579
|
+
security: [
|
|
580
|
+
{
|
|
581
|
+
key: 'oauth2',
|
|
582
|
+
scheme: 'bearer',
|
|
583
|
+
type: 'http'
|
|
584
|
+
},
|
|
585
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
586
|
+
{
|
|
587
|
+
key: 'bearerAuth',
|
|
588
|
+
scheme: 'bearer',
|
|
589
|
+
type: 'http'
|
|
590
|
+
}
|
|
591
|
+
],
|
|
592
|
+
url: '/clients/{id}/interactions',
|
|
593
|
+
...options,
|
|
594
|
+
headers: {
|
|
595
|
+
'Content-Type': 'application/json',
|
|
596
|
+
...options.headers
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* List a client's open reminders
|
|
602
|
+
*
|
|
603
|
+
* 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.
|
|
604
|
+
*/
|
|
605
|
+
listClientReminders(options) {
|
|
606
|
+
return (options.client ?? this.client).get({
|
|
607
|
+
security: [
|
|
608
|
+
{
|
|
609
|
+
key: 'oauth2',
|
|
610
|
+
scheme: 'bearer',
|
|
611
|
+
type: 'http'
|
|
612
|
+
},
|
|
613
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
614
|
+
{
|
|
615
|
+
key: 'bearerAuth',
|
|
616
|
+
scheme: 'bearer',
|
|
617
|
+
type: 'http'
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
url: '/clients/{id}/reminders',
|
|
621
|
+
...options
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Set a reminder
|
|
626
|
+
*
|
|
627
|
+
* 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.
|
|
628
|
+
*/
|
|
629
|
+
createClientReminder(options) {
|
|
630
|
+
return (options.client ?? this.client).post({
|
|
631
|
+
security: [
|
|
632
|
+
{
|
|
633
|
+
key: 'oauth2',
|
|
634
|
+
scheme: 'bearer',
|
|
635
|
+
type: 'http'
|
|
636
|
+
},
|
|
637
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
638
|
+
{
|
|
639
|
+
key: 'bearerAuth',
|
|
640
|
+
scheme: 'bearer',
|
|
641
|
+
type: 'http'
|
|
642
|
+
}
|
|
643
|
+
],
|
|
644
|
+
url: '/clients/{id}/reminders',
|
|
645
|
+
...options,
|
|
646
|
+
headers: {
|
|
647
|
+
'Content-Type': 'application/json',
|
|
648
|
+
...options.headers
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Get a reminder
|
|
654
|
+
*
|
|
655
|
+
* One reminder, open or ticked off. Needs `notes:read`. Only for reminders at the key's location: any other id is a 404.
|
|
656
|
+
*/
|
|
657
|
+
getReminder(options) {
|
|
658
|
+
return (options.client ?? this.client).get({
|
|
659
|
+
security: [
|
|
660
|
+
{
|
|
661
|
+
key: 'oauth2',
|
|
662
|
+
scheme: 'bearer',
|
|
663
|
+
type: 'http'
|
|
664
|
+
},
|
|
665
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
666
|
+
{
|
|
667
|
+
key: 'bearerAuth',
|
|
668
|
+
scheme: 'bearer',
|
|
669
|
+
type: 'http'
|
|
670
|
+
}
|
|
671
|
+
],
|
|
672
|
+
url: '/reminders/{id}',
|
|
673
|
+
...options
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Change a reminder
|
|
678
|
+
*
|
|
679
|
+
* 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.
|
|
680
|
+
*/
|
|
681
|
+
updateReminder(options) {
|
|
682
|
+
return (options.client ?? this.client).patch({
|
|
683
|
+
security: [
|
|
684
|
+
{
|
|
685
|
+
key: 'oauth2',
|
|
686
|
+
scheme: 'bearer',
|
|
687
|
+
type: 'http'
|
|
688
|
+
},
|
|
689
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
690
|
+
{
|
|
691
|
+
key: 'bearerAuth',
|
|
692
|
+
scheme: 'bearer',
|
|
693
|
+
type: 'http'
|
|
694
|
+
}
|
|
695
|
+
],
|
|
696
|
+
url: '/reminders/{id}',
|
|
697
|
+
...options,
|
|
698
|
+
headers: {
|
|
699
|
+
'Content-Type': 'application/json',
|
|
700
|
+
...options.headers
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Close a reminder
|
|
706
|
+
*
|
|
707
|
+
* 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.
|
|
708
|
+
*/
|
|
709
|
+
closeReminder(options) {
|
|
710
|
+
return (options.client ?? this.client).post({
|
|
711
|
+
security: [
|
|
712
|
+
{
|
|
713
|
+
key: 'oauth2',
|
|
714
|
+
scheme: 'bearer',
|
|
715
|
+
type: 'http'
|
|
716
|
+
},
|
|
717
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
718
|
+
{
|
|
719
|
+
key: 'bearerAuth',
|
|
720
|
+
scheme: 'bearer',
|
|
721
|
+
type: 'http'
|
|
722
|
+
}
|
|
723
|
+
],
|
|
724
|
+
url: '/reminders/{id}/close',
|
|
725
|
+
...options,
|
|
726
|
+
headers: {
|
|
727
|
+
'Content-Type': 'application/json',
|
|
728
|
+
...options.headers
|
|
729
|
+
}
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Reassign a reminder
|
|
734
|
+
*
|
|
735
|
+
* 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.
|
|
736
|
+
*/
|
|
737
|
+
assignReminder(options) {
|
|
738
|
+
return (options.client ?? this.client).post({
|
|
739
|
+
security: [
|
|
740
|
+
{
|
|
741
|
+
key: 'oauth2',
|
|
742
|
+
scheme: 'bearer',
|
|
743
|
+
type: 'http'
|
|
744
|
+
},
|
|
745
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
746
|
+
{
|
|
747
|
+
key: 'bearerAuth',
|
|
748
|
+
scheme: 'bearer',
|
|
749
|
+
type: 'http'
|
|
750
|
+
}
|
|
751
|
+
],
|
|
752
|
+
url: '/reminders/{id}/assign',
|
|
753
|
+
...options,
|
|
754
|
+
headers: {
|
|
755
|
+
'Content-Type': 'application/json',
|
|
756
|
+
...options.headers
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* List the location's reminders
|
|
762
|
+
*
|
|
763
|
+
* 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`.
|
|
764
|
+
*/
|
|
765
|
+
listReminders(options) {
|
|
766
|
+
return (options?.client ?? this.client).get({
|
|
767
|
+
security: [
|
|
768
|
+
{
|
|
769
|
+
key: 'oauth2',
|
|
770
|
+
scheme: 'bearer',
|
|
771
|
+
type: 'http'
|
|
772
|
+
},
|
|
773
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
774
|
+
{
|
|
775
|
+
key: 'bearerAuth',
|
|
776
|
+
scheme: 'bearer',
|
|
777
|
+
type: 'http'
|
|
778
|
+
}
|
|
779
|
+
],
|
|
780
|
+
url: '/reminders',
|
|
781
|
+
...options
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* List forms
|
|
786
|
+
*
|
|
787
|
+
* The location's published forms, newest first. Use a form's id to list its submissions. Needs `forms:read`.
|
|
788
|
+
*/
|
|
789
|
+
listForms(options) {
|
|
790
|
+
return (options?.client ?? this.client).get({
|
|
791
|
+
security: [
|
|
792
|
+
{
|
|
793
|
+
key: 'oauth2',
|
|
794
|
+
scheme: 'bearer',
|
|
795
|
+
type: 'http'
|
|
796
|
+
},
|
|
797
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
798
|
+
{
|
|
799
|
+
key: 'bearerAuth',
|
|
800
|
+
scheme: 'bearer',
|
|
801
|
+
type: 'http'
|
|
802
|
+
}
|
|
803
|
+
],
|
|
804
|
+
url: '/forms',
|
|
805
|
+
...options
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Get a form
|
|
810
|
+
*
|
|
811
|
+
* 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`.
|
|
812
|
+
*/
|
|
813
|
+
getForm(options) {
|
|
814
|
+
return (options.client ?? this.client).get({
|
|
815
|
+
security: [
|
|
816
|
+
{
|
|
817
|
+
key: 'oauth2',
|
|
818
|
+
scheme: 'bearer',
|
|
819
|
+
type: 'http'
|
|
820
|
+
},
|
|
821
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
822
|
+
{
|
|
823
|
+
key: 'bearerAuth',
|
|
824
|
+
scheme: 'bearer',
|
|
825
|
+
type: 'http'
|
|
826
|
+
}
|
|
827
|
+
],
|
|
828
|
+
url: '/forms/{id}',
|
|
829
|
+
...options
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* List a form's submissions
|
|
834
|
+
*
|
|
835
|
+
* 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`.
|
|
836
|
+
*/
|
|
837
|
+
listFormSubmissions(options) {
|
|
838
|
+
return (options.client ?? this.client).get({
|
|
839
|
+
security: [
|
|
840
|
+
{
|
|
841
|
+
key: 'oauth2',
|
|
842
|
+
scheme: 'bearer',
|
|
843
|
+
type: 'http'
|
|
844
|
+
},
|
|
845
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
846
|
+
{
|
|
847
|
+
key: 'bearerAuth',
|
|
848
|
+
scheme: 'bearer',
|
|
849
|
+
type: 'http'
|
|
850
|
+
}
|
|
851
|
+
],
|
|
852
|
+
url: '/forms/{id}/submissions',
|
|
853
|
+
...options
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* List a client's form submissions
|
|
858
|
+
*
|
|
859
|
+
* 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`.
|
|
860
|
+
*/
|
|
861
|
+
listClientFormSubmissions(options) {
|
|
862
|
+
return (options.client ?? this.client).get({
|
|
863
|
+
security: [
|
|
864
|
+
{
|
|
865
|
+
key: 'oauth2',
|
|
866
|
+
scheme: 'bearer',
|
|
867
|
+
type: 'http'
|
|
868
|
+
},
|
|
869
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
870
|
+
{
|
|
871
|
+
key: 'bearerAuth',
|
|
872
|
+
scheme: 'bearer',
|
|
873
|
+
type: 'http'
|
|
874
|
+
}
|
|
875
|
+
],
|
|
876
|
+
url: '/clients/{id}/form-submissions',
|
|
877
|
+
...options
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Get a form submission
|
|
882
|
+
*
|
|
883
|
+
* One submission with its answers. Answers can contain contact and health details. Needs `forms:read`.
|
|
884
|
+
*/
|
|
885
|
+
getFormSubmission(options) {
|
|
886
|
+
return (options.client ?? this.client).get({
|
|
887
|
+
security: [
|
|
888
|
+
{
|
|
889
|
+
key: 'oauth2',
|
|
890
|
+
scheme: 'bearer',
|
|
891
|
+
type: 'http'
|
|
892
|
+
},
|
|
893
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
894
|
+
{
|
|
895
|
+
key: 'bearerAuth',
|
|
896
|
+
scheme: 'bearer',
|
|
897
|
+
type: 'http'
|
|
898
|
+
}
|
|
899
|
+
],
|
|
900
|
+
url: '/form-submissions/{id}',
|
|
901
|
+
...options
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Member and risk counts
|
|
906
|
+
*
|
|
907
|
+
* 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`.
|
|
908
|
+
*
|
|
909
|
+
* 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.
|
|
910
|
+
*/
|
|
911
|
+
getSummary(options) {
|
|
912
|
+
return (options?.client ?? this.client).get({
|
|
913
|
+
security: [
|
|
914
|
+
{
|
|
915
|
+
key: 'oauth2',
|
|
916
|
+
scheme: 'bearer',
|
|
917
|
+
type: 'http'
|
|
918
|
+
},
|
|
919
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
920
|
+
{
|
|
921
|
+
key: 'bearerAuth',
|
|
922
|
+
scheme: 'bearer',
|
|
923
|
+
type: 'http'
|
|
924
|
+
}
|
|
925
|
+
],
|
|
926
|
+
url: '/summary',
|
|
927
|
+
...options
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* List the team's activity
|
|
932
|
+
*
|
|
933
|
+
* 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`.
|
|
934
|
+
*
|
|
935
|
+
* 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.
|
|
936
|
+
*
|
|
937
|
+
* Pages don't repeat or skip items when new ones are added meanwhile.
|
|
938
|
+
*/
|
|
939
|
+
listActivity(options) {
|
|
940
|
+
return (options?.client ?? this.client).get({
|
|
941
|
+
security: [
|
|
942
|
+
{
|
|
943
|
+
key: 'oauth2',
|
|
944
|
+
scheme: 'bearer',
|
|
945
|
+
type: 'http'
|
|
946
|
+
},
|
|
947
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
948
|
+
{
|
|
949
|
+
key: 'bearerAuth',
|
|
950
|
+
scheme: 'bearer',
|
|
951
|
+
type: 'http'
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
url: '/activity',
|
|
955
|
+
...options
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Actions Report
|
|
960
|
+
*
|
|
961
|
+
* 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`.
|
|
962
|
+
*/
|
|
963
|
+
getActionsReport(options) {
|
|
964
|
+
return (options.client ?? this.client).get({
|
|
965
|
+
security: [
|
|
966
|
+
{
|
|
967
|
+
key: 'oauth2',
|
|
968
|
+
scheme: 'bearer',
|
|
969
|
+
type: 'http'
|
|
970
|
+
},
|
|
971
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
972
|
+
{
|
|
973
|
+
key: 'bearerAuth',
|
|
974
|
+
scheme: 'bearer',
|
|
975
|
+
type: 'http'
|
|
976
|
+
}
|
|
977
|
+
],
|
|
978
|
+
url: '/reports/actions',
|
|
979
|
+
...options
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* List leads
|
|
984
|
+
*
|
|
985
|
+
* 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`.
|
|
986
|
+
*
|
|
987
|
+
* 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.
|
|
988
|
+
*/
|
|
989
|
+
listLeads(options) {
|
|
990
|
+
return (options?.client ?? this.client).get({
|
|
991
|
+
security: [
|
|
992
|
+
{
|
|
993
|
+
key: 'oauth2',
|
|
994
|
+
scheme: 'bearer',
|
|
995
|
+
type: 'http'
|
|
996
|
+
},
|
|
997
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
998
|
+
{
|
|
999
|
+
key: 'bearerAuth',
|
|
1000
|
+
scheme: 'bearer',
|
|
1001
|
+
type: 'http'
|
|
1002
|
+
}
|
|
1003
|
+
],
|
|
1004
|
+
url: '/leads',
|
|
1005
|
+
...options
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Add a lead
|
|
1010
|
+
*
|
|
1011
|
+
* 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).
|
|
1012
|
+
*/
|
|
1013
|
+
createLead(options) {
|
|
1014
|
+
return (options.client ?? this.client).post({
|
|
1015
|
+
security: [
|
|
1016
|
+
{
|
|
1017
|
+
key: 'oauth2',
|
|
1018
|
+
scheme: 'bearer',
|
|
1019
|
+
type: 'http'
|
|
1020
|
+
},
|
|
1021
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1022
|
+
{
|
|
1023
|
+
key: 'bearerAuth',
|
|
1024
|
+
scheme: 'bearer',
|
|
1025
|
+
type: 'http'
|
|
1026
|
+
}
|
|
1027
|
+
],
|
|
1028
|
+
url: '/leads',
|
|
1029
|
+
...options,
|
|
1030
|
+
headers: {
|
|
1031
|
+
'Content-Type': 'application/json',
|
|
1032
|
+
...options.headers
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Get a lead
|
|
1038
|
+
*
|
|
1039
|
+
* 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.
|
|
1040
|
+
*/
|
|
1041
|
+
getLead(options) {
|
|
1042
|
+
return (options.client ?? this.client).get({
|
|
1043
|
+
security: [
|
|
1044
|
+
{
|
|
1045
|
+
key: 'oauth2',
|
|
1046
|
+
scheme: 'bearer',
|
|
1047
|
+
type: 'http'
|
|
1048
|
+
},
|
|
1049
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1050
|
+
{
|
|
1051
|
+
key: 'bearerAuth',
|
|
1052
|
+
scheme: 'bearer',
|
|
1053
|
+
type: 'http'
|
|
1054
|
+
}
|
|
1055
|
+
],
|
|
1056
|
+
url: '/leads/{id}',
|
|
1057
|
+
...options
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* List lead sources
|
|
1062
|
+
*
|
|
1063
|
+
* 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`.
|
|
1064
|
+
*/
|
|
1065
|
+
listLeadSources(options) {
|
|
1066
|
+
return (options?.client ?? this.client).get({
|
|
1067
|
+
security: [
|
|
1068
|
+
{
|
|
1069
|
+
key: 'oauth2',
|
|
1070
|
+
scheme: 'bearer',
|
|
1071
|
+
type: 'http'
|
|
1072
|
+
},
|
|
1073
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1074
|
+
{
|
|
1075
|
+
key: 'bearerAuth',
|
|
1076
|
+
scheme: 'bearer',
|
|
1077
|
+
type: 'http'
|
|
1078
|
+
}
|
|
1079
|
+
],
|
|
1080
|
+
url: '/lead-sources',
|
|
1081
|
+
...options
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Archive a lead
|
|
1086
|
+
*
|
|
1087
|
+
* 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.
|
|
1088
|
+
*/
|
|
1089
|
+
archiveLead(options) {
|
|
1090
|
+
return (options.client ?? this.client).post({
|
|
1091
|
+
security: [
|
|
1092
|
+
{
|
|
1093
|
+
key: 'oauth2',
|
|
1094
|
+
scheme: 'bearer',
|
|
1095
|
+
type: 'http'
|
|
1096
|
+
},
|
|
1097
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1098
|
+
{
|
|
1099
|
+
key: 'bearerAuth',
|
|
1100
|
+
scheme: 'bearer',
|
|
1101
|
+
type: 'http'
|
|
1102
|
+
}
|
|
1103
|
+
],
|
|
1104
|
+
url: '/leads/{id}/archive',
|
|
1105
|
+
...options
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Restore a lead
|
|
1110
|
+
*
|
|
1111
|
+
* 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.
|
|
1112
|
+
*/
|
|
1113
|
+
unarchiveLead(options) {
|
|
1114
|
+
return (options.client ?? this.client).post({
|
|
1115
|
+
security: [
|
|
1116
|
+
{
|
|
1117
|
+
key: 'oauth2',
|
|
1118
|
+
scheme: 'bearer',
|
|
1119
|
+
type: 'http'
|
|
1120
|
+
},
|
|
1121
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1122
|
+
{
|
|
1123
|
+
key: 'bearerAuth',
|
|
1124
|
+
scheme: 'bearer',
|
|
1125
|
+
type: 'http'
|
|
1126
|
+
}
|
|
1127
|
+
],
|
|
1128
|
+
url: '/leads/{id}/unarchive',
|
|
1129
|
+
...options
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Archive a client's leads
|
|
1134
|
+
*
|
|
1135
|
+
* 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.
|
|
1136
|
+
*/
|
|
1137
|
+
archiveClientLeads(options) {
|
|
1138
|
+
return (options.client ?? this.client).post({
|
|
1139
|
+
security: [
|
|
1140
|
+
{
|
|
1141
|
+
key: 'oauth2',
|
|
1142
|
+
scheme: 'bearer',
|
|
1143
|
+
type: 'http'
|
|
1144
|
+
},
|
|
1145
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1146
|
+
{
|
|
1147
|
+
key: 'bearerAuth',
|
|
1148
|
+
scheme: 'bearer',
|
|
1149
|
+
type: 'http'
|
|
1150
|
+
}
|
|
1151
|
+
],
|
|
1152
|
+
url: '/clients/{id}/leads/archive',
|
|
1153
|
+
...options
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Restore a client's leads
|
|
1158
|
+
*
|
|
1159
|
+
* 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.
|
|
1160
|
+
*/
|
|
1161
|
+
unarchiveClientLeads(options) {
|
|
1162
|
+
return (options.client ?? this.client).post({
|
|
1163
|
+
security: [
|
|
1164
|
+
{
|
|
1165
|
+
key: 'oauth2',
|
|
1166
|
+
scheme: 'bearer',
|
|
1167
|
+
type: 'http'
|
|
1168
|
+
},
|
|
1169
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1170
|
+
{
|
|
1171
|
+
key: 'bearerAuth',
|
|
1172
|
+
scheme: 'bearer',
|
|
1173
|
+
type: 'http'
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
url: '/clients/{id}/leads/unarchive',
|
|
1177
|
+
...options
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* List a client's possible duplicates
|
|
1182
|
+
*
|
|
1183
|
+
* 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.
|
|
1184
|
+
*/
|
|
1185
|
+
listPossibleDuplicates(options) {
|
|
1186
|
+
return (options.client ?? this.client).get({
|
|
1187
|
+
security: [
|
|
1188
|
+
{
|
|
1189
|
+
key: 'oauth2',
|
|
1190
|
+
scheme: 'bearer',
|
|
1191
|
+
type: 'http'
|
|
1192
|
+
},
|
|
1193
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1194
|
+
{
|
|
1195
|
+
key: 'bearerAuth',
|
|
1196
|
+
scheme: 'bearer',
|
|
1197
|
+
type: 'http'
|
|
1198
|
+
}
|
|
1199
|
+
],
|
|
1200
|
+
url: '/clients/{id}/possible-duplicates',
|
|
1201
|
+
...options
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Clear Needs merge
|
|
1206
|
+
*
|
|
1207
|
+
* 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.
|
|
1208
|
+
*/
|
|
1209
|
+
markNotDuplicate(options) {
|
|
1210
|
+
return (options.client ?? this.client).post({
|
|
1211
|
+
security: [
|
|
1212
|
+
{
|
|
1213
|
+
key: 'oauth2',
|
|
1214
|
+
scheme: 'bearer',
|
|
1215
|
+
type: 'http'
|
|
1216
|
+
},
|
|
1217
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1218
|
+
{
|
|
1219
|
+
key: 'bearerAuth',
|
|
1220
|
+
scheme: 'bearer',
|
|
1221
|
+
type: 'http'
|
|
1222
|
+
}
|
|
1223
|
+
],
|
|
1224
|
+
url: '/clients/{id}/not-duplicate',
|
|
1225
|
+
...options
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* List conversations (the inbox)
|
|
1230
|
+
*
|
|
1231
|
+
* 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`.
|
|
1232
|
+
*
|
|
1233
|
+
* 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.
|
|
1234
|
+
*
|
|
1235
|
+
* 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.
|
|
1236
|
+
*/
|
|
1237
|
+
listConversations(options) {
|
|
1238
|
+
return (options?.client ?? this.client).get({
|
|
1239
|
+
security: [
|
|
1240
|
+
{
|
|
1241
|
+
key: 'oauth2',
|
|
1242
|
+
scheme: 'bearer',
|
|
1243
|
+
type: 'http'
|
|
1244
|
+
},
|
|
1245
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1246
|
+
{
|
|
1247
|
+
key: 'bearerAuth',
|
|
1248
|
+
scheme: 'bearer',
|
|
1249
|
+
type: 'http'
|
|
1250
|
+
}
|
|
1251
|
+
],
|
|
1252
|
+
url: '/conversations',
|
|
1253
|
+
...options
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Get a conversation
|
|
1258
|
+
*
|
|
1259
|
+
* One conversation at the credential's location. Needs `conversations:read`. A conversation at another location is a 404.
|
|
1260
|
+
*/
|
|
1261
|
+
getConversation(options) {
|
|
1262
|
+
return (options.client ?? this.client).get({
|
|
1263
|
+
security: [
|
|
1264
|
+
{
|
|
1265
|
+
key: 'oauth2',
|
|
1266
|
+
scheme: 'bearer',
|
|
1267
|
+
type: 'http'
|
|
1268
|
+
},
|
|
1269
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1270
|
+
{
|
|
1271
|
+
key: 'bearerAuth',
|
|
1272
|
+
scheme: 'bearer',
|
|
1273
|
+
type: 'http'
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
url: '/conversations/{id}',
|
|
1277
|
+
...options
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* List a conversation's messages
|
|
1282
|
+
*
|
|
1283
|
+
* 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.
|
|
1284
|
+
*
|
|
1285
|
+
* 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.
|
|
1286
|
+
*/
|
|
1287
|
+
listConversationMessages(options) {
|
|
1288
|
+
return (options.client ?? this.client).get({
|
|
1289
|
+
security: [
|
|
1290
|
+
{
|
|
1291
|
+
key: 'oauth2',
|
|
1292
|
+
scheme: 'bearer',
|
|
1293
|
+
type: 'http'
|
|
1294
|
+
},
|
|
1295
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1296
|
+
{
|
|
1297
|
+
key: 'bearerAuth',
|
|
1298
|
+
scheme: 'bearer',
|
|
1299
|
+
type: 'http'
|
|
1300
|
+
}
|
|
1301
|
+
],
|
|
1302
|
+
url: '/conversations/{id}/messages',
|
|
1303
|
+
...options
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Reply to a conversation
|
|
1308
|
+
*
|
|
1309
|
+
* 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.
|
|
1310
|
+
*
|
|
1311
|
+
* 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).
|
|
1312
|
+
*
|
|
1313
|
+
* 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.
|
|
1314
|
+
*/
|
|
1315
|
+
replyToConversation(options) {
|
|
1316
|
+
return (options.client ?? this.client).post({
|
|
1317
|
+
security: [
|
|
1318
|
+
{
|
|
1319
|
+
key: 'oauth2',
|
|
1320
|
+
scheme: 'bearer',
|
|
1321
|
+
type: 'http'
|
|
1322
|
+
},
|
|
1323
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1324
|
+
{
|
|
1325
|
+
key: 'bearerAuth',
|
|
1326
|
+
scheme: 'bearer',
|
|
1327
|
+
type: 'http'
|
|
1328
|
+
}
|
|
1329
|
+
],
|
|
1330
|
+
url: '/conversations/{id}/messages',
|
|
1331
|
+
...options,
|
|
1332
|
+
headers: {
|
|
1333
|
+
'Content-Type': 'application/json',
|
|
1334
|
+
...options.headers
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Send a message to a client
|
|
1340
|
+
*
|
|
1341
|
+
* 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.
|
|
1342
|
+
*
|
|
1343
|
+
* 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.
|
|
1344
|
+
*
|
|
1345
|
+
* 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.
|
|
1346
|
+
*/
|
|
1347
|
+
sendClientMessage(options) {
|
|
1348
|
+
return (options.client ?? this.client).post({
|
|
1349
|
+
security: [
|
|
1350
|
+
{
|
|
1351
|
+
key: 'oauth2',
|
|
1352
|
+
scheme: 'bearer',
|
|
1353
|
+
type: 'http'
|
|
1354
|
+
},
|
|
1355
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1356
|
+
{
|
|
1357
|
+
key: 'bearerAuth',
|
|
1358
|
+
scheme: 'bearer',
|
|
1359
|
+
type: 'http'
|
|
1360
|
+
}
|
|
1361
|
+
],
|
|
1362
|
+
url: '/clients/{id}/messages',
|
|
1363
|
+
...options,
|
|
1364
|
+
headers: {
|
|
1365
|
+
'Content-Type': 'application/json',
|
|
1366
|
+
...options.headers
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Mark a conversation read
|
|
1372
|
+
*
|
|
1373
|
+
* 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.
|
|
1374
|
+
*/
|
|
1375
|
+
markConversationRead(options) {
|
|
1376
|
+
return (options.client ?? this.client).post({
|
|
1377
|
+
security: [
|
|
1378
|
+
{
|
|
1379
|
+
key: 'oauth2',
|
|
1380
|
+
scheme: 'bearer',
|
|
1381
|
+
type: 'http'
|
|
1382
|
+
},
|
|
1383
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1384
|
+
{
|
|
1385
|
+
key: 'bearerAuth',
|
|
1386
|
+
scheme: 'bearer',
|
|
1387
|
+
type: 'http'
|
|
1388
|
+
}
|
|
1389
|
+
],
|
|
1390
|
+
url: '/conversations/{id}/read',
|
|
1391
|
+
...options
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Mark a conversation unread
|
|
1396
|
+
*
|
|
1397
|
+
* 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.
|
|
1398
|
+
*/
|
|
1399
|
+
markConversationUnread(options) {
|
|
1400
|
+
return (options.client ?? this.client).post({
|
|
1401
|
+
security: [
|
|
1402
|
+
{
|
|
1403
|
+
key: 'oauth2',
|
|
1404
|
+
scheme: 'bearer',
|
|
1405
|
+
type: 'http'
|
|
1406
|
+
},
|
|
1407
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1408
|
+
{
|
|
1409
|
+
key: 'bearerAuth',
|
|
1410
|
+
scheme: 'bearer',
|
|
1411
|
+
type: 'http'
|
|
1412
|
+
}
|
|
1413
|
+
],
|
|
1414
|
+
url: '/conversations/{id}/unread',
|
|
1415
|
+
...options
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Archive a conversation
|
|
1420
|
+
*
|
|
1421
|
+
* 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.
|
|
1422
|
+
*/
|
|
1423
|
+
archiveConversation(options) {
|
|
1424
|
+
return (options.client ?? this.client).post({
|
|
1425
|
+
security: [
|
|
1426
|
+
{
|
|
1427
|
+
key: 'oauth2',
|
|
1428
|
+
scheme: 'bearer',
|
|
1429
|
+
type: 'http'
|
|
1430
|
+
},
|
|
1431
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1432
|
+
{
|
|
1433
|
+
key: 'bearerAuth',
|
|
1434
|
+
scheme: 'bearer',
|
|
1435
|
+
type: 'http'
|
|
1436
|
+
}
|
|
1437
|
+
],
|
|
1438
|
+
url: '/conversations/{id}/archive',
|
|
1439
|
+
...options
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Unarchive a conversation
|
|
1444
|
+
*
|
|
1445
|
+
* 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.
|
|
1446
|
+
*/
|
|
1447
|
+
unarchiveConversation(options) {
|
|
1448
|
+
return (options.client ?? this.client).post({
|
|
1449
|
+
security: [
|
|
1450
|
+
{
|
|
1451
|
+
key: 'oauth2',
|
|
1452
|
+
scheme: 'bearer',
|
|
1453
|
+
type: 'http'
|
|
1454
|
+
},
|
|
1455
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1456
|
+
{
|
|
1457
|
+
key: 'bearerAuth',
|
|
1458
|
+
scheme: 'bearer',
|
|
1459
|
+
type: 'http'
|
|
1460
|
+
}
|
|
1461
|
+
],
|
|
1462
|
+
url: '/conversations/{id}/unarchive',
|
|
1463
|
+
...options
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Undo no reply needed
|
|
1468
|
+
*
|
|
1469
|
+
* 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.
|
|
1470
|
+
*/
|
|
1471
|
+
undoConversationNoReplyNeeded(options) {
|
|
1472
|
+
return (options.client ?? this.client).delete({
|
|
1473
|
+
security: [
|
|
1474
|
+
{
|
|
1475
|
+
key: 'oauth2',
|
|
1476
|
+
scheme: 'bearer',
|
|
1477
|
+
type: 'http'
|
|
1478
|
+
},
|
|
1479
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1480
|
+
{
|
|
1481
|
+
key: 'bearerAuth',
|
|
1482
|
+
scheme: 'bearer',
|
|
1483
|
+
type: 'http'
|
|
1484
|
+
}
|
|
1485
|
+
],
|
|
1486
|
+
url: '/conversations/{id}/no-reply-needed',
|
|
1487
|
+
...options
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Mark a conversation as needing no reply
|
|
1492
|
+
*
|
|
1493
|
+
* 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.
|
|
1494
|
+
*
|
|
1495
|
+
* 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.
|
|
1496
|
+
*/
|
|
1497
|
+
markConversationNoReplyNeeded(options) {
|
|
1498
|
+
return (options.client ?? this.client).post({
|
|
1499
|
+
security: [
|
|
1500
|
+
{
|
|
1501
|
+
key: 'oauth2',
|
|
1502
|
+
scheme: 'bearer',
|
|
1503
|
+
type: 'http'
|
|
1504
|
+
},
|
|
1505
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1506
|
+
{
|
|
1507
|
+
key: 'bearerAuth',
|
|
1508
|
+
scheme: 'bearer',
|
|
1509
|
+
type: 'http'
|
|
1510
|
+
}
|
|
1511
|
+
],
|
|
1512
|
+
url: '/conversations/{id}/no-reply-needed',
|
|
1513
|
+
...options,
|
|
1514
|
+
headers: {
|
|
1515
|
+
'Content-Type': 'application/json',
|
|
1516
|
+
...options.headers
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
/**
|
|
1521
|
+
* Link a conversation to a client
|
|
1522
|
+
*
|
|
1523
|
+
* 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.
|
|
1524
|
+
*
|
|
1525
|
+
* 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.
|
|
1526
|
+
*/
|
|
1527
|
+
linkConversationToClient(options) {
|
|
1528
|
+
return (options.client ?? this.client).post({
|
|
1529
|
+
security: [
|
|
1530
|
+
{
|
|
1531
|
+
key: 'oauth2',
|
|
1532
|
+
scheme: 'bearer',
|
|
1533
|
+
type: 'http'
|
|
1534
|
+
},
|
|
1535
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1536
|
+
{
|
|
1537
|
+
key: 'bearerAuth',
|
|
1538
|
+
scheme: 'bearer',
|
|
1539
|
+
type: 'http'
|
|
1540
|
+
}
|
|
1541
|
+
],
|
|
1542
|
+
url: '/conversations/{id}/link-client',
|
|
1543
|
+
...options,
|
|
1544
|
+
headers: {
|
|
1545
|
+
'Content-Type': 'application/json',
|
|
1546
|
+
...options.headers
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* List communication channels
|
|
1552
|
+
*
|
|
1553
|
+
* 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`.
|
|
1554
|
+
*/
|
|
1555
|
+
listChannels(options) {
|
|
1556
|
+
return (options?.client ?? this.client).get({
|
|
1557
|
+
security: [
|
|
1558
|
+
{
|
|
1559
|
+
key: 'oauth2',
|
|
1560
|
+
scheme: 'bearer',
|
|
1561
|
+
type: 'http'
|
|
1562
|
+
},
|
|
1563
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1564
|
+
{
|
|
1565
|
+
key: 'bearerAuth',
|
|
1566
|
+
scheme: 'bearer',
|
|
1567
|
+
type: 'http'
|
|
1568
|
+
}
|
|
1569
|
+
],
|
|
1570
|
+
url: '/channels',
|
|
1571
|
+
...options
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Get a communication channel
|
|
1576
|
+
*
|
|
1577
|
+
* 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.
|
|
1578
|
+
*/
|
|
1579
|
+
getChannel(options) {
|
|
1580
|
+
return (options.client ?? this.client).get({
|
|
1581
|
+
security: [
|
|
1582
|
+
{
|
|
1583
|
+
key: 'oauth2',
|
|
1584
|
+
scheme: 'bearer',
|
|
1585
|
+
type: 'http'
|
|
1586
|
+
},
|
|
1587
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1588
|
+
{
|
|
1589
|
+
key: 'bearerAuth',
|
|
1590
|
+
scheme: 'bearer',
|
|
1591
|
+
type: 'http'
|
|
1592
|
+
}
|
|
1593
|
+
],
|
|
1594
|
+
url: '/channels/{id}',
|
|
1595
|
+
...options
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Get today's Next Up list
|
|
1600
|
+
*
|
|
1601
|
+
* 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`.
|
|
1602
|
+
*/
|
|
1603
|
+
listNextUp(options) {
|
|
1604
|
+
return (options?.client ?? this.client).get({
|
|
1605
|
+
security: [
|
|
1606
|
+
{
|
|
1607
|
+
key: 'oauth2',
|
|
1608
|
+
scheme: 'bearer',
|
|
1609
|
+
type: 'http'
|
|
1610
|
+
},
|
|
1611
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1612
|
+
{
|
|
1613
|
+
key: 'bearerAuth',
|
|
1614
|
+
scheme: 'bearer',
|
|
1615
|
+
type: 'http'
|
|
1616
|
+
}
|
|
1617
|
+
],
|
|
1618
|
+
url: '/next-up',
|
|
1619
|
+
...options
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Open the next batch of moments
|
|
1624
|
+
*
|
|
1625
|
+
* 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`.
|
|
1626
|
+
*/
|
|
1627
|
+
openNextUpBatch(options) {
|
|
1628
|
+
return (options.client ?? this.client).post({
|
|
1629
|
+
security: [
|
|
1630
|
+
{
|
|
1631
|
+
key: 'oauth2',
|
|
1632
|
+
scheme: 'bearer',
|
|
1633
|
+
type: 'http'
|
|
1634
|
+
},
|
|
1635
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1636
|
+
{
|
|
1637
|
+
key: 'bearerAuth',
|
|
1638
|
+
scheme: 'bearer',
|
|
1639
|
+
type: 'http'
|
|
1640
|
+
}
|
|
1641
|
+
],
|
|
1642
|
+
url: '/next-up/next-batch',
|
|
1643
|
+
...options,
|
|
1644
|
+
headers: {
|
|
1645
|
+
'Content-Type': 'application/json',
|
|
1646
|
+
...options.headers
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Get a client's open Next Up items
|
|
1652
|
+
*
|
|
1653
|
+
* 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.
|
|
1654
|
+
*/
|
|
1655
|
+
getClientNextUp(options) {
|
|
1656
|
+
return (options.client ?? this.client).get({
|
|
1657
|
+
security: [
|
|
1658
|
+
{
|
|
1659
|
+
key: 'oauth2',
|
|
1660
|
+
scheme: 'bearer',
|
|
1661
|
+
type: 'http'
|
|
1662
|
+
},
|
|
1663
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1664
|
+
{
|
|
1665
|
+
key: 'bearerAuth',
|
|
1666
|
+
scheme: 'bearer',
|
|
1667
|
+
type: 'http'
|
|
1668
|
+
}
|
|
1669
|
+
],
|
|
1670
|
+
url: '/clients/{id}/next-up',
|
|
1671
|
+
...options
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Mark a Next Up item done
|
|
1676
|
+
*
|
|
1677
|
+
* 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.
|
|
1678
|
+
*/
|
|
1679
|
+
markNextUpItemDone(options) {
|
|
1680
|
+
return (options.client ?? this.client).post({
|
|
1681
|
+
security: [
|
|
1682
|
+
{
|
|
1683
|
+
key: 'oauth2',
|
|
1684
|
+
scheme: 'bearer',
|
|
1685
|
+
type: 'http'
|
|
1686
|
+
},
|
|
1687
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1688
|
+
{
|
|
1689
|
+
key: 'bearerAuth',
|
|
1690
|
+
scheme: 'bearer',
|
|
1691
|
+
type: 'http'
|
|
1692
|
+
}
|
|
1693
|
+
],
|
|
1694
|
+
url: '/next-up/{item_id}/done',
|
|
1695
|
+
...options,
|
|
1696
|
+
headers: {
|
|
1697
|
+
'Content-Type': 'application/json',
|
|
1698
|
+
...options.headers
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Skip a Next Up item for today
|
|
1704
|
+
*
|
|
1705
|
+
* 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.
|
|
1706
|
+
*/
|
|
1707
|
+
skipNextUpItem(options) {
|
|
1708
|
+
return (options.client ?? this.client).post({
|
|
1709
|
+
security: [
|
|
1710
|
+
{
|
|
1711
|
+
key: 'oauth2',
|
|
1712
|
+
scheme: 'bearer',
|
|
1713
|
+
type: 'http'
|
|
1714
|
+
},
|
|
1715
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1716
|
+
{
|
|
1717
|
+
key: 'bearerAuth',
|
|
1718
|
+
scheme: 'bearer',
|
|
1719
|
+
type: 'http'
|
|
1720
|
+
}
|
|
1721
|
+
],
|
|
1722
|
+
url: '/next-up/{item_id}/skip',
|
|
1723
|
+
...options
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Snooze a Next Up item's client
|
|
1728
|
+
*
|
|
1729
|
+
* 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.
|
|
1730
|
+
*/
|
|
1731
|
+
snoozeNextUpItem(options) {
|
|
1732
|
+
return (options.client ?? this.client).post({
|
|
1733
|
+
security: [
|
|
1734
|
+
{
|
|
1735
|
+
key: 'oauth2',
|
|
1736
|
+
scheme: 'bearer',
|
|
1737
|
+
type: 'http'
|
|
1738
|
+
},
|
|
1739
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1740
|
+
{
|
|
1741
|
+
key: 'bearerAuth',
|
|
1742
|
+
scheme: 'bearer',
|
|
1743
|
+
type: 'http'
|
|
1744
|
+
}
|
|
1745
|
+
],
|
|
1746
|
+
url: '/next-up/{item_id}/snooze',
|
|
1747
|
+
...options,
|
|
1748
|
+
headers: {
|
|
1749
|
+
'Content-Type': 'application/json',
|
|
1750
|
+
...options.headers
|
|
1751
|
+
}
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Approve a Next Up approval
|
|
1756
|
+
*
|
|
1757
|
+
* 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.
|
|
1758
|
+
*/
|
|
1759
|
+
approveNextUpItem(options) {
|
|
1760
|
+
return (options.client ?? this.client).post({
|
|
1761
|
+
security: [
|
|
1762
|
+
{
|
|
1763
|
+
key: 'oauth2',
|
|
1764
|
+
scheme: 'bearer',
|
|
1765
|
+
type: 'http'
|
|
1766
|
+
},
|
|
1767
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1768
|
+
{
|
|
1769
|
+
key: 'bearerAuth',
|
|
1770
|
+
scheme: 'bearer',
|
|
1771
|
+
type: 'http'
|
|
1772
|
+
}
|
|
1773
|
+
],
|
|
1774
|
+
url: '/next-up/{item_id}/approve',
|
|
1775
|
+
...options,
|
|
1776
|
+
headers: {
|
|
1777
|
+
'Content-Type': 'application/json',
|
|
1778
|
+
...options.headers
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Reject a Next Up approval
|
|
1784
|
+
*
|
|
1785
|
+
* 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.
|
|
1786
|
+
*/
|
|
1787
|
+
rejectNextUpItem(options) {
|
|
1788
|
+
return (options.client ?? this.client).post({
|
|
1789
|
+
security: [
|
|
1790
|
+
{
|
|
1791
|
+
key: 'oauth2',
|
|
1792
|
+
scheme: 'bearer',
|
|
1793
|
+
type: 'http'
|
|
1794
|
+
},
|
|
1795
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1796
|
+
{
|
|
1797
|
+
key: 'bearerAuth',
|
|
1798
|
+
scheme: 'bearer',
|
|
1799
|
+
type: 'http'
|
|
1800
|
+
}
|
|
1801
|
+
],
|
|
1802
|
+
url: '/next-up/{item_id}/reject',
|
|
1803
|
+
...options,
|
|
1804
|
+
headers: {
|
|
1805
|
+
'Content-Type': 'application/json',
|
|
1806
|
+
...options.headers
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Recheck an uncertain booking
|
|
1812
|
+
*
|
|
1813
|
+
* 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.
|
|
1814
|
+
*/
|
|
1815
|
+
recheckNextUpItem(options) {
|
|
1816
|
+
return (options.client ?? this.client).post({
|
|
1817
|
+
security: [
|
|
1818
|
+
{
|
|
1819
|
+
key: 'oauth2',
|
|
1820
|
+
scheme: 'bearer',
|
|
1821
|
+
type: 'http'
|
|
1822
|
+
},
|
|
1823
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1824
|
+
{
|
|
1825
|
+
key: 'bearerAuth',
|
|
1826
|
+
scheme: 'bearer',
|
|
1827
|
+
type: 'http'
|
|
1828
|
+
}
|
|
1829
|
+
],
|
|
1830
|
+
url: '/next-up/{item_id}/recheck',
|
|
1831
|
+
...options
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Settle an uncertain booking
|
|
1836
|
+
*
|
|
1837
|
+
* 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.
|
|
1838
|
+
*/
|
|
1839
|
+
settleNextUpItem(options) {
|
|
1840
|
+
return (options.client ?? this.client).post({
|
|
1841
|
+
security: [
|
|
1842
|
+
{
|
|
1843
|
+
key: 'oauth2',
|
|
1844
|
+
scheme: 'bearer',
|
|
1845
|
+
type: 'http'
|
|
1846
|
+
},
|
|
1847
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1848
|
+
{
|
|
1849
|
+
key: 'bearerAuth',
|
|
1850
|
+
scheme: 'bearer',
|
|
1851
|
+
type: 'http'
|
|
1852
|
+
}
|
|
1853
|
+
],
|
|
1854
|
+
url: '/next-up/{item_id}/settle',
|
|
1855
|
+
...options,
|
|
1856
|
+
headers: {
|
|
1857
|
+
'Content-Type': 'application/json',
|
|
1858
|
+
...options.headers
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* List a client's sessions
|
|
1864
|
+
*
|
|
1865
|
+
* 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.
|
|
1866
|
+
*/
|
|
1867
|
+
listClientSessions(options) {
|
|
1868
|
+
return (options.client ?? this.client).get({
|
|
1869
|
+
security: [
|
|
1870
|
+
{
|
|
1871
|
+
key: 'oauth2',
|
|
1872
|
+
scheme: 'bearer',
|
|
1873
|
+
type: 'http'
|
|
1874
|
+
},
|
|
1875
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1876
|
+
{
|
|
1877
|
+
key: 'bearerAuth',
|
|
1878
|
+
scheme: 'bearer',
|
|
1879
|
+
type: 'http'
|
|
1880
|
+
}
|
|
1881
|
+
],
|
|
1882
|
+
url: '/clients/{id}/sessions',
|
|
1883
|
+
...options
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Get a client's attendance summary
|
|
1888
|
+
*
|
|
1889
|
+
* 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.
|
|
1890
|
+
*/
|
|
1891
|
+
getClientAttendance(options) {
|
|
1892
|
+
return (options.client ?? this.client).get({
|
|
1893
|
+
security: [
|
|
1894
|
+
{
|
|
1895
|
+
key: 'oauth2',
|
|
1896
|
+
scheme: 'bearer',
|
|
1897
|
+
type: 'http'
|
|
1898
|
+
},
|
|
1899
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1900
|
+
{
|
|
1901
|
+
key: 'bearerAuth',
|
|
1902
|
+
scheme: 'bearer',
|
|
1903
|
+
type: 'http'
|
|
1904
|
+
}
|
|
1905
|
+
],
|
|
1906
|
+
url: '/clients/{id}/attendance',
|
|
1907
|
+
...options
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Get a client's session milestones
|
|
1912
|
+
*
|
|
1913
|
+
* 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.
|
|
1914
|
+
*/
|
|
1915
|
+
getClientMilestones(options) {
|
|
1916
|
+
return (options.client ?? this.client).get({
|
|
1917
|
+
security: [
|
|
1918
|
+
{
|
|
1919
|
+
key: 'oauth2',
|
|
1920
|
+
scheme: 'bearer',
|
|
1921
|
+
type: 'http'
|
|
1922
|
+
},
|
|
1923
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1924
|
+
{
|
|
1925
|
+
key: 'bearerAuth',
|
|
1926
|
+
scheme: 'bearer',
|
|
1927
|
+
type: 'http'
|
|
1928
|
+
}
|
|
1929
|
+
],
|
|
1930
|
+
url: '/clients/{id}/milestones',
|
|
1931
|
+
...options
|
|
1932
|
+
});
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* List the location's classes and their bookings
|
|
1936
|
+
*
|
|
1937
|
+
* 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.
|
|
1938
|
+
*/
|
|
1939
|
+
listSessions(options) {
|
|
1940
|
+
return (options?.client ?? this.client).get({
|
|
1941
|
+
security: [
|
|
1942
|
+
{
|
|
1943
|
+
key: 'oauth2',
|
|
1944
|
+
scheme: 'bearer',
|
|
1945
|
+
type: 'http'
|
|
1946
|
+
},
|
|
1947
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1948
|
+
{
|
|
1949
|
+
key: 'bearerAuth',
|
|
1950
|
+
scheme: 'bearer',
|
|
1951
|
+
type: 'http'
|
|
1952
|
+
}
|
|
1953
|
+
],
|
|
1954
|
+
url: '/sessions',
|
|
1955
|
+
...options
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Get the class timetable
|
|
1960
|
+
*
|
|
1961
|
+
* 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`.
|
|
1962
|
+
*/
|
|
1963
|
+
getClassTimetable(options) {
|
|
1964
|
+
return (options?.client ?? this.client).get({
|
|
1965
|
+
security: [
|
|
1966
|
+
{
|
|
1967
|
+
key: 'oauth2',
|
|
1968
|
+
scheme: 'bearer',
|
|
1969
|
+
type: 'http'
|
|
1970
|
+
},
|
|
1971
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1972
|
+
{
|
|
1973
|
+
key: 'bearerAuth',
|
|
1974
|
+
scheme: 'bearer',
|
|
1975
|
+
type: 'http'
|
|
1976
|
+
}
|
|
1977
|
+
],
|
|
1978
|
+
url: '/class-timetable',
|
|
1979
|
+
...options
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* List custom fields
|
|
1984
|
+
*
|
|
1985
|
+
* 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`.
|
|
1986
|
+
*/
|
|
1987
|
+
listCustomFields(options) {
|
|
1988
|
+
return (options?.client ?? this.client).get({
|
|
1989
|
+
security: [
|
|
1990
|
+
{
|
|
1991
|
+
key: 'oauth2',
|
|
1992
|
+
scheme: 'bearer',
|
|
1993
|
+
type: 'http'
|
|
1994
|
+
},
|
|
1995
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
1996
|
+
{
|
|
1997
|
+
key: 'bearerAuth',
|
|
1998
|
+
scheme: 'bearer',
|
|
1999
|
+
type: 'http'
|
|
2000
|
+
}
|
|
2001
|
+
],
|
|
2002
|
+
url: '/custom-fields',
|
|
2003
|
+
...options
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Get a client's custom field values
|
|
2008
|
+
*
|
|
2009
|
+
* 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.
|
|
2010
|
+
*/
|
|
2011
|
+
getClientCustomFields(options) {
|
|
2012
|
+
return (options.client ?? this.client).get({
|
|
2013
|
+
security: [
|
|
2014
|
+
{
|
|
2015
|
+
key: 'oauth2',
|
|
2016
|
+
scheme: 'bearer',
|
|
2017
|
+
type: 'http'
|
|
2018
|
+
},
|
|
2019
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2020
|
+
{
|
|
2021
|
+
key: 'bearerAuth',
|
|
2022
|
+
scheme: 'bearer',
|
|
2023
|
+
type: 'http'
|
|
2024
|
+
}
|
|
2025
|
+
],
|
|
2026
|
+
url: '/clients/{id}/custom-fields',
|
|
2027
|
+
...options
|
|
2028
|
+
});
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Set or clear a client's custom field value
|
|
2032
|
+
*
|
|
2033
|
+
* 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`.
|
|
2034
|
+
*/
|
|
2035
|
+
setClientCustomField(options) {
|
|
2036
|
+
return (options.client ?? this.client).patch({
|
|
2037
|
+
security: [
|
|
2038
|
+
{
|
|
2039
|
+
key: 'oauth2',
|
|
2040
|
+
scheme: 'bearer',
|
|
2041
|
+
type: 'http'
|
|
2042
|
+
},
|
|
2043
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2044
|
+
{
|
|
2045
|
+
key: 'bearerAuth',
|
|
2046
|
+
scheme: 'bearer',
|
|
2047
|
+
type: 'http'
|
|
2048
|
+
}
|
|
2049
|
+
],
|
|
2050
|
+
url: '/clients/{id}/custom-fields/{field_id}',
|
|
2051
|
+
...options,
|
|
2052
|
+
headers: {
|
|
2053
|
+
'Content-Type': 'application/json',
|
|
2054
|
+
...options.headers
|
|
2055
|
+
}
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Rename or recolour a label
|
|
2060
|
+
*
|
|
2061
|
+
* 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`.
|
|
2062
|
+
*/
|
|
2063
|
+
updateClientLabel(options) {
|
|
2064
|
+
return (options.client ?? this.client).patch({
|
|
2065
|
+
security: [
|
|
2066
|
+
{
|
|
2067
|
+
key: 'oauth2',
|
|
2068
|
+
scheme: 'bearer',
|
|
2069
|
+
type: 'http'
|
|
2070
|
+
},
|
|
2071
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2072
|
+
{
|
|
2073
|
+
key: 'bearerAuth',
|
|
2074
|
+
scheme: 'bearer',
|
|
2075
|
+
type: 'http'
|
|
2076
|
+
}
|
|
2077
|
+
],
|
|
2078
|
+
url: '/client-labels/{label_id}',
|
|
2079
|
+
...options,
|
|
2080
|
+
headers: {
|
|
2081
|
+
'Content-Type': 'application/json',
|
|
2082
|
+
...options.headers
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Archive a label
|
|
2088
|
+
*
|
|
2089
|
+
* 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`.
|
|
2090
|
+
*/
|
|
2091
|
+
archiveClientLabel(options) {
|
|
2092
|
+
return (options.client ?? this.client).post({
|
|
2093
|
+
security: [
|
|
2094
|
+
{
|
|
2095
|
+
key: 'oauth2',
|
|
2096
|
+
scheme: 'bearer',
|
|
2097
|
+
type: 'http'
|
|
2098
|
+
},
|
|
2099
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2100
|
+
{
|
|
2101
|
+
key: 'bearerAuth',
|
|
2102
|
+
scheme: 'bearer',
|
|
2103
|
+
type: 'http'
|
|
2104
|
+
}
|
|
2105
|
+
],
|
|
2106
|
+
url: '/client-labels/{label_id}/archive',
|
|
2107
|
+
...options
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Restore an archived label
|
|
2112
|
+
*
|
|
2113
|
+
* 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`.
|
|
2114
|
+
*/
|
|
2115
|
+
restoreClientLabel(options) {
|
|
2116
|
+
return (options.client ?? this.client).post({
|
|
2117
|
+
security: [
|
|
2118
|
+
{
|
|
2119
|
+
key: 'oauth2',
|
|
2120
|
+
scheme: 'bearer',
|
|
2121
|
+
type: 'http'
|
|
2122
|
+
},
|
|
2123
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2124
|
+
{
|
|
2125
|
+
key: 'bearerAuth',
|
|
2126
|
+
scheme: 'bearer',
|
|
2127
|
+
type: 'http'
|
|
2128
|
+
}
|
|
2129
|
+
],
|
|
2130
|
+
url: '/client-labels/{label_id}/restore',
|
|
2131
|
+
...options
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Get a client's timeline
|
|
2136
|
+
*
|
|
2137
|
+
* 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.
|
|
2138
|
+
*
|
|
2139
|
+
* 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.
|
|
2140
|
+
*
|
|
2141
|
+
* Pages don't repeat or skip entries when new ones are added meanwhile.
|
|
2142
|
+
*/
|
|
2143
|
+
getClientTimeline(options) {
|
|
2144
|
+
return (options.client ?? this.client).get({
|
|
2145
|
+
security: [
|
|
2146
|
+
{
|
|
2147
|
+
key: 'oauth2',
|
|
2148
|
+
scheme: 'bearer',
|
|
2149
|
+
type: 'http'
|
|
2150
|
+
},
|
|
2151
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2152
|
+
{
|
|
2153
|
+
key: 'bearerAuth',
|
|
2154
|
+
scheme: 'bearer',
|
|
2155
|
+
type: 'http'
|
|
2156
|
+
}
|
|
2157
|
+
],
|
|
2158
|
+
url: '/clients/{id}/timeline',
|
|
2159
|
+
...options
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* List team members
|
|
2164
|
+
*
|
|
2165
|
+
* 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`.
|
|
2166
|
+
*/
|
|
2167
|
+
listTeamMembers(options) {
|
|
2168
|
+
return (options?.client ?? this.client).get({
|
|
2169
|
+
security: [
|
|
2170
|
+
{
|
|
2171
|
+
key: 'oauth2',
|
|
2172
|
+
scheme: 'bearer',
|
|
2173
|
+
type: 'http'
|
|
2174
|
+
},
|
|
2175
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2176
|
+
{
|
|
2177
|
+
key: 'bearerAuth',
|
|
2178
|
+
scheme: 'bearer',
|
|
2179
|
+
type: 'http'
|
|
2180
|
+
}
|
|
2181
|
+
],
|
|
2182
|
+
url: '/team-members',
|
|
2183
|
+
...options
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Invite a team member
|
|
2188
|
+
*
|
|
2189
|
+
* 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.
|
|
2190
|
+
*/
|
|
2191
|
+
inviteTeamMember(options) {
|
|
2192
|
+
return (options.client ?? this.client).post({
|
|
2193
|
+
security: [
|
|
2194
|
+
{
|
|
2195
|
+
key: 'oauth2',
|
|
2196
|
+
scheme: 'bearer',
|
|
2197
|
+
type: 'http'
|
|
2198
|
+
},
|
|
2199
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2200
|
+
{
|
|
2201
|
+
key: 'bearerAuth',
|
|
2202
|
+
scheme: 'bearer',
|
|
2203
|
+
type: 'http'
|
|
2204
|
+
}
|
|
2205
|
+
],
|
|
2206
|
+
url: '/team-members',
|
|
2207
|
+
...options,
|
|
2208
|
+
headers: {
|
|
2209
|
+
'Content-Type': 'application/json',
|
|
2210
|
+
...options.headers
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
/**
|
|
2215
|
+
* Remove a team member
|
|
2216
|
+
*
|
|
2217
|
+
* 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.
|
|
2218
|
+
*/
|
|
2219
|
+
removeTeamMember(options) {
|
|
2220
|
+
return (options.client ?? this.client).delete({
|
|
2221
|
+
security: [
|
|
2222
|
+
{
|
|
2223
|
+
key: 'oauth2',
|
|
2224
|
+
scheme: 'bearer',
|
|
2225
|
+
type: 'http'
|
|
2226
|
+
},
|
|
2227
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2228
|
+
{
|
|
2229
|
+
key: 'bearerAuth',
|
|
2230
|
+
scheme: 'bearer',
|
|
2231
|
+
type: 'http'
|
|
2232
|
+
}
|
|
2233
|
+
],
|
|
2234
|
+
url: '/team-members/{id}',
|
|
2235
|
+
...options
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Change a team member's role
|
|
2240
|
+
*
|
|
2241
|
+
* 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.
|
|
2242
|
+
*/
|
|
2243
|
+
updateTeamMember(options) {
|
|
2244
|
+
return (options.client ?? this.client).patch({
|
|
2245
|
+
security: [
|
|
2246
|
+
{
|
|
2247
|
+
key: 'oauth2',
|
|
2248
|
+
scheme: 'bearer',
|
|
2249
|
+
type: 'http'
|
|
2250
|
+
},
|
|
2251
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2252
|
+
{
|
|
2253
|
+
key: 'bearerAuth',
|
|
2254
|
+
scheme: 'bearer',
|
|
2255
|
+
type: 'http'
|
|
2256
|
+
}
|
|
2257
|
+
],
|
|
2258
|
+
url: '/team-members/{id}',
|
|
2259
|
+
...options,
|
|
2260
|
+
headers: {
|
|
2261
|
+
'Content-Type': 'application/json',
|
|
2262
|
+
...options.headers
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Resend an invite
|
|
2268
|
+
*
|
|
2269
|
+
* 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.
|
|
2270
|
+
*/
|
|
2271
|
+
resendTeamMemberInvite(options) {
|
|
2272
|
+
return (options.client ?? this.client).post({
|
|
2273
|
+
security: [
|
|
2274
|
+
{
|
|
2275
|
+
key: 'oauth2',
|
|
2276
|
+
scheme: 'bearer',
|
|
2277
|
+
type: 'http'
|
|
2278
|
+
},
|
|
2279
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2280
|
+
{
|
|
2281
|
+
key: 'bearerAuth',
|
|
2282
|
+
scheme: 'bearer',
|
|
2283
|
+
type: 'http'
|
|
2284
|
+
}
|
|
2285
|
+
],
|
|
2286
|
+
url: '/team-members/{id}/resend-invite',
|
|
2287
|
+
...options
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Cancel an invite
|
|
2292
|
+
*
|
|
2293
|
+
* 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.
|
|
2294
|
+
*/
|
|
2295
|
+
cancelTeamMemberInvite(options) {
|
|
2296
|
+
return (options.client ?? this.client).post({
|
|
2297
|
+
security: [
|
|
2298
|
+
{
|
|
2299
|
+
key: 'oauth2',
|
|
2300
|
+
scheme: 'bearer',
|
|
2301
|
+
type: 'http'
|
|
2302
|
+
},
|
|
2303
|
+
{ name: 'x-api-key', type: 'apiKey' },
|
|
2304
|
+
{
|
|
2305
|
+
key: 'bearerAuth',
|
|
2306
|
+
scheme: 'bearer',
|
|
2307
|
+
type: 'http'
|
|
2308
|
+
}
|
|
2309
|
+
],
|
|
2310
|
+
url: '/team-members/{id}/cancel-invite',
|
|
2311
|
+
...options
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
exports.RecovrSdk = RecovrSdk;
|