@unboundcx/sdk 4.13.145 → 4.13.146-security.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/README.md +7 -0
- package/base.js +74 -3
- package/index.js +7 -31
- package/lib/refreshInterceptor.js +127 -0
- package/package.json +2 -5
- package/services/layouts.js +4 -13
- package/services/licenses.js +330 -0
- package/services/login.js +21 -0
- package/services/messageTemplates.js +2 -109
- package/services/messaging/EmailTemplatesService.js +2 -10
- package/services/messaging/SmsService.js +3 -0
- package/services/messaging/SmsTemplatesService.js +125 -0
- package/services/messaging.js +2 -0
- package/services/oauth.js +159 -0
- package/services/objects.js +39 -12
- package/services/permissions.js +0 -21
- package/services/phoneNumbers.js +1037 -2
- package/services/recents.js +0 -16
- package/services/taskRouter/MetricsService.js +0 -3
- package/services/taskRouter/TaskRouterService.js +0 -2
- package/services/taskRouter/TaskService.js +10 -70
- package/services/voice.js +25 -47
- package/lib/journeyLayout.js +0 -132
- package/services/journeys/JourneyDraftService.js +0 -92
- package/services/journeys/JourneyGoalsService.js +0 -57
- package/services/journeys/JourneyMembersService.js +0 -246
- package/services/journeys/JourneyTypesService.js +0 -59
- package/services/journeys/JourneyWorklistService.js +0 -74
- package/services/journeys/JourneysService.js +0 -392
- package/services/operatorPanels.js +0 -226
- package/services/parking.js +0 -121
- package/services/phoneNumbers/carrier.js +0 -60
- package/services/phoneNumbers/cnam.js +0 -42
- package/services/phoneNumbers/index.js +0 -27
- package/services/phoneNumbers/order.js +0 -88
- package/services/phoneNumbers/porting-activity.js +0 -289
- package/services/phoneNumbers/porting-orders.js +0 -318
- package/services/phoneNumbers/search.js +0 -181
- package/services/phoneNumbers/update.js +0 -94
- package/services/schedules/SchedulesService.js +0 -232
- package/services/schedules/TimeOffService.js +0 -131
- package/services/skills.js +0 -207
- package/services/taskRouter/QueueService.js +0 -343
- package/services/voicemailDrops.js +0 -268
- package/services/workflowTemplates/WorkflowTemplatesService.js +0 -68
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { internalRequest } from '../../base.js';
|
|
2
|
+
export class SmsTemplatesService {
|
|
3
|
+
constructor(sdk) {
|
|
4
|
+
this.sdk = sdk;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Create SMS template
|
|
9
|
+
* @param {Object} params - Template parameters
|
|
10
|
+
* @param {string} params.name - Template name (required)
|
|
11
|
+
* @param {string} params.message - Template message (required)
|
|
12
|
+
* @param {Object} [params.variables] - Template variables
|
|
13
|
+
* @returns {Promise<Object>} Created template details
|
|
14
|
+
*/
|
|
15
|
+
async create({ name, message, variables }) {
|
|
16
|
+
this.sdk.validateParams(
|
|
17
|
+
{ name, message },
|
|
18
|
+
{
|
|
19
|
+
name: { type: 'string', required: true },
|
|
20
|
+
message: { type: 'string', required: true },
|
|
21
|
+
variables: { type: 'object', required: false },
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const templateData = { name, message };
|
|
26
|
+
if (variables) templateData.variables = variables;
|
|
27
|
+
|
|
28
|
+
const options = {
|
|
29
|
+
body: templateData,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const result = await internalRequest(this.sdk,
|
|
33
|
+
'/messaging/sms/templates',
|
|
34
|
+
'POST',
|
|
35
|
+
options,
|
|
36
|
+
);
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Update SMS template
|
|
42
|
+
* @param {string} id - Template ID
|
|
43
|
+
* @param {Object} params - Update parameters
|
|
44
|
+
* @param {string} [params.name] - Template name
|
|
45
|
+
* @param {string} [params.message] - Template message
|
|
46
|
+
* @param {Object} [params.variables] - Template variables
|
|
47
|
+
* @returns {Promise<Object>} Updated template details
|
|
48
|
+
*/
|
|
49
|
+
async update(id, { name, message, variables }) {
|
|
50
|
+
this.sdk.validateParams(
|
|
51
|
+
{ id },
|
|
52
|
+
{
|
|
53
|
+
id: { type: 'string', required: true },
|
|
54
|
+
name: { type: 'string', required: false },
|
|
55
|
+
message: { type: 'string', required: false },
|
|
56
|
+
variables: { type: 'object', required: false },
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const updateData = {};
|
|
61
|
+
if (name) updateData.name = name;
|
|
62
|
+
if (message) updateData.message = message;
|
|
63
|
+
if (variables) updateData.variables = variables;
|
|
64
|
+
|
|
65
|
+
const options = {
|
|
66
|
+
body: updateData,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const result = await internalRequest(this.sdk,
|
|
70
|
+
`/messaging/sms/templates/${id}`,
|
|
71
|
+
'PUT',
|
|
72
|
+
options,
|
|
73
|
+
);
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Delete SMS template
|
|
79
|
+
* @param {string} id - Template ID
|
|
80
|
+
* @returns {Promise<Object>} Deletion result
|
|
81
|
+
*/
|
|
82
|
+
async delete(id) {
|
|
83
|
+
this.sdk.validateParams(
|
|
84
|
+
{ id },
|
|
85
|
+
{
|
|
86
|
+
id: { type: 'string', required: true },
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const result = await internalRequest(this.sdk,
|
|
91
|
+
`/messaging/sms/templates/${id}`,
|
|
92
|
+
'DELETE',
|
|
93
|
+
);
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get SMS template by ID
|
|
99
|
+
* @param {string} id - Template ID
|
|
100
|
+
* @returns {Promise<Object>} Template details
|
|
101
|
+
*/
|
|
102
|
+
async get(id) {
|
|
103
|
+
this.sdk.validateParams(
|
|
104
|
+
{ id },
|
|
105
|
+
{
|
|
106
|
+
id: { type: 'string', required: true },
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const result = await internalRequest(this.sdk,
|
|
111
|
+
`/messaging/sms/templates/${id}`,
|
|
112
|
+
'GET',
|
|
113
|
+
);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* List all SMS templates
|
|
119
|
+
* @returns {Promise<Array>} List of templates
|
|
120
|
+
*/
|
|
121
|
+
async list() {
|
|
122
|
+
const result = await internalRequest(this.sdk, '/messaging/sms/templates', 'GET');
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
}
|
package/services/messaging.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Import all extracted services
|
|
2
2
|
import { MessagingService } from './messaging/MessagingService.js';
|
|
3
3
|
import { SmsService } from './messaging/SmsService.js';
|
|
4
|
+
import { SmsTemplatesService } from './messaging/SmsTemplatesService.js';
|
|
4
5
|
import { EmailService } from './messaging/EmailService.js';
|
|
5
6
|
import { EmailTemplatesService } from './messaging/EmailTemplatesService.js';
|
|
6
7
|
import { EmailDomainsService } from './messaging/EmailDomainsService.js';
|
|
@@ -19,6 +20,7 @@ import { EmailSuppressionService } from './messaging/EmailSuppressionService.js'
|
|
|
19
20
|
export {
|
|
20
21
|
MessagingService,
|
|
21
22
|
SmsService,
|
|
23
|
+
SmsTemplatesService,
|
|
22
24
|
EmailService,
|
|
23
25
|
EmailTemplatesService,
|
|
24
26
|
EmailDomainsService,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* OAuth provider -- staff registry of OAuth clients (security-upgrades H1
|
|
5
|
+
* frozen contract). Every method hits `/oauth/clients*` under
|
|
6
|
+
* checkApiAuth; the server enforces `admin:oauthclient:manage`. Public
|
|
7
|
+
* authorize/token/introspect/revoke endpoints (H2/H3/H4) are not client
|
|
8
|
+
* methods -- they are third-party-facing, not called through this SDK.
|
|
9
|
+
*
|
|
10
|
+
* Exposed as `sdk.oauth.clients.*` (nested, since `oauth` is expected to
|
|
11
|
+
* grow other sub-surfaces alongside `clients` as H2-H4 land).
|
|
12
|
+
*/
|
|
13
|
+
export class OAuthService {
|
|
14
|
+
constructor(sdk) {
|
|
15
|
+
this.sdk = sdk;
|
|
16
|
+
this.clients = new OAuthClientsService(sdk);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class OAuthClientsService {
|
|
21
|
+
constructor(sdk) {
|
|
22
|
+
this.sdk = sdk;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List this account's OAuth clients.
|
|
27
|
+
* @returns {Promise<Object>} `{ clients: [...] }`
|
|
28
|
+
* @example
|
|
29
|
+
* const { clients } = await sdk.oauth.clients.list();
|
|
30
|
+
*/
|
|
31
|
+
async list() {
|
|
32
|
+
return internalRequest(this.sdk, '/oauth/clients', 'GET');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Register a new OAuth client.
|
|
37
|
+
* @param {Object} body
|
|
38
|
+
* @param {string} body.name
|
|
39
|
+
* @param {string} body.clientType - 'confidential' | 'public'
|
|
40
|
+
* @param {string[]} body.redirectUris
|
|
41
|
+
* @param {string[]} body.grantTypes - subset of 'authorization_code' | 'refresh_token' | 'client_credentials'
|
|
42
|
+
* @param {string[]} body.allowedScopes
|
|
43
|
+
* @param {string} [body.linkedUserId] - required when grantTypes includes 'client_credentials' (D11)
|
|
44
|
+
* @param {string} [body.logoUrl]
|
|
45
|
+
* @returns {Promise<Object>} `{ client, secret? }` -- secret is plaintext, shown once, confidential clients only
|
|
46
|
+
* @example
|
|
47
|
+
* const { client, secret } = await sdk.oauth.clients.create({
|
|
48
|
+
* name: 'Zapier',
|
|
49
|
+
* clientType: 'confidential',
|
|
50
|
+
* redirectUris: ['https://zapier.com/oauth/callback'],
|
|
51
|
+
* grantTypes: ['authorization_code', 'refresh_token'],
|
|
52
|
+
* allowedScopes: ['cdp:object:*:read'],
|
|
53
|
+
* });
|
|
54
|
+
*/
|
|
55
|
+
async create(body) {
|
|
56
|
+
this.sdk.validateParams(body || {}, {
|
|
57
|
+
name: { type: 'string', required: true },
|
|
58
|
+
clientType: { type: 'string', required: true },
|
|
59
|
+
redirectUris: { type: 'array', required: true },
|
|
60
|
+
grantTypes: { type: 'array', required: true },
|
|
61
|
+
allowedScopes: { type: 'array', required: true },
|
|
62
|
+
linkedUserId: { type: 'string', required: false },
|
|
63
|
+
logoUrl: { type: 'string', required: false },
|
|
64
|
+
});
|
|
65
|
+
return internalRequest(this.sdk, '/oauth/clients', 'POST', { body });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get one OAuth client.
|
|
70
|
+
* @param {string} id
|
|
71
|
+
* @returns {Promise<Object>} `{ client }`
|
|
72
|
+
*/
|
|
73
|
+
async get(id) {
|
|
74
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
75
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}`, 'GET');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Update an OAuth client. Any subset of the create fields, plus `status`
|
|
80
|
+
* ('active' | 'disabled').
|
|
81
|
+
* @param {string} id
|
|
82
|
+
* @param {Object} body
|
|
83
|
+
* @returns {Promise<Object>} `{ client }`
|
|
84
|
+
*/
|
|
85
|
+
async update(id, body) {
|
|
86
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
87
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}`, 'PUT', { body });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Soft-delete an OAuth client.
|
|
92
|
+
* @param {string} id
|
|
93
|
+
* @returns {Promise<Object>} `{ message }`
|
|
94
|
+
*/
|
|
95
|
+
async remove(id) {
|
|
96
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
97
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}`, 'DELETE');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* List a client's secrets (id/createdAt/expiresAt/revokedAt/lastUsedAt
|
|
102
|
+
* only -- never the hash or plaintext). Use the returned `id` values
|
|
103
|
+
* with revokeSecret() to decommission an old/compromised secret.
|
|
104
|
+
* @param {string} id
|
|
105
|
+
* @returns {Promise<Object>} `{ secrets: [...] }`
|
|
106
|
+
*/
|
|
107
|
+
async listSecrets(id) {
|
|
108
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
109
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}/secrets`, 'GET');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Mint a new client secret. The old secret keeps working until revoked.
|
|
114
|
+
* @param {string} id
|
|
115
|
+
* @returns {Promise<Object>} `{ secret }` -- plaintext, shown once
|
|
116
|
+
*/
|
|
117
|
+
async rotateSecret(id) {
|
|
118
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
119
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}/secrets`, 'POST');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Revoke one of a client's secrets.
|
|
124
|
+
* @param {string} id
|
|
125
|
+
* @param {string} secretId
|
|
126
|
+
* @returns {Promise<Object>} `{ message }`
|
|
127
|
+
*/
|
|
128
|
+
async revokeSecret(id, secretId) {
|
|
129
|
+
this.sdk.validateParams(
|
|
130
|
+
{ id, secretId },
|
|
131
|
+
{ id: { type: 'string', required: true }, secretId: { type: 'string', required: true } },
|
|
132
|
+
);
|
|
133
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}/secrets/${secretId}`, 'DELETE');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* List a client's user consent grants.
|
|
138
|
+
* @param {string} id
|
|
139
|
+
* @returns {Promise<Object>} `{ grants: [...] }`
|
|
140
|
+
*/
|
|
141
|
+
async listGrants(id) {
|
|
142
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
143
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}/grants`, 'GET');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Revoke a client's consent grant for one user.
|
|
148
|
+
* @param {string} id
|
|
149
|
+
* @param {string} grantId
|
|
150
|
+
* @returns {Promise<Object>} `{ message }`
|
|
151
|
+
*/
|
|
152
|
+
async revokeGrant(id, grantId) {
|
|
153
|
+
this.sdk.validateParams(
|
|
154
|
+
{ id, grantId },
|
|
155
|
+
{ id: { type: 'string', required: true }, grantId: { type: 'string', required: true } },
|
|
156
|
+
);
|
|
157
|
+
return internalRequest(this.sdk, `/oauth/clients/${id}/grants/${grantId}`, 'DELETE');
|
|
158
|
+
}
|
|
159
|
+
}
|
package/services/objects.js
CHANGED
|
@@ -1038,9 +1038,6 @@ export class ObjectsService {
|
|
|
1038
1038
|
description = null,
|
|
1039
1039
|
feedPostChanges = null,
|
|
1040
1040
|
feedPostWindowSeconds = null,
|
|
1041
|
-
showInNav = null,
|
|
1042
|
-
navLabel = null,
|
|
1043
|
-
icon = null,
|
|
1044
1041
|
}) {
|
|
1045
1042
|
this.sdk.validateParams(
|
|
1046
1043
|
{
|
|
@@ -1050,9 +1047,6 @@ export class ObjectsService {
|
|
|
1050
1047
|
description,
|
|
1051
1048
|
feedPostChanges,
|
|
1052
1049
|
feedPostWindowSeconds,
|
|
1053
|
-
showInNav,
|
|
1054
|
-
navLabel,
|
|
1055
|
-
icon,
|
|
1056
1050
|
},
|
|
1057
1051
|
{
|
|
1058
1052
|
objectName: { type: 'string', required: true },
|
|
@@ -1061,9 +1055,6 @@ export class ObjectsService {
|
|
|
1061
1055
|
description: { type: 'string', required: false },
|
|
1062
1056
|
feedPostChanges: { type: 'boolean', required: false },
|
|
1063
1057
|
feedPostWindowSeconds: { type: 'number', required: false },
|
|
1064
|
-
showInNav: { type: 'boolean', required: false },
|
|
1065
|
-
navLabel: { type: 'string', required: false },
|
|
1066
|
-
icon: { type: 'string', required: false },
|
|
1067
1058
|
},
|
|
1068
1059
|
);
|
|
1069
1060
|
|
|
@@ -1074,9 +1065,6 @@ export class ObjectsService {
|
|
|
1074
1065
|
if (feedPostChanges !== null) body.feedPostChanges = feedPostChanges;
|
|
1075
1066
|
if (feedPostWindowSeconds !== null)
|
|
1076
1067
|
body.feedPostWindowSeconds = feedPostWindowSeconds;
|
|
1077
|
-
if (showInNav !== null) body.showInNav = showInNav;
|
|
1078
|
-
if (navLabel !== null) body.navLabel = navLabel;
|
|
1079
|
-
if (icon !== null) body.icon = icon;
|
|
1080
1068
|
|
|
1081
1069
|
const params = { body };
|
|
1082
1070
|
|
|
@@ -1429,4 +1417,43 @@ export class ObjectsService {
|
|
|
1429
1417
|
);
|
|
1430
1418
|
}
|
|
1431
1419
|
|
|
1420
|
+
/**
|
|
1421
|
+
* P7 (workflows-v2-plan.md W10/W11/W23) -- runs an immediate full
|
|
1422
|
+
* enter+exit sweep for a journey program. Same diff-and-enqueue path a
|
|
1423
|
+
* scheduled tick runs, so this can never 429.
|
|
1424
|
+
* @param {string} programId
|
|
1425
|
+
* @returns {Promise<{queued: true, enterEnqueued: number, exitEnqueued: number}>}
|
|
1426
|
+
*/
|
|
1427
|
+
async runMarketingProgramNow(programId) {
|
|
1428
|
+
this.sdk.validateParams(
|
|
1429
|
+
{ programId },
|
|
1430
|
+
{ programId: { type: 'string', required: true } },
|
|
1431
|
+
);
|
|
1432
|
+
return internalRequest(
|
|
1433
|
+
this.sdk,
|
|
1434
|
+
`/object/marketing-programs/${programId}/run`,
|
|
1435
|
+
'POST',
|
|
1436
|
+
{ body: {} },
|
|
1437
|
+
);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* P7 -- paginated member list for a journey program (joined to people
|
|
1442
|
+
* for display name; never raw peopleId).
|
|
1443
|
+
* @param {string} programId
|
|
1444
|
+
* @param {{nextId?: string, limit?: number}} [opts]
|
|
1445
|
+
* @returns {Promise<{results: object[], pagination: object}>}
|
|
1446
|
+
*/
|
|
1447
|
+
async listMarketingProgramMembers(programId, opts = {}) {
|
|
1448
|
+
this.sdk.validateParams(
|
|
1449
|
+
{ programId },
|
|
1450
|
+
{ programId: { type: 'string', required: true } },
|
|
1451
|
+
);
|
|
1452
|
+
return internalRequest(
|
|
1453
|
+
this.sdk,
|
|
1454
|
+
`/object/marketing-programs/${programId}/members`,
|
|
1455
|
+
'GET',
|
|
1456
|
+
{ query: opts },
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1432
1459
|
}
|
package/services/permissions.js
CHANGED
|
@@ -541,27 +541,6 @@ export class PermissionsService {
|
|
|
541
541
|
);
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
/**
|
|
545
|
-
* Account-wide defaults for any settings-catalog key (settingsAccountDefaults
|
|
546
|
-
* table) — a generic tier below systemDefault and above nothing; resolver
|
|
547
|
-
* order is user override -> group -> account default -> systemDefault.
|
|
548
|
-
* @returns {Promise<Object>} { [key]: value }
|
|
549
|
-
*/
|
|
550
|
-
async getAccountSettingDefaults() {
|
|
551
|
-
return internalRequest(this.sdk, '/permissions/settings/accountDefaults', 'GET');
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
/** Set one account-wide default for a settings-catalog key. */
|
|
555
|
-
async setAccountSettingDefault(key, value) {
|
|
556
|
-
key = String(key);
|
|
557
|
-
this.sdk.validateParams({ key }, { key: { type: 'string', required: true } });
|
|
558
|
-
return internalRequest(this.sdk,
|
|
559
|
-
`/permissions/settings/accountDefaults/${key}`,
|
|
560
|
-
'PUT',
|
|
561
|
-
{ body: { value } },
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
544
|
/**
|
|
566
545
|
* Per-user, per-account JSON app state (UI state such as saved tab-sets).
|
|
567
546
|
* Distinct from settings: free-form JSON, not catalog-validated.
|