@unboundcx/sdk 4.8.10 → 4.8.11
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 +6 -3
- 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 +124 -48
- 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/inbox.js +5 -4
- 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/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
|
/**
|
|
@@ -92,7 +93,7 @@ export class ChatService {
|
|
|
92
93
|
if (topic !== undefined) body.topic = topic;
|
|
93
94
|
if (settings !== undefined) body.settings = settings;
|
|
94
95
|
|
|
95
|
-
return this.sdk
|
|
96
|
+
return internalRequest(this.sdk, `/chat/channels/${id}`, 'PATCH', { body });
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/**
|
|
@@ -102,7 +103,7 @@ export class ChatService {
|
|
|
102
103
|
*/
|
|
103
104
|
async archiveChannel(id) {
|
|
104
105
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
105
|
-
return this.sdk
|
|
106
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/archive`, 'POST', {
|
|
106
107
|
body: {},
|
|
107
108
|
});
|
|
108
109
|
}
|
|
@@ -114,7 +115,7 @@ export class ChatService {
|
|
|
114
115
|
*/
|
|
115
116
|
async unarchiveChannel(id) {
|
|
116
117
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
117
|
-
return this.sdk
|
|
118
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/unarchive`, 'POST', {
|
|
118
119
|
body: {},
|
|
119
120
|
});
|
|
120
121
|
}
|
|
@@ -126,7 +127,7 @@ export class ChatService {
|
|
|
126
127
|
*/
|
|
127
128
|
async joinChannel(id) {
|
|
128
129
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
129
|
-
return this.sdk
|
|
130
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/join`, 'POST', { body: {} });
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
/**
|
|
@@ -136,7 +137,7 @@ export class ChatService {
|
|
|
136
137
|
*/
|
|
137
138
|
async leaveChannel(id) {
|
|
138
139
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
139
|
-
return this.sdk
|
|
140
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/leave`, 'POST', { body: {} });
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
/**
|
|
@@ -146,7 +147,7 @@ export class ChatService {
|
|
|
146
147
|
*/
|
|
147
148
|
async listMembers(id) {
|
|
148
149
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
149
|
-
return this.sdk
|
|
150
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members`, 'GET');
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
/**
|
|
@@ -170,7 +171,7 @@ export class ChatService {
|
|
|
170
171
|
const body = { userId };
|
|
171
172
|
if (role !== undefined) body.role = role;
|
|
172
173
|
|
|
173
|
-
return this.sdk
|
|
174
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members`, 'POST', { body });
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
/**
|
|
@@ -187,7 +188,7 @@ export class ChatService {
|
|
|
187
188
|
userId: { type: 'string', required: true },
|
|
188
189
|
},
|
|
189
190
|
);
|
|
190
|
-
return this.sdk
|
|
191
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/members/${userId}`, 'DELETE');
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
/**
|
|
@@ -197,7 +198,7 @@ export class ChatService {
|
|
|
197
198
|
*/
|
|
198
199
|
async getGroupDefaults(id) {
|
|
199
200
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
200
|
-
return this.sdk
|
|
201
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/group-defaults`, 'GET');
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
/**
|
|
@@ -215,7 +216,7 @@ export class ChatService {
|
|
|
215
216
|
groupIds: { type: 'array', required: true },
|
|
216
217
|
},
|
|
217
218
|
);
|
|
218
|
-
return this.sdk
|
|
219
|
+
return internalRequest(this.sdk, `/chat/channels/${id}/group-defaults`, 'PUT', {
|
|
219
220
|
body: { groupIds },
|
|
220
221
|
});
|
|
221
222
|
}
|
|
@@ -231,7 +232,7 @@ export class ChatService {
|
|
|
231
232
|
{ userIds },
|
|
232
233
|
{ userIds: { type: 'array', required: true } },
|
|
233
234
|
);
|
|
234
|
-
return this.sdk
|
|
235
|
+
return internalRequest(this.sdk, '/chat/dms', 'POST', { body: { userIds } });
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
/**
|
|
@@ -239,7 +240,7 @@ export class ChatService {
|
|
|
239
240
|
* @returns {Promise<Object>}
|
|
240
241
|
*/
|
|
241
242
|
async getUnreads() {
|
|
242
|
-
return this.sdk
|
|
243
|
+
return internalRequest(this.sdk, '/chat/unreads', 'GET');
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
/**
|
|
@@ -247,7 +248,7 @@ export class ChatService {
|
|
|
247
248
|
* @returns {Promise<Object>}
|
|
248
249
|
*/
|
|
249
250
|
async getDnd() {
|
|
250
|
-
return this.sdk
|
|
251
|
+
return internalRequest(this.sdk, '/chat/dnd', 'GET');
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
/**
|
|
@@ -261,7 +262,7 @@ export class ChatService {
|
|
|
261
262
|
{ enabled },
|
|
262
263
|
{ enabled: { type: 'boolean', required: true } },
|
|
263
264
|
);
|
|
264
|
-
return this.sdk
|
|
265
|
+
return internalRequest(this.sdk, '/chat/dnd', 'PATCH', { body: { enabled } });
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
/**
|
|
@@ -278,7 +279,7 @@ export class ChatService {
|
|
|
278
279
|
messageId: { type: 'string', required: true },
|
|
279
280
|
},
|
|
280
281
|
);
|
|
281
|
-
return this.sdk
|
|
282
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/read`, 'POST', {
|
|
282
283
|
body: { messageId },
|
|
283
284
|
});
|
|
284
285
|
}
|
|
@@ -297,7 +298,7 @@ export class ChatService {
|
|
|
297
298
|
messageId: { type: 'string', required: true },
|
|
298
299
|
},
|
|
299
300
|
);
|
|
300
|
-
return this.sdk
|
|
301
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/unread`, 'POST', {
|
|
301
302
|
body: { messageId },
|
|
302
303
|
});
|
|
303
304
|
}
|
|
@@ -317,7 +318,7 @@ export class ChatService {
|
|
|
317
318
|
userId: { type: 'string', required: true },
|
|
318
319
|
},
|
|
319
320
|
);
|
|
320
|
-
return this.sdk
|
|
321
|
+
return internalRequest(this.sdk, `/chat/groups/${groupId}/linked-channels`, 'GET', {
|
|
321
322
|
query: { userId },
|
|
322
323
|
});
|
|
323
324
|
}
|
|
@@ -347,7 +348,7 @@ export class ChatService {
|
|
|
347
348
|
if (after !== undefined) query.after = after;
|
|
348
349
|
if (limit !== undefined) query.limit = limit;
|
|
349
350
|
|
|
350
|
-
return this.sdk
|
|
351
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'GET', {
|
|
351
352
|
query,
|
|
352
353
|
});
|
|
353
354
|
}
|
|
@@ -384,7 +385,7 @@ export class ChatService {
|
|
|
384
385
|
}
|
|
385
386
|
if (storageIds !== undefined) body.storageIds = storageIds;
|
|
386
387
|
|
|
387
|
-
return this.sdk
|
|
388
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/messages`, 'POST', {
|
|
388
389
|
body,
|
|
389
390
|
});
|
|
390
391
|
}
|
|
@@ -404,7 +405,7 @@ export class ChatService {
|
|
|
404
405
|
message: { type: 'object', required: true },
|
|
405
406
|
},
|
|
406
407
|
);
|
|
407
|
-
return this.sdk
|
|
408
|
+
return internalRequest(this.sdk, `/chat/messages/${id}`, 'PATCH', {
|
|
408
409
|
body: { message },
|
|
409
410
|
});
|
|
410
411
|
}
|
|
@@ -416,7 +417,7 @@ export class ChatService {
|
|
|
416
417
|
*/
|
|
417
418
|
async deleteMessage(id) {
|
|
418
419
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
419
|
-
return this.sdk
|
|
420
|
+
return internalRequest(this.sdk, `/chat/messages/${id}`, 'DELETE');
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
/**
|
|
@@ -434,7 +435,7 @@ export class ChatService {
|
|
|
434
435
|
emoji: { type: 'string', required: true },
|
|
435
436
|
},
|
|
436
437
|
);
|
|
437
|
-
return this.sdk
|
|
438
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/reactions`, 'POST', {
|
|
438
439
|
body: { emoji },
|
|
439
440
|
});
|
|
440
441
|
}
|
|
@@ -454,7 +455,7 @@ export class ChatService {
|
|
|
454
455
|
emoji: { type: 'string', required: true },
|
|
455
456
|
},
|
|
456
457
|
);
|
|
457
|
-
return this.sdk
|
|
458
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/reactions`, 'DELETE', {
|
|
458
459
|
body: { emoji },
|
|
459
460
|
});
|
|
460
461
|
}
|
|
@@ -473,7 +474,7 @@ export class ChatService {
|
|
|
473
474
|
rootId: { type: 'string', required: true },
|
|
474
475
|
},
|
|
475
476
|
);
|
|
476
|
-
return this.sdk
|
|
477
|
+
return internalRequest(this.sdk,
|
|
477
478
|
`/chat/channels/${channelId}/messages/${rootId}/thread`,
|
|
478
479
|
'GET',
|
|
479
480
|
);
|
|
@@ -525,7 +526,7 @@ export class ChatService {
|
|
|
525
526
|
if (nextId !== undefined) query.nextId = nextId;
|
|
526
527
|
if (limit !== undefined) query.limit = limit;
|
|
527
528
|
|
|
528
|
-
return this.sdk
|
|
529
|
+
return internalRequest(this.sdk, '/chat/search', 'GET', { query });
|
|
529
530
|
}
|
|
530
531
|
|
|
531
532
|
/**
|
|
@@ -553,7 +554,7 @@ export class ChatService {
|
|
|
553
554
|
if (avatar !== undefined) body.avatar = avatar;
|
|
554
555
|
if (callbackUrl !== undefined) body.callbackUrl = callbackUrl;
|
|
555
556
|
|
|
556
|
-
return this.sdk
|
|
557
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/webhooks`, 'POST', {
|
|
557
558
|
body,
|
|
558
559
|
});
|
|
559
560
|
}
|
|
@@ -568,7 +569,7 @@ export class ChatService {
|
|
|
568
569
|
{ channelId },
|
|
569
570
|
{ channelId: { type: 'string', required: true } },
|
|
570
571
|
);
|
|
571
|
-
return this.sdk
|
|
572
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/webhooks`, 'GET');
|
|
572
573
|
}
|
|
573
574
|
|
|
574
575
|
/**
|
|
@@ -585,7 +586,7 @@ export class ChatService {
|
|
|
585
586
|
webhookId: { type: 'string', required: true },
|
|
586
587
|
},
|
|
587
588
|
);
|
|
588
|
-
return this.sdk
|
|
589
|
+
return internalRequest(this.sdk,
|
|
589
590
|
`/chat/channels/${channelId}/webhooks/${webhookId}`,
|
|
590
591
|
'DELETE',
|
|
591
592
|
);
|
|
@@ -612,7 +613,7 @@ export class ChatService {
|
|
|
612
613
|
const body = { actionId };
|
|
613
614
|
if (value !== undefined) body.value = value;
|
|
614
615
|
|
|
615
|
-
return this.sdk
|
|
616
|
+
return internalRequest(this.sdk, `/chat/messages/${messageId}/actions`, 'POST', {
|
|
616
617
|
body,
|
|
617
618
|
});
|
|
618
619
|
}
|
|
@@ -632,7 +633,7 @@ export class ChatService {
|
|
|
632
633
|
reason: { type: 'string', required: true },
|
|
633
634
|
},
|
|
634
635
|
);
|
|
635
|
-
return this.sdk
|
|
636
|
+
return internalRequest(this.sdk, `/chat/messages/${id}/report`, 'POST', {
|
|
636
637
|
body: { reason },
|
|
637
638
|
});
|
|
638
639
|
}
|
|
@@ -657,7 +658,7 @@ export class ChatService {
|
|
|
657
658
|
if (q !== undefined) query.q = q;
|
|
658
659
|
if (kind !== undefined) query.kind = kind;
|
|
659
660
|
|
|
660
|
-
return this.sdk
|
|
661
|
+
return internalRequest(this.sdk, '/chat/admin/channels', 'GET', { query });
|
|
661
662
|
}
|
|
662
663
|
|
|
663
664
|
/**
|
|
@@ -667,7 +668,7 @@ export class ChatService {
|
|
|
667
668
|
*/
|
|
668
669
|
async adminGetChannel(id) {
|
|
669
670
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
670
|
-
return this.sdk
|
|
671
|
+
return internalRequest(this.sdk, `/chat/admin/channels/${id}`, 'GET');
|
|
671
672
|
}
|
|
672
673
|
|
|
673
674
|
/**
|
|
@@ -677,7 +678,7 @@ export class ChatService {
|
|
|
677
678
|
*/
|
|
678
679
|
async adminExportChannel(id) {
|
|
679
680
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
680
|
-
return this.sdk
|
|
681
|
+
return internalRequest(this.sdk, `/chat/admin/channels/${id}/export`, 'GET');
|
|
681
682
|
}
|
|
682
683
|
|
|
683
684
|
/**
|
|
@@ -695,7 +696,7 @@ export class ChatService {
|
|
|
695
696
|
const query = {};
|
|
696
697
|
if (status !== undefined) query.status = status;
|
|
697
698
|
|
|
698
|
-
return this.sdk
|
|
699
|
+
return internalRequest(this.sdk, '/chat/admin/reports', 'GET', { query });
|
|
699
700
|
}
|
|
700
701
|
|
|
701
702
|
/**
|
|
@@ -713,7 +714,7 @@ export class ChatService {
|
|
|
713
714
|
status: { type: 'string', required: true },
|
|
714
715
|
},
|
|
715
716
|
);
|
|
716
|
-
return this.sdk
|
|
717
|
+
return internalRequest(this.sdk, `/chat/admin/reports/${id}`, 'POST', {
|
|
717
718
|
body: { status },
|
|
718
719
|
});
|
|
719
720
|
}
|
|
@@ -725,7 +726,7 @@ export class ChatService {
|
|
|
725
726
|
*/
|
|
726
727
|
async adminDeleteMessage(id) {
|
|
727
728
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
728
|
-
return this.sdk
|
|
729
|
+
return internalRequest(this.sdk, `/chat/admin/messages/${id}`, 'DELETE');
|
|
729
730
|
}
|
|
730
731
|
|
|
731
732
|
/**
|
|
@@ -733,7 +734,7 @@ export class ChatService {
|
|
|
733
734
|
* @returns {Promise<Object>}
|
|
734
735
|
*/
|
|
735
736
|
async adminAudit() {
|
|
736
|
-
return this.sdk
|
|
737
|
+
return internalRequest(this.sdk, '/chat/admin/audit', 'GET');
|
|
737
738
|
}
|
|
738
739
|
|
|
739
740
|
/**
|
|
@@ -751,7 +752,7 @@ export class ChatService {
|
|
|
751
752
|
recordTypeId: { type: 'string', required: true },
|
|
752
753
|
},
|
|
753
754
|
);
|
|
754
|
-
return this.sdk
|
|
755
|
+
return internalRequest(this.sdk, `/chat/records/${relatedId}`, 'GET', {
|
|
755
756
|
query: { recordTypeId },
|
|
756
757
|
});
|
|
757
758
|
}
|
|
@@ -773,7 +774,7 @@ export class ChatService {
|
|
|
773
774
|
recordTypeId: { type: 'string', required: true },
|
|
774
775
|
},
|
|
775
776
|
);
|
|
776
|
-
return this.sdk
|
|
777
|
+
return internalRequest(this.sdk, `/chat/records/${relatedId}/messages`, 'POST', {
|
|
777
778
|
body: { message, recordTypeId },
|
|
778
779
|
});
|
|
779
780
|
}
|
|
@@ -788,7 +789,7 @@ export class ChatService {
|
|
|
788
789
|
{ channelId },
|
|
789
790
|
{ channelId: { type: 'string', required: true } },
|
|
790
791
|
);
|
|
791
|
-
return this.sdk
|
|
792
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/meet`, 'GET');
|
|
792
793
|
}
|
|
793
794
|
|
|
794
795
|
/**
|
|
@@ -796,7 +797,7 @@ export class ChatService {
|
|
|
796
797
|
* @returns {Promise<Object>}
|
|
797
798
|
*/
|
|
798
799
|
async getVapidPublicKey() {
|
|
799
|
-
return this.sdk
|
|
800
|
+
return internalRequest(this.sdk, '/chat/push/vapidPublicKey', 'GET');
|
|
800
801
|
}
|
|
801
802
|
|
|
802
803
|
/**
|
|
@@ -814,7 +815,7 @@ export class ChatService {
|
|
|
814
815
|
subscription: { type: 'object', required: true },
|
|
815
816
|
},
|
|
816
817
|
);
|
|
817
|
-
return this.sdk
|
|
818
|
+
return internalRequest(this.sdk, '/chat/push/devices', 'POST', {
|
|
818
819
|
body: { kind, subscription },
|
|
819
820
|
});
|
|
820
821
|
}
|
|
@@ -826,7 +827,7 @@ export class ChatService {
|
|
|
826
827
|
*/
|
|
827
828
|
async unregisterPushDevice(id) {
|
|
828
829
|
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
829
|
-
return this.sdk
|
|
830
|
+
return internalRequest(this.sdk, `/chat/push/devices/${id}`, 'DELETE');
|
|
830
831
|
}
|
|
831
832
|
|
|
832
833
|
/**
|
|
@@ -844,8 +845,83 @@ export class ChatService {
|
|
|
844
845
|
notifyLevel: { type: 'string', required: true },
|
|
845
846
|
},
|
|
846
847
|
);
|
|
847
|
-
return this.sdk
|
|
848
|
+
return internalRequest(this.sdk, `/chat/channels/${channelId}/notify`, 'PATCH', {
|
|
848
849
|
body: { notifyLevel },
|
|
849
850
|
});
|
|
850
851
|
}
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* List the caller's pinned conversations (channel or record).
|
|
855
|
+
* @returns {Promise<Object>}
|
|
856
|
+
*/
|
|
857
|
+
async listPins() {
|
|
858
|
+
return internalRequest(this.sdk, '/chat/pins', 'GET');
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Pin a channel or record conversation to the sidebar.
|
|
863
|
+
* @param {Object} params
|
|
864
|
+
* @param {'channel'|'record'} params.kind
|
|
865
|
+
* @param {string} [params.channelId]
|
|
866
|
+
* @param {string} [params.relatedId]
|
|
867
|
+
* @param {string} [params.relatedRecordTypeId]
|
|
868
|
+
* @returns {Promise<Object>}
|
|
869
|
+
*/
|
|
870
|
+
async pinItem({ kind, channelId, relatedId, relatedRecordTypeId } = {}) {
|
|
871
|
+
this.sdk.validateParams(
|
|
872
|
+
{ kind, channelId, relatedId, relatedRecordTypeId },
|
|
873
|
+
{
|
|
874
|
+
kind: { type: 'string', required: true },
|
|
875
|
+
channelId: { type: 'string', required: false },
|
|
876
|
+
relatedId: { type: 'string', required: false },
|
|
877
|
+
relatedRecordTypeId: { type: 'string', required: false },
|
|
878
|
+
},
|
|
879
|
+
);
|
|
880
|
+
const body = { kind };
|
|
881
|
+
if (channelId !== undefined) body.channelId = channelId;
|
|
882
|
+
if (relatedId !== undefined) body.relatedId = relatedId;
|
|
883
|
+
if (relatedRecordTypeId !== undefined) body.relatedRecordTypeId =
|
|
884
|
+
relatedRecordTypeId;
|
|
885
|
+
return internalRequest(this.sdk, '/chat/pins', 'POST', { body });
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Remove a sidebar pin by id.
|
|
890
|
+
* @param {string} id
|
|
891
|
+
* @returns {Promise<Object>}
|
|
892
|
+
*/
|
|
893
|
+
async unpinItem(id) {
|
|
894
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
895
|
+
return internalRequest(this.sdk, `/chat/pins/${id}`, 'DELETE');
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
async listAdminChannels(query) {
|
|
899
|
+
return this.adminListChannels(query);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
async getAdminChannel(id) {
|
|
903
|
+
return this.adminGetChannel(id);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
async listAdminReports(query) {
|
|
907
|
+
return this.adminListReports(query);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
async listAdminAudit() {
|
|
911
|
+
return this.adminAudit();
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
async listAdminMessages(channelId, query) {
|
|
915
|
+
return this.listMessages(channelId, query);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
async dismissAdminReport(id) {
|
|
919
|
+
return this.adminReviewReport(id, { status: 'dismissed' });
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
async actionAdminReport(id, body = {}) {
|
|
923
|
+
return this.adminReviewReport(id, {
|
|
924
|
+
status: body.status || 'actioned',
|
|
925
|
+
});
|
|
926
|
+
}
|
|
851
927
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Developer portal My APIs — account-scoped folders, requests, vars, sharing.
|
|
5
|
+
* API prefix: /developerApis
|
|
6
|
+
*/
|
|
7
|
+
export class DeveloperApisService {
|
|
8
|
+
constructor(sdk) {
|
|
9
|
+
this.sdk = sdk;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getLibrary() {
|
|
13
|
+
return internalRequest(this.sdk, '/developerApis', 'GET');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async createFolder(params = {}) {
|
|
17
|
+
const { name, parentId, sort } = params;
|
|
18
|
+
this.sdk.validateParams(
|
|
19
|
+
{ name, parentId, sort },
|
|
20
|
+
{
|
|
21
|
+
name: { type: 'string', required: false },
|
|
22
|
+
parentId: { type: 'string', required: false },
|
|
23
|
+
sort: { type: 'number', required: false },
|
|
24
|
+
},
|
|
25
|
+
);
|
|
26
|
+
return internalRequest(this.sdk, '/developerApis/folders', 'POST', {
|
|
27
|
+
body: { name, parentId, sort },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async updateFolder(id, updates = {}) {
|
|
32
|
+
this.sdk.validateParams(
|
|
33
|
+
{ id, updates },
|
|
34
|
+
{
|
|
35
|
+
id: { type: 'string', required: true },
|
|
36
|
+
updates: { type: 'object', required: true },
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
return internalRequest(this.sdk, `/developerApis/folders/${id}`, 'PUT', {
|
|
40
|
+
body: updates,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async deleteFolder(id) {
|
|
45
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
46
|
+
return internalRequest(this.sdk, `/developerApis/folders/${id}`, 'DELETE');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async listFolderShares(folderId) {
|
|
50
|
+
this.sdk.validateParams(
|
|
51
|
+
{ folderId },
|
|
52
|
+
{ folderId: { type: 'string', required: true } },
|
|
53
|
+
);
|
|
54
|
+
return internalRequest(
|
|
55
|
+
this.sdk,
|
|
56
|
+
`/developerApis/folders/${folderId}/shares`,
|
|
57
|
+
'GET',
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async shareFolder(folderId, params) {
|
|
62
|
+
const { userId, access } = params || {};
|
|
63
|
+
this.sdk.validateParams(
|
|
64
|
+
{ folderId, userId, access },
|
|
65
|
+
{
|
|
66
|
+
folderId: { type: 'string', required: true },
|
|
67
|
+
userId: { type: 'string', required: true },
|
|
68
|
+
access: { type: 'string', required: false },
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
return internalRequest(
|
|
72
|
+
this.sdk,
|
|
73
|
+
`/developerApis/folders/${folderId}/shares`,
|
|
74
|
+
'POST',
|
|
75
|
+
{ body: { userId, access: access === 'full' ? 'full' : 'limited' } },
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async unshareFolder(folderId, userId) {
|
|
80
|
+
this.sdk.validateParams(
|
|
81
|
+
{ folderId, userId },
|
|
82
|
+
{
|
|
83
|
+
folderId: { type: 'string', required: true },
|
|
84
|
+
userId: { type: 'string', required: true },
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
return internalRequest(
|
|
88
|
+
this.sdk,
|
|
89
|
+
`/developerApis/folders/${folderId}/shares/${userId}`,
|
|
90
|
+
'DELETE',
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async createRequest(request = {}) {
|
|
95
|
+
this.sdk.validateParams(
|
|
96
|
+
{ request },
|
|
97
|
+
{ request: { type: 'object', required: false } },
|
|
98
|
+
);
|
|
99
|
+
return internalRequest(this.sdk, '/developerApis/requests', 'POST', {
|
|
100
|
+
body: request,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async getRequest(id) {
|
|
105
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
106
|
+
return internalRequest(this.sdk, `/developerApis/requests/${id}`, 'GET');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async updateRequest(id, updates = {}) {
|
|
110
|
+
this.sdk.validateParams(
|
|
111
|
+
{ id, updates },
|
|
112
|
+
{
|
|
113
|
+
id: { type: 'string', required: true },
|
|
114
|
+
updates: { type: 'object', required: true },
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
return internalRequest(this.sdk, `/developerApis/requests/${id}`, 'PUT', {
|
|
118
|
+
body: updates,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async deleteRequest(id) {
|
|
123
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
124
|
+
return internalRequest(this.sdk, `/developerApis/requests/${id}`, 'DELETE');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async cloneRequest(id) {
|
|
128
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
129
|
+
return internalRequest(
|
|
130
|
+
this.sdk,
|
|
131
|
+
`/developerApis/requests/${id}/clone`,
|
|
132
|
+
'POST',
|
|
133
|
+
{ body: {} },
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async listVars() {
|
|
138
|
+
return internalRequest(this.sdk, '/developerApis/vars', 'GET');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async createVar(params = {}) {
|
|
142
|
+
const { key, type, value, enabled } = params;
|
|
143
|
+
this.sdk.validateParams(
|
|
144
|
+
{ key, type, value, enabled },
|
|
145
|
+
{
|
|
146
|
+
key: { type: 'string', required: false },
|
|
147
|
+
type: { type: 'string', required: false },
|
|
148
|
+
value: { type: 'string', required: false },
|
|
149
|
+
enabled: { type: 'boolean', required: false },
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
return internalRequest(this.sdk, '/developerApis/vars', 'POST', {
|
|
153
|
+
body: { key, type, value, enabled },
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async updateVar(id, updates = {}) {
|
|
158
|
+
this.sdk.validateParams(
|
|
159
|
+
{ id, updates },
|
|
160
|
+
{
|
|
161
|
+
id: { type: 'string', required: true },
|
|
162
|
+
updates: { type: 'object', required: true },
|
|
163
|
+
},
|
|
164
|
+
);
|
|
165
|
+
return internalRequest(this.sdk, `/developerApis/vars/${id}`, 'PUT', {
|
|
166
|
+
body: updates,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async deleteVar(id) {
|
|
171
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
172
|
+
return internalRequest(this.sdk, `/developerApis/vars/${id}`, 'DELETE');
|
|
173
|
+
}
|
|
174
|
+
}
|