@unboundcx/sdk 4.13.13 → 4.13.15
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 +10 -0
- package/package.json +1 -1
- package/services/dataImport.js +233 -0
- package/services/voice.js +26 -2
package/index.js
CHANGED
|
@@ -40,6 +40,10 @@ import { SearchService } from './services/search.js';
|
|
|
40
40
|
import { DirectoryService } from './services/directory.js';
|
|
41
41
|
import { ChatService } from './services/chat.js';
|
|
42
42
|
import { DeveloperApisService } from './services/developerApis.js';
|
|
43
|
+
import {
|
|
44
|
+
DataImportService,
|
|
45
|
+
DataExportService,
|
|
46
|
+
} from './services/dataImport.js';
|
|
43
47
|
|
|
44
48
|
class UnboundSDK extends BaseSDK {
|
|
45
49
|
constructor(options = {}) {
|
|
@@ -121,6 +125,8 @@ class UnboundSDK extends BaseSDK {
|
|
|
121
125
|
this.directory = new DirectoryService(this);
|
|
122
126
|
this.chat = new ChatService(this);
|
|
123
127
|
this.developerApis = new DeveloperApisService(this);
|
|
128
|
+
this.dataImport = new DataImportService(this);
|
|
129
|
+
this.dataExport = new DataExportService(this);
|
|
124
130
|
|
|
125
131
|
// Add additional services that might be missing
|
|
126
132
|
this._initializeAdditionalServices();
|
|
@@ -316,4 +322,8 @@ export { SearchService } from './services/search.js';
|
|
|
316
322
|
export { DirectoryService } from './services/directory.js';
|
|
317
323
|
export { ChatService } from './services/chat.js';
|
|
318
324
|
export { DeveloperApisService } from './services/developerApis.js';
|
|
325
|
+
export {
|
|
326
|
+
DataImportService,
|
|
327
|
+
DataExportService,
|
|
328
|
+
} from './services/dataImport.js';
|
|
319
329
|
export { BaseSDK } from './base.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.15",
|
|
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",
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
export class DataImportService {
|
|
2
|
+
constructor(sdk) {
|
|
3
|
+
this.sdk = sdk;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a draft import/export job.
|
|
8
|
+
* @param {Object} [body]
|
|
9
|
+
*/
|
|
10
|
+
async createJob(body = {}) {
|
|
11
|
+
return this.sdk._fetch('/dataImport/jobs', 'POST', { body });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get a job by id.
|
|
16
|
+
* @param {string} id
|
|
17
|
+
*/
|
|
18
|
+
async getJob(id) {
|
|
19
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
20
|
+
return this.sdk._fetch(`/dataImport/jobs/${id}`, 'GET');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* List jobs.
|
|
25
|
+
* @param {Object} [query]
|
|
26
|
+
*/
|
|
27
|
+
async listJobs(query) {
|
|
28
|
+
if (query) {
|
|
29
|
+
return this.sdk._fetch('/dataImport/jobs', 'GET', { query });
|
|
30
|
+
}
|
|
31
|
+
return this.sdk._fetch('/dataImport/jobs', 'GET');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Attach a storage source file to a draft job.
|
|
36
|
+
* @param {string} jobId
|
|
37
|
+
* @param {Object} body
|
|
38
|
+
*/
|
|
39
|
+
async attachSource(jobId, body = {}) {
|
|
40
|
+
this.sdk.validateParams(
|
|
41
|
+
{ jobId },
|
|
42
|
+
{ jobId: { type: 'string', required: true } },
|
|
43
|
+
);
|
|
44
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/sources`, 'POST', {
|
|
45
|
+
body,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Mapped+matched preview of a job's source.
|
|
51
|
+
* @param {string} jobId
|
|
52
|
+
* @param {Object} body
|
|
53
|
+
*/
|
|
54
|
+
async preview(jobId, body = {}) {
|
|
55
|
+
this.sdk.validateParams(
|
|
56
|
+
{ jobId },
|
|
57
|
+
{ jobId: { type: 'string', required: true } },
|
|
58
|
+
);
|
|
59
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/preview`, 'POST', {
|
|
60
|
+
body,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Start a job (snapshot mapping, ACL, Zeus launch).
|
|
66
|
+
* @param {string} jobId
|
|
67
|
+
* @param {Object} [body]
|
|
68
|
+
*/
|
|
69
|
+
async start(jobId, body) {
|
|
70
|
+
this.sdk.validateParams(
|
|
71
|
+
{ jobId },
|
|
72
|
+
{ jobId: { type: 'string', required: true } },
|
|
73
|
+
);
|
|
74
|
+
if (body !== undefined) {
|
|
75
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/start`, 'POST', {
|
|
76
|
+
body,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/start`, 'POST');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Pause a running job.
|
|
84
|
+
* @param {string} jobId
|
|
85
|
+
*/
|
|
86
|
+
async pause(jobId) {
|
|
87
|
+
this.sdk.validateParams(
|
|
88
|
+
{ jobId },
|
|
89
|
+
{ jobId: { type: 'string', required: true } },
|
|
90
|
+
);
|
|
91
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/pause`, 'POST');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Resume a paused job.
|
|
96
|
+
* @param {string} jobId
|
|
97
|
+
*/
|
|
98
|
+
async resume(jobId) {
|
|
99
|
+
this.sdk.validateParams(
|
|
100
|
+
{ jobId },
|
|
101
|
+
{ jobId: { type: 'string', required: true } },
|
|
102
|
+
);
|
|
103
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/resume`, 'POST');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Cancel a job.
|
|
108
|
+
* @param {string} jobId
|
|
109
|
+
*/
|
|
110
|
+
async cancel(jobId) {
|
|
111
|
+
this.sdk.validateParams(
|
|
112
|
+
{ jobId },
|
|
113
|
+
{ jobId: { type: 'string', required: true } },
|
|
114
|
+
);
|
|
115
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/cancel`, 'POST');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* List job rows, optionally filtered.
|
|
120
|
+
* @param {string} jobId
|
|
121
|
+
* @param {Object} [query]
|
|
122
|
+
*/
|
|
123
|
+
async listRows(jobId, query) {
|
|
124
|
+
this.sdk.validateParams(
|
|
125
|
+
{ jobId },
|
|
126
|
+
{ jobId: { type: 'string', required: true } },
|
|
127
|
+
);
|
|
128
|
+
if (query) {
|
|
129
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/rows`, 'GET', {
|
|
130
|
+
query,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/rows`, 'GET');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Resolve an errored row.
|
|
138
|
+
* @param {string} jobId
|
|
139
|
+
* @param {string} rowId
|
|
140
|
+
* @param {Object} body
|
|
141
|
+
*/
|
|
142
|
+
async resolveRow(jobId, rowId, body = {}) {
|
|
143
|
+
this.sdk.validateParams(
|
|
144
|
+
{ jobId, rowId },
|
|
145
|
+
{
|
|
146
|
+
jobId: { type: 'string', required: true },
|
|
147
|
+
rowId: { type: 'string', required: true },
|
|
148
|
+
},
|
|
149
|
+
);
|
|
150
|
+
return this.sdk._fetch(
|
|
151
|
+
`/dataImport/jobs/${jobId}/rows/${rowId}/resolve`,
|
|
152
|
+
'POST',
|
|
153
|
+
{ body },
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get a signed download URL for a completed export job.
|
|
159
|
+
* @param {string} jobId
|
|
160
|
+
*/
|
|
161
|
+
async download(jobId) {
|
|
162
|
+
this.sdk.validateParams(
|
|
163
|
+
{ jobId },
|
|
164
|
+
{ jobId: { type: 'string', required: true } },
|
|
165
|
+
);
|
|
166
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/download`, 'GET');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Save a mapping template.
|
|
171
|
+
* @param {Object} body
|
|
172
|
+
*/
|
|
173
|
+
async createMapping(body = {}) {
|
|
174
|
+
return this.sdk._fetch('/dataImport/mappings', 'POST', { body });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* List mapping templates.
|
|
179
|
+
*/
|
|
180
|
+
async listMappings() {
|
|
181
|
+
return this.sdk._fetch('/dataImport/mappings', 'GET');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get a mapping template by id.
|
|
186
|
+
* @param {string} id
|
|
187
|
+
*/
|
|
188
|
+
async getMapping(id) {
|
|
189
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
190
|
+
return this.sdk._fetch(`/dataImport/mappings/${id}`, 'GET');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Update a mapping template.
|
|
195
|
+
* @param {string} id
|
|
196
|
+
* @param {Object} body
|
|
197
|
+
*/
|
|
198
|
+
async updateMapping(id, body = {}) {
|
|
199
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
200
|
+
return this.sdk._fetch(`/dataImport/mappings/${id}`, 'PUT', { body });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Export facade. Jobs are still dataImportJobs rows; createJob forces mode=export.
|
|
206
|
+
*/
|
|
207
|
+
export class DataExportService {
|
|
208
|
+
constructor(sdk) {
|
|
209
|
+
this.sdk = sdk;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Create a draft export job (POST /dataImport/jobs with mode=export).
|
|
214
|
+
* @param {Object} [body]
|
|
215
|
+
*/
|
|
216
|
+
async createJob(body = {}) {
|
|
217
|
+
return this.sdk._fetch('/dataImport/jobs', 'POST', {
|
|
218
|
+
body: { ...body, mode: 'export' },
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Get a signed download URL for a completed export job.
|
|
224
|
+
* @param {string} jobId
|
|
225
|
+
*/
|
|
226
|
+
async download(jobId) {
|
|
227
|
+
this.sdk.validateParams(
|
|
228
|
+
{ jobId },
|
|
229
|
+
{ jobId: { type: 'string', required: true } },
|
|
230
|
+
);
|
|
231
|
+
return this.sdk._fetch(`/dataImport/jobs/${jobId}/download`, 'GET');
|
|
232
|
+
}
|
|
233
|
+
}
|
package/services/voice.js
CHANGED
|
@@ -51,9 +51,27 @@ export class VoiceService {
|
|
|
51
51
|
return result;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
async call({
|
|
54
|
+
async call({
|
|
55
|
+
to,
|
|
56
|
+
from,
|
|
57
|
+
destination,
|
|
58
|
+
app,
|
|
59
|
+
timeout,
|
|
60
|
+
customHeaders,
|
|
61
|
+
statusWebhook,
|
|
62
|
+
parentCallId,
|
|
63
|
+
}) {
|
|
55
64
|
this.sdk.validateParams(
|
|
56
|
-
{
|
|
65
|
+
{
|
|
66
|
+
to,
|
|
67
|
+
from,
|
|
68
|
+
destination,
|
|
69
|
+
app,
|
|
70
|
+
timeout,
|
|
71
|
+
customHeaders,
|
|
72
|
+
statusWebhook,
|
|
73
|
+
parentCallId,
|
|
74
|
+
},
|
|
57
75
|
{
|
|
58
76
|
to: { type: 'string', required: true },
|
|
59
77
|
from: { type: 'string', required: true },
|
|
@@ -65,6 +83,11 @@ export class VoiceService {
|
|
|
65
83
|
// events (trying/ringing/answered/failed) with `static` fields
|
|
66
84
|
// merged into each POST body
|
|
67
85
|
statusWebhook: { type: 'object', required: false },
|
|
86
|
+
// SIP call id of an in-progress call this outbound leg is placed on
|
|
87
|
+
// behalf of (e.g. task-router ringing an agent for a queued caller).
|
|
88
|
+
// Links the leg as a child so sip-processor cascade-cancels it if
|
|
89
|
+
// that caller hangs up while it's still ringing.
|
|
90
|
+
parentCallId: { type: 'string', required: false },
|
|
68
91
|
},
|
|
69
92
|
);
|
|
70
93
|
|
|
@@ -77,6 +100,7 @@ export class VoiceService {
|
|
|
77
100
|
timeout,
|
|
78
101
|
customHeaders,
|
|
79
102
|
statusWebhook,
|
|
103
|
+
parentCallId,
|
|
80
104
|
},
|
|
81
105
|
};
|
|
82
106
|
|