@unboundcx/sdk 4.8.10 → 4.8.12
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/base.js +41 -1
- package/index.js +9 -6
- package/package.json +1 -4
- package/services/ai/playbooks.js +22 -21
- package/services/ai/settings.js +4 -2
- package/services/ai/translate.js +3 -1
- package/services/ai/vocabulary.js +4 -3
- package/services/ai.js +21 -20
- package/services/chat.js +267 -52
- package/services/developerApis.js +174 -0
- package/services/directory.js +40 -9
- package/services/documents.js +11 -10
- package/services/engagementMetrics.js +2 -1
- package/services/enroll.js +16 -15
- package/services/externalOAuth.js +12 -11
- package/services/fax.js +4 -3
- package/services/generateId.js +3 -2
- package/services/googleCalendar.js +7 -6
- package/services/knowledgeBase.js +9 -8
- package/services/layouts.js +15 -14
- package/services/login.js +8 -7
- package/services/lookup.js +4 -3
- package/services/messaging/EmailAddressesService.js +5 -4
- package/services/messaging/EmailAnalyticsService.js +5 -4
- package/services/messaging/EmailDomainsService.js +8 -7
- package/services/messaging/EmailMailboxesService.js +13 -12
- package/services/messaging/EmailQueueService.js +2 -1
- package/services/messaging/EmailService.js +12 -11
- package/services/messaging/EmailSuppressionService.js +5 -4
- package/services/messaging/EmailTemplatesService.js +6 -5
- package/services/messaging/SmsService.js +3 -2
- package/services/messaging/SmsTemplatesService.js +6 -5
- package/services/messaging/TenDlcBrandsService.js +11 -10
- package/services/messaging/TenDlcCampaignManagementService.js +14 -13
- package/services/messaging/TenDlcCampaignsService.js +2 -1
- package/services/messaging/TollFreeCampaignsService.js +13 -12
- package/services/notes.js +7 -6
- package/services/objects.js +97 -36
- package/services/permissions.js +34 -33
- package/services/phoneNumbers.js +28 -27
- package/services/portals.js +8 -7
- package/services/{inbox.js → recents.js} +9 -8
- package/services/recordTypes.js +12 -11
- package/services/search.js +2 -1
- package/services/sipEndpoints.js +8 -7
- package/services/storage.js +16 -15
- package/services/subscriptions.js +4 -3
- package/services/taskRouter/CCService.js +9 -8
- package/services/taskRouter/MetricsService.js +3 -2
- package/services/taskRouter/TaskService.js +13 -12
- package/services/taskRouter/WorkerService.js +9 -8
- package/services/triggers.js +9 -8
- package/services/verification.js +5 -4
- package/services/video.js +52 -51
- package/services/voice.js +13 -12
- package/services/workflows.js +22 -21
package/services/chat.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
1
2
|
/**
|
|
2
3
|
* ChatService — channels, DMs, membership, unreads, DND, messages, search,
|
|
3
4
|
* webhooks, card actions, reports, admin review, admin export, record feeds,
|
|
@@ -38,7 +39,7 @@ export class ChatService {
|
|
|
38
39
|
if (settings !== undefined) body.settings = settings;
|
|
39
40
|
if (groupIds !== undefined) body.groupIds = groupIds;
|
|
40
41
|
|
|
41
|
-
return this.sdk
|
|
42
|
+
return internalRequest(this.sdk, '/chat/channels', 'POST', { body });
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -46,7 +47,7 @@ export class ChatService {
|
|
|
46
47
|
* @returns {Promise<Object>}
|
|
47
48
|
*/
|
|
48
49
|
async listChannels() {
|
|
49
|
-
return this.sdk
|
|
50
|
+
return internalRequest(this.sdk, '/chat/channels', 'GET');
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
@@ -54,7 +55,7 @@ export class ChatService {
|
|
|
54
55
|
* @returns {Promise<Object>}
|
|
55
56
|
*/
|
|
56
57
|
async browseChannels() {
|
|
57
|
-
return this.sdk
|
|
58
|
+
return internalRequest(this.sdk, '/chat/channels/browse', 'GET');
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
@@ -64,7 +65,7 @@ export class ChatService {
|
|
|
64
65
|
*/
|
|
65
66
|
async getChannel(id) {
|
|
66
67
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
67
|
-
return this.sdk
|
|
68
|
+
return internalRequest(this.sdk, `/chat/channels/${id}`, 'GET');
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
/**
|
|
@@ -76,14 +77,15 @@ export class ChatService {
|
|
|
76
77
|
* @param {Object} [params.settings]
|
|
77
78
|
* @returns {Promise<Object>}
|
|
78
79
|
*/
|
|
79
|
-
async updateChannel(id, { name, topic, settings } = {}) {
|
|
80
|
+
async updateChannel(id, { name, topic, settings, kind } = {}) {
|
|
80
81
|
this.sdk.validateParams(
|
|
81
|
-
{ id, name, topic, settings },
|
|
82
|
+
{ id, name, topic, settings, kind },
|
|
82
83
|
{
|
|
83
84
|
id: { type: 'string', required: true },
|
|
84
85
|
name: { type: 'string', required: false },
|
|
85
86
|
topic: { type: 'string', required: false },
|
|
86
87
|
settings: { type: 'object', required: false },
|
|
88
|
+
kind: { type: 'string', required: false },
|
|
87
89
|
},
|
|
88
90
|
);
|
|
89
91
|
|
|
@@ -91,8 +93,9 @@ export class ChatService {
|
|
|
91
93
|
if (name !== undefined) body.name = name;
|
|
92
94
|
if (topic !== undefined) body.topic = topic;
|
|
93
95
|
if (settings !== undefined) body.settings = settings;
|
|
96
|
+
if (kind !== undefined) body.kind = kind;
|
|
94
97
|
|
|
95
|
-
return this.sdk
|
|
98
|
+
return internalRequest(this.sdk, `/chat/channels/${id}`, 'PATCH', { body });
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
/**
|
|
@@ -102,7 +105,7 @@ export class ChatService {
|
|
|
102
105
|
*/
|
|
103
106
|
async archiveChannel(id) {
|
|
104
107
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
105
|
-
return this.sdk
|
|
108
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/archive`, 'POST', {
|
|
106
109
|
body: {},
|
|
107
110
|
});
|
|
108
111
|
}
|
|
@@ -114,7 +117,7 @@ export class ChatService {
|
|
|
114
117
|
*/
|
|
115
118
|
async unarchiveChannel(id) {
|
|
116
119
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
117
|
-
return this.sdk
|
|
120
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/unarchive`, 'POST', {
|
|
118
121
|
body: {},
|
|
119
122
|
});
|
|
120
123
|
}
|
|
@@ -126,7 +129,7 @@ export class ChatService {
|
|
|
126
129
|
*/
|
|
127
130
|
async joinChannel(id) {
|
|
128
131
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
129
|
-
return this.sdk
|
|
132
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/join`, 'POST', { body: {} });
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
/**
|
|
@@ -136,7 +139,7 @@ export class ChatService {
|
|
|
136
139
|
*/
|
|
137
140
|
async leaveChannel(id) {
|
|
138
141
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
139
|
-
return this.sdk
|
|
142
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/leave`, 'POST', { body: {} });
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
/**
|
|
@@ -146,7 +149,7 @@ export class ChatService {
|
|
|
146
149
|
*/
|
|
147
150
|
async listMembers(id) {
|
|
148
151
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
149
|
-
return this.sdk
|
|
152
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members`, 'GET');
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
/**
|
|
@@ -170,7 +173,7 @@ export class ChatService {
|
|
|
170
173
|
const body = { userId };
|
|
171
174
|
if (role !== undefined) body.role = role;
|
|
172
175
|
|
|
173
|
-
return this.sdk
|
|
176
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members`, 'POST', { body });
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
/**
|
|
@@ -187,7 +190,7 @@ export class ChatService {
|
|
|
187
190
|
userId: { type: 'string', required: true },
|
|
188
191
|
},
|
|
189
192
|
);
|
|
190
|
-
return this.sdk
|
|
193
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members/${userId}`, 'DELETE');
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
/**
|
|
@@ -197,7 +200,7 @@ export class ChatService {
|
|
|
197
200
|
*/
|
|
198
201
|
async getGroupDefaults(id) {
|
|
199
202
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
200
|
-
return this.sdk
|
|
203
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/group-defaults`, 'GET');
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
/**
|
|
@@ -215,7 +218,7 @@ export class ChatService {
|
|
|
215
218
|
groupIds: { type: 'array', required: true },
|
|
216
219
|
},
|
|
217
220
|
);
|
|
218
|
-
return this.sdk
|
|
221
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/group-defaults`, 'PUT', {
|
|
219
222
|
body: { groupIds },
|
|
220
223
|
});
|
|
221
224
|
}
|
|
@@ -231,7 +234,7 @@ export class ChatService {
|
|
|
231
234
|
{ userIds },
|
|
232
235
|
{ userIds: { type: 'array', required: true } },
|
|
233
236
|
);
|
|
234
|
-
return this.sdk
|
|
237
|
+
return internalRequest(this.sdk, '/chat/dms', 'POST', { body: { userIds } });
|
|
235
238
|
}
|
|
236
239
|
|
|
237
240
|
/**
|
|
@@ -239,7 +242,7 @@ export class ChatService {
|
|
|
239
242
|
* @returns {Promise<Object>}
|
|
240
243
|
*/
|
|
241
244
|
async getUnreads() {
|
|
242
|
-
return this.sdk
|
|
245
|
+
return internalRequest(this.sdk, '/chat/unreads', 'GET');
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
/**
|
|
@@ -247,7 +250,7 @@ export class ChatService {
|
|
|
247
250
|
* @returns {Promise<Object>}
|
|
248
251
|
*/
|
|
249
252
|
async getDnd() {
|
|
250
|
-
return this.sdk
|
|
253
|
+
return internalRequest(this.sdk, '/chat/dnd', 'GET');
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
/**
|
|
@@ -261,7 +264,31 @@ export class ChatService {
|
|
|
261
264
|
{ enabled },
|
|
262
265
|
{ enabled: { type: 'boolean', required: true } },
|
|
263
266
|
);
|
|
264
|
-
return this.sdk
|
|
267
|
+
return internalRequest(this.sdk, '/chat/dnd', 'PATCH', { body: { enabled } });
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Favorite reaction emojis for the current user.
|
|
272
|
+
* @returns {Promise<Object>}
|
|
273
|
+
*/
|
|
274
|
+
async getEmojiFavorites() {
|
|
275
|
+
return internalRequest(this.sdk, '/chat/emoji-favorites', 'GET');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Replace the caller's favorite reaction emojis.
|
|
280
|
+
* @param {Object} params
|
|
281
|
+
* @param {string[]} params.emojis
|
|
282
|
+
* @returns {Promise<Object>}
|
|
283
|
+
*/
|
|
284
|
+
async setEmojiFavorites({ emojis } = {}) {
|
|
285
|
+
this.sdk.validateParams(
|
|
286
|
+
{ emojis },
|
|
287
|
+
{ emojis: { type: 'array', required: true } },
|
|
288
|
+
);
|
|
289
|
+
return internalRequest(this.sdk, '/chat/emoji-favorites', 'PATCH', {
|
|
290
|
+
body: { emojis },
|
|
291
|
+
});
|
|
265
292
|
}
|
|
266
293
|
|
|
267
294
|
/**
|
|
@@ -278,7 +305,7 @@ export class ChatService {
|
|
|
278
305
|
messageId: { type: 'string', required: true },
|
|
279
306
|
},
|
|
280
307
|
);
|
|
281
|
-
return this.sdk
|
|
308
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/read`, 'POST', {
|
|
282
309
|
body: { messageId },
|
|
283
310
|
});
|
|
284
311
|
}
|
|
@@ -297,7 +324,7 @@ export class ChatService {
|
|
|
297
324
|
messageId: { type: 'string', required: true },
|
|
298
325
|
},
|
|
299
326
|
);
|
|
300
|
-
return this.sdk
|
|
327
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/unread`, 'POST', {
|
|
301
328
|
body: { messageId },
|
|
302
329
|
});
|
|
303
330
|
}
|
|
@@ -317,7 +344,7 @@ export class ChatService {
|
|
|
317
344
|
userId: { type: 'string', required: true },
|
|
318
345
|
},
|
|
319
346
|
);
|
|
320
|
-
return this.sdk
|
|
347
|
+
return internalRequest(this.sdk, `/chat/groups/${groupId}/linked-channels`, 'GET', {
|
|
321
348
|
query: { userId },
|
|
322
349
|
});
|
|
323
350
|
}
|
|
@@ -347,7 +374,7 @@ export class ChatService {
|
|
|
347
374
|
if (after !== undefined) query.after = after;
|
|
348
375
|
if (limit !== undefined) query.limit = limit;
|
|
349
376
|
|
|
350
|
-
return this.sdk
|
|
377
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'GET', {
|
|
351
378
|
query,
|
|
352
379
|
});
|
|
353
380
|
}
|
|
@@ -364,16 +391,33 @@ export class ChatService {
|
|
|
364
391
|
*/
|
|
365
392
|
async sendMessage(
|
|
366
393
|
channelId,
|
|
367
|
-
{
|
|
394
|
+
{
|
|
395
|
+
message,
|
|
396
|
+
threadRootId,
|
|
397
|
+
alsoSendToChannel,
|
|
398
|
+
storageIds,
|
|
399
|
+
suppressUnfurlUrls,
|
|
400
|
+
unfurls,
|
|
401
|
+
} = {},
|
|
368
402
|
) {
|
|
369
403
|
this.sdk.validateParams(
|
|
370
|
-
{
|
|
404
|
+
{
|
|
405
|
+
channelId,
|
|
406
|
+
message,
|
|
407
|
+
threadRootId,
|
|
408
|
+
alsoSendToChannel,
|
|
409
|
+
storageIds,
|
|
410
|
+
suppressUnfurlUrls,
|
|
411
|
+
unfurls,
|
|
412
|
+
},
|
|
371
413
|
{
|
|
372
414
|
channelId: { type: 'string', required: true },
|
|
373
415
|
message: { type: 'object', required: true },
|
|
374
416
|
threadRootId: { type: 'string', required: false },
|
|
375
417
|
alsoSendToChannel: { type: 'boolean', required: false },
|
|
376
418
|
storageIds: { type: 'array', required: false },
|
|
419
|
+
suppressUnfurlUrls: { type: 'array', required: false },
|
|
420
|
+
unfurls: { type: 'array', required: false },
|
|
377
421
|
},
|
|
378
422
|
);
|
|
379
423
|
|
|
@@ -383,8 +427,12 @@ export class ChatService {
|
|
|
383
427
|
body.alsoSendToChannel = alsoSendToChannel;
|
|
384
428
|
}
|
|
385
429
|
if (storageIds !== undefined) body.storageIds = storageIds;
|
|
430
|
+
if (suppressUnfurlUrls !== undefined) {
|
|
431
|
+
body.suppressUnfurlUrls = suppressUnfurlUrls;
|
|
432
|
+
}
|
|
433
|
+
if (unfurls !== undefined) body.unfurls = unfurls;
|
|
386
434
|
|
|
387
|
-
return this.sdk
|
|
435
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'POST', {
|
|
388
436
|
body,
|
|
389
437
|
});
|
|
390
438
|
}
|
|
@@ -404,11 +452,49 @@ export class ChatService {
|
|
|
404
452
|
message: { type: 'object', required: true },
|
|
405
453
|
},
|
|
406
454
|
);
|
|
407
|
-
return this.sdk
|
|
455
|
+
return internalRequest(this.sdk, `/chat/messages/${id}`, 'PATCH', {
|
|
408
456
|
body: { message },
|
|
409
457
|
});
|
|
410
458
|
}
|
|
411
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Fetch Open Graph data for a URL (composer preview).
|
|
462
|
+
* @param {Object} params
|
|
463
|
+
* @param {string} params.url
|
|
464
|
+
* @returns {Promise<Object>}
|
|
465
|
+
*/
|
|
466
|
+
async previewLink({ url } = {}) {
|
|
467
|
+
this.sdk.validateParams({ url }, { url: { type: 'string', required: true } });
|
|
468
|
+
return internalRequest(
|
|
469
|
+
this.sdk,
|
|
470
|
+
`/chat/link-preview?url=${encodeURIComponent(url)}`,
|
|
471
|
+
'GET',
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Hide a link preview on a message.
|
|
477
|
+
* @param {string} id
|
|
478
|
+
* @param {Object} params
|
|
479
|
+
* @param {string} params.url
|
|
480
|
+
* @returns {Promise<Object>}
|
|
481
|
+
*/
|
|
482
|
+
async hideUnfurl(id, { url } = {}) {
|
|
483
|
+
this.sdk.validateParams(
|
|
484
|
+
{ id, url },
|
|
485
|
+
{
|
|
486
|
+
id: { type: 'string', required: true },
|
|
487
|
+
url: { type: 'string', required: true },
|
|
488
|
+
},
|
|
489
|
+
);
|
|
490
|
+
return internalRequest(
|
|
491
|
+
this.sdk,
|
|
492
|
+
`/chat/messages/${id}/unfurls/hide`,
|
|
493
|
+
'POST',
|
|
494
|
+
{ body: { url } },
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
|
|
412
498
|
/**
|
|
413
499
|
* Delete a message (tombstone).
|
|
414
500
|
* @param {string} id
|
|
@@ -416,7 +502,7 @@ export class ChatService {
|
|
|
416
502
|
*/
|
|
417
503
|
async deleteMessage(id) {
|
|
418
504
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
419
|
-
return this.sdk
|
|
505
|
+
return internalRequest(this.sdk, `/chat/messages/${id}`, 'DELETE');
|
|
420
506
|
}
|
|
421
507
|
|
|
422
508
|
/**
|
|
@@ -434,7 +520,7 @@ export class ChatService {
|
|
|
434
520
|
emoji: { type: 'string', required: true },
|
|
435
521
|
},
|
|
436
522
|
);
|
|
437
|
-
return this.sdk
|
|
523
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/reactions`, 'POST', {
|
|
438
524
|
body: { emoji },
|
|
439
525
|
});
|
|
440
526
|
}
|
|
@@ -454,7 +540,7 @@ export class ChatService {
|
|
|
454
540
|
emoji: { type: 'string', required: true },
|
|
455
541
|
},
|
|
456
542
|
);
|
|
457
|
-
return this.sdk
|
|
543
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/reactions`, 'DELETE', {
|
|
458
544
|
body: { emoji },
|
|
459
545
|
});
|
|
460
546
|
}
|
|
@@ -473,7 +559,7 @@ export class ChatService {
|
|
|
473
559
|
rootId: { type: 'string', required: true },
|
|
474
560
|
},
|
|
475
561
|
);
|
|
476
|
-
return this.sdk
|
|
562
|
+
return internalRequest(this.sdk,
|
|
477
563
|
`/chat/channels/${channelId}/messages/${rootId}/thread`,
|
|
478
564
|
'GET',
|
|
479
565
|
);
|
|
@@ -525,7 +611,7 @@ export class ChatService {
|
|
|
525
611
|
if (nextId !== undefined) query.nextId = nextId;
|
|
526
612
|
if (limit !== undefined) query.limit = limit;
|
|
527
613
|
|
|
528
|
-
return this.sdk
|
|
614
|
+
return internalRequest(this.sdk, '/chat/search', 'GET', { query });
|
|
529
615
|
}
|
|
530
616
|
|
|
531
617
|
/**
|
|
@@ -553,7 +639,7 @@ export class ChatService {
|
|
|
553
639
|
if (avatar !== undefined) body.avatar = avatar;
|
|
554
640
|
if (callbackUrl !== undefined) body.callbackUrl = callbackUrl;
|
|
555
641
|
|
|
556
|
-
return this.sdk
|
|
642
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/webhooks`, 'POST', {
|
|
557
643
|
body,
|
|
558
644
|
});
|
|
559
645
|
}
|
|
@@ -568,7 +654,7 @@ export class ChatService {
|
|
|
568
654
|
{ channelId },
|
|
569
655
|
{ channelId: { type: 'string', required: true } },
|
|
570
656
|
);
|
|
571
|
-
return this.sdk
|
|
657
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/webhooks`, 'GET');
|
|
572
658
|
}
|
|
573
659
|
|
|
574
660
|
/**
|
|
@@ -585,7 +671,7 @@ export class ChatService {
|
|
|
585
671
|
webhookId: { type: 'string', required: true },
|
|
586
672
|
},
|
|
587
673
|
);
|
|
588
|
-
return this.sdk
|
|
674
|
+
return internalRequest(this.sdk,
|
|
589
675
|
`/chat/channels/${channelId}/webhooks/${webhookId}`,
|
|
590
676
|
'DELETE',
|
|
591
677
|
);
|
|
@@ -612,7 +698,7 @@ export class ChatService {
|
|
|
612
698
|
const body = { actionId };
|
|
613
699
|
if (value !== undefined) body.value = value;
|
|
614
700
|
|
|
615
|
-
return this.sdk
|
|
701
|
+
return internalRequest(this.sdk, `/chat/messages/${messageId}/actions`, 'POST', {
|
|
616
702
|
body,
|
|
617
703
|
});
|
|
618
704
|
}
|
|
@@ -632,7 +718,7 @@ export class ChatService {
|
|
|
632
718
|
reason: { type: 'string', required: true },
|
|
633
719
|
},
|
|
634
720
|
);
|
|
635
|
-
return this.sdk
|
|
721
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/report`, 'POST', {
|
|
636
722
|
body: { reason },
|
|
637
723
|
});
|
|
638
724
|
}
|
|
@@ -657,7 +743,7 @@ export class ChatService {
|
|
|
657
743
|
if (q !== undefined) query.q = q;
|
|
658
744
|
if (kind !== undefined) query.kind = kind;
|
|
659
745
|
|
|
660
|
-
return this.sdk
|
|
746
|
+
return internalRequest(this.sdk, '/chat/admin/channels', 'GET', { query });
|
|
661
747
|
}
|
|
662
748
|
|
|
663
749
|
/**
|
|
@@ -667,7 +753,7 @@ export class ChatService {
|
|
|
667
753
|
*/
|
|
668
754
|
async adminGetChannel(id) {
|
|
669
755
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
670
|
-
return this.sdk
|
|
756
|
+
return internalRequest(this.sdk, `/chat/admin/channels/${id}`, 'GET');
|
|
671
757
|
}
|
|
672
758
|
|
|
673
759
|
/**
|
|
@@ -677,7 +763,7 @@ export class ChatService {
|
|
|
677
763
|
*/
|
|
678
764
|
async adminExportChannel(id) {
|
|
679
765
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
680
|
-
return this.sdk
|
|
766
|
+
return internalRequest(this.sdk, `/chat/admin/channels/${id}/export`, 'GET');
|
|
681
767
|
}
|
|
682
768
|
|
|
683
769
|
/**
|
|
@@ -695,7 +781,7 @@ export class ChatService {
|
|
|
695
781
|
const query = {};
|
|
696
782
|
if (status !== undefined) query.status = status;
|
|
697
783
|
|
|
698
|
-
return this.sdk
|
|
784
|
+
return internalRequest(this.sdk, '/chat/admin/reports', 'GET', { query });
|
|
699
785
|
}
|
|
700
786
|
|
|
701
787
|
/**
|
|
@@ -713,7 +799,7 @@ export class ChatService {
|
|
|
713
799
|
status: { type: 'string', required: true },
|
|
714
800
|
},
|
|
715
801
|
);
|
|
716
|
-
return this.sdk
|
|
802
|
+
return internalRequest(this.sdk, `/chat/admin/reports/${id}`, 'POST', {
|
|
717
803
|
body: { status },
|
|
718
804
|
});
|
|
719
805
|
}
|
|
@@ -725,7 +811,7 @@ export class ChatService {
|
|
|
725
811
|
*/
|
|
726
812
|
async adminDeleteMessage(id) {
|
|
727
813
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
728
|
-
return this.sdk
|
|
814
|
+
return internalRequest(this.sdk, `/chat/admin/messages/${id}`, 'DELETE');
|
|
729
815
|
}
|
|
730
816
|
|
|
731
817
|
/**
|
|
@@ -733,7 +819,7 @@ export class ChatService {
|
|
|
733
819
|
* @returns {Promise<Object>}
|
|
734
820
|
*/
|
|
735
821
|
async adminAudit() {
|
|
736
|
-
return this.sdk
|
|
822
|
+
return internalRequest(this.sdk, '/chat/admin/audit', 'GET');
|
|
737
823
|
}
|
|
738
824
|
|
|
739
825
|
/**
|
|
@@ -751,7 +837,7 @@ export class ChatService {
|
|
|
751
837
|
recordTypeId: { type: 'string', required: true },
|
|
752
838
|
},
|
|
753
839
|
);
|
|
754
|
-
return this.sdk
|
|
840
|
+
return internalRequest(this.sdk, `/chat/records/${relatedId}`, 'GET', {
|
|
755
841
|
query: { recordTypeId },
|
|
756
842
|
});
|
|
757
843
|
}
|
|
@@ -773,7 +859,7 @@ export class ChatService {
|
|
|
773
859
|
recordTypeId: { type: 'string', required: true },
|
|
774
860
|
},
|
|
775
861
|
);
|
|
776
|
-
return this.sdk
|
|
862
|
+
return internalRequest(this.sdk, `/chat/records/${relatedId}/messages`, 'POST', {
|
|
777
863
|
body: { message, recordTypeId },
|
|
778
864
|
});
|
|
779
865
|
}
|
|
@@ -788,7 +874,7 @@ export class ChatService {
|
|
|
788
874
|
{ channelId },
|
|
789
875
|
{ channelId: { type: 'string', required: true } },
|
|
790
876
|
);
|
|
791
|
-
return this.sdk
|
|
877
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/meet`, 'GET');
|
|
792
878
|
}
|
|
793
879
|
|
|
794
880
|
/**
|
|
@@ -796,7 +882,7 @@ export class ChatService {
|
|
|
796
882
|
* @returns {Promise<Object>}
|
|
797
883
|
*/
|
|
798
884
|
async getVapidPublicKey() {
|
|
799
|
-
return this.sdk
|
|
885
|
+
return internalRequest(this.sdk, '/chat/push/vapidPublicKey', 'GET');
|
|
800
886
|
}
|
|
801
887
|
|
|
802
888
|
/**
|
|
@@ -814,7 +900,7 @@ export class ChatService {
|
|
|
814
900
|
subscription: { type: 'object', required: true },
|
|
815
901
|
},
|
|
816
902
|
);
|
|
817
|
-
return this.sdk
|
|
903
|
+
return internalRequest(this.sdk, '/chat/push/devices', 'POST', {
|
|
818
904
|
body: { kind, subscription },
|
|
819
905
|
});
|
|
820
906
|
}
|
|
@@ -826,7 +912,7 @@ export class ChatService {
|
|
|
826
912
|
*/
|
|
827
913
|
async unregisterPushDevice(id) {
|
|
828
914
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
829
|
-
return this.sdk
|
|
915
|
+
return internalRequest(this.sdk, `/chat/push/devices/${id}`, 'DELETE');
|
|
830
916
|
}
|
|
831
917
|
|
|
832
918
|
/**
|
|
@@ -844,8 +930,137 @@ export class ChatService {
|
|
|
844
930
|
notifyLevel: { type: 'string', required: true },
|
|
845
931
|
},
|
|
846
932
|
);
|
|
847
|
-
return this.sdk
|
|
933
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/notify`, 'PATCH', {
|
|
848
934
|
body: { notifyLevel },
|
|
849
935
|
});
|
|
850
936
|
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* List the caller's pinned conversations (channel or record).
|
|
940
|
+
* @returns {Promise<Object>}
|
|
941
|
+
*/
|
|
942
|
+
async listPins() {
|
|
943
|
+
return internalRequest(this.sdk, '/chat/pins', 'GET');
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Pin a channel or record conversation to the sidebar.
|
|
948
|
+
* @param {Object} params
|
|
949
|
+
* @param {'channel'|'record'} params.kind
|
|
950
|
+
* @param {string} [params.channelId]
|
|
951
|
+
* @param {string} [params.relatedId]
|
|
952
|
+
* @param {string} [params.relatedRecordTypeId]
|
|
953
|
+
* @returns {Promise<Object>}
|
|
954
|
+
*/
|
|
955
|
+
async pinItem({ kind, channelId, relatedId, relatedRecordTypeId } = {}) {
|
|
956
|
+
this.sdk.validateParams(
|
|
957
|
+
{ kind, channelId, relatedId, relatedRecordTypeId },
|
|
958
|
+
{
|
|
959
|
+
kind: { type: 'string', required: true },
|
|
960
|
+
channelId: { type: 'string', required: false },
|
|
961
|
+
relatedId: { type: 'string', required: false },
|
|
962
|
+
relatedRecordTypeId: { type: 'string', required: false },
|
|
963
|
+
},
|
|
964
|
+
);
|
|
965
|
+
const body = { kind };
|
|
966
|
+
if (channelId !== undefined) body.channelId = channelId;
|
|
967
|
+
if (relatedId !== undefined) body.relatedId = relatedId;
|
|
968
|
+
if (relatedRecordTypeId !== undefined) body.relatedRecordTypeId =
|
|
969
|
+
relatedRecordTypeId;
|
|
970
|
+
return internalRequest(this.sdk, '/chat/pins', 'POST', { body });
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Remove a sidebar pin by id.
|
|
975
|
+
* @param {string} id
|
|
976
|
+
* @returns {Promise<Object>}
|
|
977
|
+
*/
|
|
978
|
+
async unpinItem(id) {
|
|
979
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
980
|
+
return internalRequest(this.sdk, `/chat/pins/${id}`, 'DELETE');
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Pin a message to the top of a channel/feed.
|
|
985
|
+
* @param {string} channelId
|
|
986
|
+
* @param {Object} params
|
|
987
|
+
* @param {string} params.messageId
|
|
988
|
+
* @returns {Promise<Object>}
|
|
989
|
+
*/
|
|
990
|
+
async pinMessage(channelId, { messageId } = {}) {
|
|
991
|
+
this.sdk.validateParams(
|
|
992
|
+
{ channelId, messageId },
|
|
993
|
+
{
|
|
994
|
+
channelId: { type: 'string', required: true },
|
|
995
|
+
messageId: { type: 'string', required: true },
|
|
996
|
+
},
|
|
997
|
+
);
|
|
998
|
+
return internalRequest(
|
|
999
|
+
this.sdk,
|
|
1000
|
+
`/chat/channels/${channelId}/pinned-message`,
|
|
1001
|
+
'PUT',
|
|
1002
|
+
{ body: { messageId } },
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Clear the pinned message on a channel/feed.
|
|
1008
|
+
* @param {string} channelId
|
|
1009
|
+
* @returns {Promise<Object>}
|
|
1010
|
+
*/
|
|
1011
|
+
async unpinMessage(channelId) {
|
|
1012
|
+
this.sdk.validateParams(
|
|
1013
|
+
{ channelId },
|
|
1014
|
+
{ channelId: { type: 'string', required: true } },
|
|
1015
|
+
);
|
|
1016
|
+
return internalRequest(
|
|
1017
|
+
this.sdk,
|
|
1018
|
+
`/chat/channels/${channelId}/pinned-message`,
|
|
1019
|
+
'DELETE',
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* List messages that mention the caller.
|
|
1025
|
+
* @param {Object} [params]
|
|
1026
|
+
* @param {'public'|'private'|'dm'|'group_dm'|'record'} [params.kind]
|
|
1027
|
+
* @param {number} [params.limit]
|
|
1028
|
+
* @returns {Promise<Object>}
|
|
1029
|
+
*/
|
|
1030
|
+
async listMentions({ kind, limit } = {}) {
|
|
1031
|
+
const query = {};
|
|
1032
|
+
if (kind) query.kind = kind;
|
|
1033
|
+
if (limit != null) query.limit = limit;
|
|
1034
|
+
return internalRequest(this.sdk, '/chat/mentions', 'GET', { query });
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
async listAdminChannels(query) {
|
|
1038
|
+
return this.adminListChannels(query);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
async getAdminChannel(id) {
|
|
1042
|
+
return this.adminGetChannel(id);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
async listAdminReports(query) {
|
|
1046
|
+
return this.adminListReports(query);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
async listAdminAudit() {
|
|
1050
|
+
return this.adminAudit();
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
async listAdminMessages(channelId, query) {
|
|
1054
|
+
return this.listMessages(channelId, query);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
async dismissAdminReport(id) {
|
|
1058
|
+
return this.adminReviewReport(id, { status: 'dismissed' });
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
async actionAdminReport(id, body = {}) {
|
|
1062
|
+
return this.adminReviewReport(id, {
|
|
1063
|
+
status: body.status || 'actioned',
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
851
1066
|
}
|