@unboundcx/sdk 4.13.0 → 4.13.2
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/index.js +3 -0
- package/package.json +1 -1
- package/services/chat.js +83 -0
- package/services/documents.js +1 -0
- package/services/drive.js +16 -2
- package/services/esign.js +436 -0
- package/services/phoneNumbers.js +25 -15
- package/services/storage.js +60 -2
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { TaskRouterService } from './services/taskRouter.js';
|
|
|
32
32
|
import { KnowledgeBaseService } from './services/knowledgeBase.js';
|
|
33
33
|
import { FaxService } from './services/fax.js';
|
|
34
34
|
import { DocumentsService } from './services/documents.js';
|
|
35
|
+
import { EsignService } from './services/esign.js';
|
|
35
36
|
import { PermissionsService } from './services/permissions.js';
|
|
36
37
|
import { TriggersService } from './services/triggers.js';
|
|
37
38
|
import { RecentsService } from './services/recents.js';
|
|
@@ -112,6 +113,7 @@ class UnboundSDK extends BaseSDK {
|
|
|
112
113
|
this.knowledgeBase = new KnowledgeBaseService(this);
|
|
113
114
|
this.fax = new FaxService(this);
|
|
114
115
|
this.documents = new DocumentsService(this);
|
|
116
|
+
this.esign = new EsignService(this);
|
|
115
117
|
this.permissions = new PermissionsService(this);
|
|
116
118
|
this.triggers = new TriggersService(this);
|
|
117
119
|
this.recents = new RecentsService(this);
|
|
@@ -307,6 +309,7 @@ export { TaskRouterService } from './services/taskRouter.js';
|
|
|
307
309
|
export { WorkerService } from './services/taskRouter/WorkerService.js';
|
|
308
310
|
export { KnowledgeBaseService } from './services/knowledgeBase.js';
|
|
309
311
|
export { FaxService } from './services/fax.js';
|
|
312
|
+
export { EsignService, EsignPublicService } from './services/esign.js';
|
|
310
313
|
export { PermissionsService } from './services/permissions.js';
|
|
311
314
|
export { RecentsService } from './services/recents.js';
|
|
312
315
|
export { SearchService } from './services/search.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.2",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/chat.js
CHANGED
|
@@ -970,6 +970,89 @@ export class ChatService {
|
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
|
|
973
|
+
/**
|
|
974
|
+
* Admin: hide a reported message from user-facing chat (reversible).
|
|
975
|
+
* Content stays visible to admins. Creates/updates the permanent
|
|
976
|
+
* moderation case for the message.
|
|
977
|
+
* @param {string} id
|
|
978
|
+
* @returns {Promise<Object>} the hidden message, plus `caseId`
|
|
979
|
+
*/
|
|
980
|
+
async adminHideMessage(id) {
|
|
981
|
+
this.sdk.validateParams({ id }, { id: { type: "string", required: true } });
|
|
982
|
+
return internalRequest(this.sdk, `/chat/admin/messages/${id}/hide`, "POST");
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Admin: apply the final disposition to a hidden (or never-hidden)
|
|
987
|
+
* message — restore it, delete it (stays hidden, content retained
|
|
988
|
+
* subject to retention), or purge it (content expunged everywhere now).
|
|
989
|
+
* Also closes every open report on the message.
|
|
990
|
+
* @param {string} id
|
|
991
|
+
* @param {Object} params
|
|
992
|
+
* @param {'restore'|'delete'|'purge'} params.action
|
|
993
|
+
* @param {string} params.reason Free text, at least 3 characters
|
|
994
|
+
* @param {string} [params.description] Required (>= 3 chars) for `purge` —
|
|
995
|
+
* describes what the content was, since the content itself is removed
|
|
996
|
+
* @returns {Promise<Object>} the updated message, plus `caseId`/`caseAction`
|
|
997
|
+
*/
|
|
998
|
+
async adminDispositionMessage(id, { action, reason, description } = {}) {
|
|
999
|
+
this.sdk.validateParams(
|
|
1000
|
+
{ id, action, reason, description },
|
|
1001
|
+
{
|
|
1002
|
+
id: { type: "string", required: true },
|
|
1003
|
+
action: { type: "string", required: true },
|
|
1004
|
+
reason: { type: "string", required: true },
|
|
1005
|
+
description: { type: "string", required: false },
|
|
1006
|
+
},
|
|
1007
|
+
);
|
|
1008
|
+
const body = { action, reason };
|
|
1009
|
+
if (description !== undefined) body.description = description;
|
|
1010
|
+
return internalRequest(
|
|
1011
|
+
this.sdk,
|
|
1012
|
+
`/chat/admin/messages/${id}/disposition`,
|
|
1013
|
+
"POST",
|
|
1014
|
+
{ body },
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Admin: list moderation cases (permanent hide/disposition history).
|
|
1020
|
+
* @param {Object} [params]
|
|
1021
|
+
* @param {'open'|'closed'|'all'} [params.status]
|
|
1022
|
+
* @param {string} [params.authorId]
|
|
1023
|
+
* @param {string} [params.nextId] Pagination cursor (case id)
|
|
1024
|
+
* @param {number} [params.limit]
|
|
1025
|
+
* @returns {Promise<Object>} `{results, hasMore, nextId}`
|
|
1026
|
+
*/
|
|
1027
|
+
async adminListCases({ status, authorId, nextId, limit } = {}) {
|
|
1028
|
+
this.sdk.validateParams(
|
|
1029
|
+
{ status, authorId, nextId, limit },
|
|
1030
|
+
{
|
|
1031
|
+
status: { type: "string", required: false },
|
|
1032
|
+
authorId: { type: "string", required: false },
|
|
1033
|
+
nextId: { type: "string", required: false },
|
|
1034
|
+
limit: { type: "number", required: false },
|
|
1035
|
+
},
|
|
1036
|
+
);
|
|
1037
|
+
const query = {};
|
|
1038
|
+
if (status !== undefined) query.status = status;
|
|
1039
|
+
if (authorId !== undefined) query.authorId = authorId;
|
|
1040
|
+
if (nextId !== undefined) query.nextId = nextId;
|
|
1041
|
+
if (limit !== undefined) query.limit = limit;
|
|
1042
|
+
return internalRequest(this.sdk, "/chat/admin/cases", "GET", { query });
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Admin: get one moderation case — hydrated with its message (content
|
|
1047
|
+
* per the usual rules) and reports.
|
|
1048
|
+
* @param {string} id
|
|
1049
|
+
* @returns {Promise<Object>}
|
|
1050
|
+
*/
|
|
1051
|
+
async adminGetCase(id) {
|
|
1052
|
+
this.sdk.validateParams({ id }, { id: { type: "string", required: true } });
|
|
1053
|
+
return internalRequest(this.sdk, `/chat/admin/cases/${id}`, "GET");
|
|
1054
|
+
}
|
|
1055
|
+
|
|
973
1056
|
/**
|
|
974
1057
|
* Admin: audit log of review actions.
|
|
975
1058
|
* @returns {Promise<Object>}
|
package/services/documents.js
CHANGED
|
@@ -186,6 +186,7 @@ export class DocumentsService {
|
|
|
186
186
|
* @param {string} [params.versionId]
|
|
187
187
|
* @param {Object} [params.options]
|
|
188
188
|
* @param {string} [params.options.filename]
|
|
189
|
+
* @param {boolean} [params.options.includeRecipientFieldMap] - Persist recipient field geometry for esign
|
|
189
190
|
* @param {Object} [params.source]
|
|
190
191
|
* @param {string} [params.source.type]
|
|
191
192
|
* @param {string} [params.source.id]
|
package/services/drive.js
CHANGED
|
@@ -11,6 +11,10 @@ export class DriveService {
|
|
|
11
11
|
return result;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
async listDrives() {
|
|
15
|
+
return internalRequest(this.sdk, '/drive/drives', 'GET');
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
/**
|
|
15
19
|
* List Google Drive files and folders.
|
|
16
20
|
* @param {Object} [options]
|
|
@@ -236,17 +240,27 @@ export class DriveService {
|
|
|
236
240
|
* @param {string} [options.sharedDriveId]
|
|
237
241
|
* @param {boolean} [options.create]
|
|
238
242
|
*/
|
|
239
|
-
async resolvePath({
|
|
243
|
+
async resolvePath({
|
|
244
|
+
path,
|
|
245
|
+
sharedDriveId,
|
|
246
|
+
create,
|
|
247
|
+
objectName,
|
|
248
|
+
relatedId,
|
|
249
|
+
} = {}) {
|
|
240
250
|
this.sdk.validateParams(
|
|
241
|
-
{ path, sharedDriveId },
|
|
251
|
+
{ path, sharedDriveId, objectName, relatedId },
|
|
242
252
|
{
|
|
243
253
|
path: { type: 'string', required: true },
|
|
244
254
|
sharedDriveId: { type: 'string', required: false },
|
|
255
|
+
objectName: { type: 'string', required: false },
|
|
256
|
+
relatedId: { type: 'string', required: false },
|
|
245
257
|
},
|
|
246
258
|
);
|
|
247
259
|
const body = { path };
|
|
248
260
|
if (sharedDriveId !== undefined) body.sharedDriveId = sharedDriveId;
|
|
249
261
|
if (create !== undefined) body.create = create;
|
|
262
|
+
if (objectName !== undefined) body.objectName = objectName;
|
|
263
|
+
if (relatedId !== undefined) body.relatedId = relatedId;
|
|
250
264
|
return internalRequest(this.sdk, '/drive/resolvePath', 'POST', { body });
|
|
251
265
|
}
|
|
252
266
|
}
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Public (tokenized) signing session. `sdk.esign.public.*`.
|
|
5
|
+
* No tenant cookie; tenant is resolved from Host. All methods force HTTP
|
|
6
|
+
* so Present (Socket.IO SDK) does not NATS a Host-less request.
|
|
7
|
+
*/
|
|
8
|
+
export class EsignPublicService {
|
|
9
|
+
constructor(sdk) {
|
|
10
|
+
this.sdk = sdk;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This-signer summary + disclosure (no co-signer emails).
|
|
15
|
+
* @param {Object} params
|
|
16
|
+
* @param {string} params.token - Raw signing token
|
|
17
|
+
* @returns {Promise<Object>}
|
|
18
|
+
*/
|
|
19
|
+
async get({ token }) {
|
|
20
|
+
this.sdk.validateParams(
|
|
21
|
+
{ token },
|
|
22
|
+
{ token: { type: 'string', required: true } },
|
|
23
|
+
);
|
|
24
|
+
return internalRequest(this.sdk, `/esign/public/${token}`, 'GET', {}, true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Composed working (or sealed) PDF for this signer.
|
|
29
|
+
* @param {Object} [params]
|
|
30
|
+
* @param {string} params.token
|
|
31
|
+
* @param {string} [params.kind] - `working` (default) or `sealed`
|
|
32
|
+
* @returns {Promise<*>} Raw PDF response
|
|
33
|
+
*/
|
|
34
|
+
async getPdf({ token, kind } = {}) {
|
|
35
|
+
this.sdk.validateParams(
|
|
36
|
+
{ token },
|
|
37
|
+
{
|
|
38
|
+
token: { type: 'string', required: true },
|
|
39
|
+
kind: { type: 'string', required: false },
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
const params = { returnRawResponse: true };
|
|
43
|
+
if (kind !== undefined) params.query = { kind };
|
|
44
|
+
return internalRequest(
|
|
45
|
+
this.sdk,
|
|
46
|
+
`/esign/public/${token}/pdf`,
|
|
47
|
+
'GET',
|
|
48
|
+
params,
|
|
49
|
+
true,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Record consent. Must precede complete.
|
|
55
|
+
* @param {Object} params
|
|
56
|
+
* @param {string} params.token
|
|
57
|
+
* @param {boolean} params.accepted - Must be true
|
|
58
|
+
* @param {string} params.disclosureSha256
|
|
59
|
+
* @returns {Promise<Object>}
|
|
60
|
+
*/
|
|
61
|
+
async consent({ token, accepted, disclosureSha256 }) {
|
|
62
|
+
this.sdk.validateParams(
|
|
63
|
+
{ token, accepted, disclosureSha256 },
|
|
64
|
+
{
|
|
65
|
+
token: { type: 'string', required: true },
|
|
66
|
+
accepted: { type: 'boolean', required: true },
|
|
67
|
+
disclosureSha256: { type: 'string', required: true },
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
return internalRequest(
|
|
71
|
+
this.sdk,
|
|
72
|
+
`/esign/public/${token}/consent`,
|
|
73
|
+
'POST',
|
|
74
|
+
{ body: { accepted, disclosureSha256 } },
|
|
75
|
+
true,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Draft-save field values (not stamped).
|
|
81
|
+
* @param {Object} params
|
|
82
|
+
* @param {string} params.token
|
|
83
|
+
* @param {Object} params.values
|
|
84
|
+
* @returns {Promise<Object>}
|
|
85
|
+
*/
|
|
86
|
+
async save({ token, values }) {
|
|
87
|
+
this.sdk.validateParams(
|
|
88
|
+
{ token, values },
|
|
89
|
+
{
|
|
90
|
+
token: { type: 'string', required: true },
|
|
91
|
+
values: { type: 'object', required: true },
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
return internalRequest(
|
|
95
|
+
this.sdk,
|
|
96
|
+
`/esign/public/${token}/save`,
|
|
97
|
+
'POST',
|
|
98
|
+
{ body: { values } },
|
|
99
|
+
true,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Complete this recipient (stamp + maybe seal).
|
|
105
|
+
* @param {Object} params
|
|
106
|
+
* @param {string} params.token
|
|
107
|
+
* @param {Object} [params.values]
|
|
108
|
+
* @param {string} [params.method]
|
|
109
|
+
* @param {string} [params.adoptedName]
|
|
110
|
+
* @param {string} [params.imagePngBase64]
|
|
111
|
+
* @returns {Promise<Object>}
|
|
112
|
+
*/
|
|
113
|
+
async complete({ token, values, method, adoptedName, imagePngBase64 }) {
|
|
114
|
+
this.sdk.validateParams(
|
|
115
|
+
{ token },
|
|
116
|
+
{
|
|
117
|
+
token: { type: 'string', required: true },
|
|
118
|
+
values: { type: 'object', required: false },
|
|
119
|
+
method: { type: 'string', required: false },
|
|
120
|
+
adoptedName: { type: 'string', required: false },
|
|
121
|
+
imagePngBase64: { type: 'string', required: false },
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
const body = {};
|
|
125
|
+
if (values !== undefined) body.values = values;
|
|
126
|
+
if (method !== undefined) body.method = method;
|
|
127
|
+
if (adoptedName !== undefined) body.adoptedName = adoptedName;
|
|
128
|
+
if (imagePngBase64 !== undefined) body.imagePngBase64 = imagePngBase64;
|
|
129
|
+
return internalRequest(
|
|
130
|
+
this.sdk,
|
|
131
|
+
`/esign/public/${token}/complete`,
|
|
132
|
+
'POST',
|
|
133
|
+
{ body },
|
|
134
|
+
true,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Alias of {@link EsignPublicService#complete}. */
|
|
139
|
+
async sign(args) {
|
|
140
|
+
return this.complete(args);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Decline the package.
|
|
145
|
+
* @param {Object} params
|
|
146
|
+
* @param {string} params.token
|
|
147
|
+
* @param {string} [params.reason]
|
|
148
|
+
* @returns {Promise<Object>}
|
|
149
|
+
*/
|
|
150
|
+
async decline({ token, reason }) {
|
|
151
|
+
this.sdk.validateParams(
|
|
152
|
+
{ token },
|
|
153
|
+
{
|
|
154
|
+
token: { type: 'string', required: true },
|
|
155
|
+
reason: { type: 'string', required: false },
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
const body = {};
|
|
159
|
+
if (reason !== undefined) body.reason = reason;
|
|
160
|
+
return internalRequest(
|
|
161
|
+
this.sdk,
|
|
162
|
+
`/esign/public/${token}/decline`,
|
|
163
|
+
'POST',
|
|
164
|
+
{ body },
|
|
165
|
+
true,
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Authenticated signing packages. `sdk.esign.*`.
|
|
172
|
+
*/
|
|
173
|
+
export class EsignService {
|
|
174
|
+
constructor(sdk) {
|
|
175
|
+
this.sdk = sdk;
|
|
176
|
+
this.public = new EsignPublicService(sdk);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Create a draft package from a generated document.
|
|
181
|
+
* Field boxes come from the document's recipient field map, not the client.
|
|
182
|
+
* @param {Object} body
|
|
183
|
+
* @param {string} body.generatedDocumentId
|
|
184
|
+
* @param {string} body.name
|
|
185
|
+
* @param {Object[]} body.recipients
|
|
186
|
+
* @param {string} [body.routing] - `parallel` or `sequential`
|
|
187
|
+
* @param {Object[]} [body.links]
|
|
188
|
+
* @param {string} [body.expiresAt]
|
|
189
|
+
* @param {boolean} [body.allowDrawn]
|
|
190
|
+
* @param {string} [body.postSignRedirectUrl]
|
|
191
|
+
* @returns {Promise<Object>}
|
|
192
|
+
*/
|
|
193
|
+
async createPackage({
|
|
194
|
+
generatedDocumentId,
|
|
195
|
+
name,
|
|
196
|
+
routing,
|
|
197
|
+
recipients,
|
|
198
|
+
links,
|
|
199
|
+
expiresAt,
|
|
200
|
+
allowDrawn,
|
|
201
|
+
postSignRedirectUrl,
|
|
202
|
+
} = {}) {
|
|
203
|
+
this.sdk.validateParams(
|
|
204
|
+
{ generatedDocumentId, name, recipients },
|
|
205
|
+
{
|
|
206
|
+
generatedDocumentId: { type: 'string', required: true },
|
|
207
|
+
name: { type: 'string', required: true },
|
|
208
|
+
recipients: { type: 'array', required: true },
|
|
209
|
+
routing: { type: 'string', required: false },
|
|
210
|
+
links: { type: 'array', required: false },
|
|
211
|
+
expiresAt: { type: 'string', required: false },
|
|
212
|
+
allowDrawn: { type: 'boolean', required: false },
|
|
213
|
+
postSignRedirectUrl: { type: 'string', required: false },
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const body = { generatedDocumentId, name, recipients };
|
|
218
|
+
if (routing !== undefined) body.routing = routing;
|
|
219
|
+
if (links !== undefined) body.links = links;
|
|
220
|
+
if (expiresAt !== undefined) body.expiresAt = expiresAt;
|
|
221
|
+
if (allowDrawn !== undefined) body.allowDrawn = allowDrawn;
|
|
222
|
+
if (postSignRedirectUrl !== undefined) {
|
|
223
|
+
body.postSignRedirectUrl = postSignRedirectUrl;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return internalRequest(this.sdk, '/esign/packages', 'POST', { body });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* List packages. Missing tables → 503 `EsignNotProvisioned`.
|
|
231
|
+
* Gate probe: `listPackages({ limit: 1 })`.
|
|
232
|
+
* @param {Object} [query]
|
|
233
|
+
* @param {string} [query.recordId] - Requires `objectName`
|
|
234
|
+
* @param {string} [query.objectName] - Requires `recordId`
|
|
235
|
+
* @param {string} [query.status]
|
|
236
|
+
* @param {number} [query.limit]
|
|
237
|
+
* @returns {Promise<{results: Object[]}>}
|
|
238
|
+
*/
|
|
239
|
+
async listPackages({ recordId, objectName, status, limit } = {}) {
|
|
240
|
+
const query = {};
|
|
241
|
+
if (recordId) query.recordId = recordId;
|
|
242
|
+
if (objectName) query.objectName = objectName;
|
|
243
|
+
if (status) query.status = status;
|
|
244
|
+
if (limit) query.limit = limit;
|
|
245
|
+
return internalRequest(this.sdk, '/esign/packages', 'GET', { query });
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Package with signers, links, events (last 200).
|
|
250
|
+
* @param {string} id
|
|
251
|
+
* @returns {Promise<Object>}
|
|
252
|
+
*/
|
|
253
|
+
async getPackage(id) {
|
|
254
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
255
|
+
return internalRequest(this.sdk, `/esign/packages/${id}`, 'GET');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Patch a draft package.
|
|
260
|
+
* @param {string} id
|
|
261
|
+
* @param {Object} [body]
|
|
262
|
+
* @param {string} [body.name]
|
|
263
|
+
* @param {Object[]} [body.recipients]
|
|
264
|
+
* @param {string} [body.routing]
|
|
265
|
+
* @param {Object[]} [body.links]
|
|
266
|
+
* @param {string} [body.expiresAt]
|
|
267
|
+
* @param {boolean} [body.allowDrawn]
|
|
268
|
+
* @param {string} [body.postSignRedirectUrl]
|
|
269
|
+
* @returns {Promise<Object>}
|
|
270
|
+
*/
|
|
271
|
+
async updatePackage(
|
|
272
|
+
id,
|
|
273
|
+
{
|
|
274
|
+
name,
|
|
275
|
+
recipients,
|
|
276
|
+
routing,
|
|
277
|
+
links,
|
|
278
|
+
expiresAt,
|
|
279
|
+
allowDrawn,
|
|
280
|
+
postSignRedirectUrl,
|
|
281
|
+
} = {},
|
|
282
|
+
) {
|
|
283
|
+
this.sdk.validateParams(
|
|
284
|
+
{ id },
|
|
285
|
+
{
|
|
286
|
+
id: { type: 'string', required: true },
|
|
287
|
+
name: { type: 'string', required: false },
|
|
288
|
+
recipients: { type: 'array', required: false },
|
|
289
|
+
routing: { type: 'string', required: false },
|
|
290
|
+
links: { type: 'array', required: false },
|
|
291
|
+
expiresAt: { type: 'string', required: false },
|
|
292
|
+
allowDrawn: { type: 'boolean', required: false },
|
|
293
|
+
postSignRedirectUrl: { type: 'string', required: false },
|
|
294
|
+
},
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
const body = {};
|
|
298
|
+
if (name !== undefined) body.name = name;
|
|
299
|
+
if (recipients !== undefined) body.recipients = recipients;
|
|
300
|
+
if (routing !== undefined) body.routing = routing;
|
|
301
|
+
if (links !== undefined) body.links = links;
|
|
302
|
+
if (expiresAt !== undefined) body.expiresAt = expiresAt;
|
|
303
|
+
if (allowDrawn !== undefined) body.allowDrawn = allowDrawn;
|
|
304
|
+
if (postSignRedirectUrl !== undefined) {
|
|
305
|
+
body.postSignRedirectUrl = postSignRedirectUrl;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return internalRequest(this.sdk, `/esign/packages/${id}`, 'PATCH', {
|
|
309
|
+
body,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Freeze disclosure, issue tokens, email recipients.
|
|
315
|
+
* @param {string} id
|
|
316
|
+
* @returns {Promise<Object>}
|
|
317
|
+
*/
|
|
318
|
+
async send(id) {
|
|
319
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
320
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/send`, 'POST', {
|
|
321
|
+
body: {},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Mint a present token (no email). `{ url, expiresAt }`.
|
|
327
|
+
* @param {string} id
|
|
328
|
+
* @param {Object} params
|
|
329
|
+
* @param {string} params.signerId
|
|
330
|
+
* @returns {Promise<Object>}
|
|
331
|
+
*/
|
|
332
|
+
async present(id, { signerId }) {
|
|
333
|
+
this.sdk.validateParams(
|
|
334
|
+
{ id, signerId },
|
|
335
|
+
{
|
|
336
|
+
id: { type: 'string', required: true },
|
|
337
|
+
signerId: { type: 'string', required: true },
|
|
338
|
+
},
|
|
339
|
+
);
|
|
340
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/present`, 'POST', {
|
|
341
|
+
body: { signerId },
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Resend the signing email. Optional `signerId` targets one recipient.
|
|
347
|
+
* @param {string} id
|
|
348
|
+
* @param {Object} [params]
|
|
349
|
+
* @param {string} [params.signerId]
|
|
350
|
+
* @returns {Promise<Object>}
|
|
351
|
+
*/
|
|
352
|
+
async remind(id, { signerId } = {}) {
|
|
353
|
+
this.sdk.validateParams(
|
|
354
|
+
{ id },
|
|
355
|
+
{
|
|
356
|
+
id: { type: 'string', required: true },
|
|
357
|
+
signerId: { type: 'string', required: false },
|
|
358
|
+
},
|
|
359
|
+
);
|
|
360
|
+
const body = {};
|
|
361
|
+
if (signerId !== undefined) body.signerId = signerId;
|
|
362
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/remind`, 'POST', {
|
|
363
|
+
body,
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Void an in-flight package.
|
|
369
|
+
* @param {string} id
|
|
370
|
+
* @param {Object} [params]
|
|
371
|
+
* @param {string} [params.reason]
|
|
372
|
+
* @returns {Promise<Object>}
|
|
373
|
+
*/
|
|
374
|
+
async void(id, { reason } = {}) {
|
|
375
|
+
this.sdk.validateParams(
|
|
376
|
+
{ id },
|
|
377
|
+
{
|
|
378
|
+
id: { type: 'string', required: true },
|
|
379
|
+
reason: { type: 'string', required: false },
|
|
380
|
+
},
|
|
381
|
+
);
|
|
382
|
+
const body = {};
|
|
383
|
+
if (reason !== undefined) body.reason = reason;
|
|
384
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/void`, 'POST', {
|
|
385
|
+
body,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Idempotent seal repair.
|
|
391
|
+
* @param {string} id
|
|
392
|
+
* @returns {Promise<Object>}
|
|
393
|
+
*/
|
|
394
|
+
async seal(id) {
|
|
395
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
396
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/seal`, 'POST', {
|
|
397
|
+
body: {},
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Evidence JSON pack.
|
|
403
|
+
* @param {string} id
|
|
404
|
+
* @returns {Promise<Object>}
|
|
405
|
+
*/
|
|
406
|
+
async getEvidence(id) {
|
|
407
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
408
|
+
return internalRequest(this.sdk, `/esign/packages/${id}/evidence`, 'GET');
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Package PDF. HTTP-only (binary).
|
|
413
|
+
* @param {string} id
|
|
414
|
+
* @param {Object} [params]
|
|
415
|
+
* @param {string} [params.kind] - `unsigned` | `working` | `sealed` | `certificate`
|
|
416
|
+
* @returns {Promise<*>} Raw PDF response
|
|
417
|
+
*/
|
|
418
|
+
async getPdf(id, { kind } = {}) {
|
|
419
|
+
this.sdk.validateParams(
|
|
420
|
+
{ id },
|
|
421
|
+
{
|
|
422
|
+
id: { type: 'string', required: true },
|
|
423
|
+
kind: { type: 'string', required: false },
|
|
424
|
+
},
|
|
425
|
+
);
|
|
426
|
+
const params = { returnRawResponse: true };
|
|
427
|
+
if (kind !== undefined) params.query = { kind };
|
|
428
|
+
return internalRequest(
|
|
429
|
+
this.sdk,
|
|
430
|
+
`/esign/packages/${id}/pdf`,
|
|
431
|
+
'GET',
|
|
432
|
+
params,
|
|
433
|
+
true,
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
}
|
package/services/phoneNumbers.js
CHANGED
|
@@ -651,35 +651,45 @@ export class PhoneNumbersService {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* Automatically generates a PDF LOA document using template data from the porting order,
|
|
657
|
-
* uploads it to storage, and attaches it to the order as an LOA document.
|
|
654
|
+
* Start e-sign for a porting LOA (`send` emails the signer, `present` returns a URL).
|
|
658
655
|
*
|
|
659
656
|
* @param {Object} params
|
|
660
|
-
* @param {string} params.portingOrderId
|
|
661
|
-
* @param {string} params.signerName
|
|
662
|
-
* @param {string} params.
|
|
663
|
-
* @
|
|
657
|
+
* @param {string} params.portingOrderId
|
|
658
|
+
* @param {string} params.signerName
|
|
659
|
+
* @param {string} params.mode - `send` or `present`
|
|
660
|
+
* @param {string} [params.signerTitle]
|
|
661
|
+
* @param {string} [params.signerEmail] - required when mode is send
|
|
662
|
+
* @returns {Promise<Object>} `{ packageId, status, signers, presentUrl?, presentExpiresAt? }`
|
|
664
663
|
*/
|
|
665
|
-
async generateLoa({
|
|
664
|
+
async generateLoa({
|
|
665
|
+
portingOrderId,
|
|
666
|
+
signerName,
|
|
667
|
+
signerTitle,
|
|
668
|
+
signerEmail,
|
|
669
|
+
mode,
|
|
670
|
+
}) {
|
|
666
671
|
this.sdk.validateParams(
|
|
667
|
-
{ portingOrderId, signerName,
|
|
672
|
+
{ portingOrderId, signerName, mode },
|
|
668
673
|
{
|
|
669
674
|
portingOrderId: { type: 'string', required: true },
|
|
670
675
|
signerName: { type: 'string', required: true },
|
|
671
|
-
|
|
676
|
+
mode: { type: 'string', required: true },
|
|
677
|
+
signerTitle: { type: 'string', required: false },
|
|
678
|
+
signerEmail: { type: 'string', required: false },
|
|
672
679
|
},
|
|
673
680
|
);
|
|
674
681
|
|
|
675
|
-
const
|
|
682
|
+
const body = { signerName, mode };
|
|
683
|
+
if (signerTitle !== undefined) body.signerTitle = signerTitle;
|
|
684
|
+
if (signerEmail !== undefined) body.signerEmail = signerEmail;
|
|
685
|
+
|
|
686
|
+
const result = await internalRequest(
|
|
687
|
+
this.sdk,
|
|
676
688
|
`/phoneNumbers/porting/orders/${encodeURIComponent(
|
|
677
689
|
portingOrderId,
|
|
678
690
|
)}/generate-loa`,
|
|
679
691
|
'POST',
|
|
680
|
-
{
|
|
681
|
-
body: { signerName, signerTitle },
|
|
682
|
-
},
|
|
692
|
+
{ body },
|
|
683
693
|
);
|
|
684
694
|
return result;
|
|
685
695
|
}
|
package/services/storage.js
CHANGED
|
@@ -480,6 +480,7 @@ Response:
|
|
|
480
480
|
country = 'US',
|
|
481
481
|
expireAfter,
|
|
482
482
|
relatedId,
|
|
483
|
+
objectName,
|
|
483
484
|
folderId,
|
|
484
485
|
createAccessKey = false,
|
|
485
486
|
accessKeyExpiresIn,
|
|
@@ -498,6 +499,7 @@ Response:
|
|
|
498
499
|
country,
|
|
499
500
|
expireAfter,
|
|
500
501
|
relatedId,
|
|
502
|
+
objectName,
|
|
501
503
|
folderId,
|
|
502
504
|
createAccessKey,
|
|
503
505
|
accessKeyExpiresIn,
|
|
@@ -513,6 +515,7 @@ Response:
|
|
|
513
515
|
country: { type: 'string', required: false },
|
|
514
516
|
expireAfter: { type: 'string', required: false },
|
|
515
517
|
relatedId: { type: 'string', required: false },
|
|
518
|
+
objectName: { type: 'string', required: false },
|
|
516
519
|
folderId: { type: 'string', required: false },
|
|
517
520
|
createAccessKey: { type: 'boolean', required: false },
|
|
518
521
|
accessKeyExpiresIn: { type: 'number', required: false },
|
|
@@ -530,6 +533,7 @@ Response:
|
|
|
530
533
|
if (country) formFields.push(['country', country]);
|
|
531
534
|
if (expireAfter) formFields.push(['expireAfter', expireAfter]);
|
|
532
535
|
if (relatedId) formFields.push(['relatedId', relatedId]);
|
|
536
|
+
if (objectName) formFields.push(['objectName', objectName]);
|
|
533
537
|
if (folderId) formFields.push(['folderId', folderId]);
|
|
534
538
|
if (createAccessKey !== undefined)
|
|
535
539
|
formFields.push(['createAccessKey', createAccessKey.toString()]);
|
|
@@ -910,18 +914,20 @@ Response:
|
|
|
910
914
|
* @param {string} options.name
|
|
911
915
|
* @returns {Promise<Object>}
|
|
912
916
|
*/
|
|
913
|
-
async createFolder({ relatedId, parentId, name } = {}) {
|
|
917
|
+
async createFolder({ relatedId, parentId, name, objectName } = {}) {
|
|
914
918
|
this.sdk.validateParams(
|
|
915
|
-
{ relatedId, parentId, name },
|
|
919
|
+
{ relatedId, parentId, name, objectName },
|
|
916
920
|
{
|
|
917
921
|
relatedId: { type: 'string', required: true },
|
|
918
922
|
parentId: { type: 'string', required: false },
|
|
919
923
|
name: { type: 'string', required: true },
|
|
924
|
+
objectName: { type: 'string', required: false },
|
|
920
925
|
},
|
|
921
926
|
);
|
|
922
927
|
|
|
923
928
|
const body = { relatedId, name };
|
|
924
929
|
if (parentId !== undefined) body.parentId = parentId;
|
|
930
|
+
if (objectName !== undefined) body.objectName = objectName;
|
|
925
931
|
|
|
926
932
|
const result = await internalRequest(this.sdk, '/storage/folders', 'POST', {
|
|
927
933
|
body,
|
|
@@ -1183,6 +1189,58 @@ Response:
|
|
|
1183
1189
|
return result;
|
|
1184
1190
|
}
|
|
1185
1191
|
|
|
1192
|
+
async getAccountSettings() {
|
|
1193
|
+
return internalRequest(this.sdk, '/storage/account-settings', 'GET');
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
async updateAccountSettings(body = {}) {
|
|
1197
|
+
return internalRequest(this.sdk, '/storage/account-settings', 'PUT', {
|
|
1198
|
+
body,
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
async listRecordSettings() {
|
|
1203
|
+
return internalRequest(this.sdk, '/storage/record-settings', 'GET');
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
async getRecordSettings(objectName) {
|
|
1207
|
+
this.sdk.validateParams(
|
|
1208
|
+
{ objectName },
|
|
1209
|
+
{ objectName: { type: 'string', required: true } },
|
|
1210
|
+
);
|
|
1211
|
+
return internalRequest(
|
|
1212
|
+
this.sdk,
|
|
1213
|
+
`/storage/record-settings/${objectName}`,
|
|
1214
|
+
'GET',
|
|
1215
|
+
);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
async updateRecordSettings(objectName, body = {}) {
|
|
1219
|
+
this.sdk.validateParams(
|
|
1220
|
+
{ objectName },
|
|
1221
|
+
{ objectName: { type: 'string', required: true } },
|
|
1222
|
+
);
|
|
1223
|
+
return internalRequest(
|
|
1224
|
+
this.sdk,
|
|
1225
|
+
`/storage/record-settings/${objectName}`,
|
|
1226
|
+
'PUT',
|
|
1227
|
+
{ body },
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
async getRecordGoogleFolder({ objectName, relatedId } = {}) {
|
|
1232
|
+
this.sdk.validateParams(
|
|
1233
|
+
{ objectName, relatedId },
|
|
1234
|
+
{
|
|
1235
|
+
objectName: { type: 'string', required: true },
|
|
1236
|
+
relatedId: { type: 'string', required: true },
|
|
1237
|
+
},
|
|
1238
|
+
);
|
|
1239
|
+
return internalRequest(this.sdk, '/storage/record-google-folders', 'GET', {
|
|
1240
|
+
query: { objectName, relatedId },
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1186
1244
|
/**
|
|
1187
1245
|
* Convert an existing stored file to a different format and save it as a new storage record.
|
|
1188
1246
|
* The original file remains unchanged. Supported source formats: PDF, DOC, DOCX.
|