@unboundcx/sdk 4.13.14 → 4.13.16
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 +246 -0
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.16",
|
|
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,246 @@
|
|
|
1
|
+
import { internalRequest } from '../base.js';
|
|
2
|
+
|
|
3
|
+
export class DataImportService {
|
|
4
|
+
constructor(sdk) {
|
|
5
|
+
this.sdk = sdk;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Create a draft import/export job.
|
|
10
|
+
* @param {Object} [body]
|
|
11
|
+
*/
|
|
12
|
+
async createJob(body = {}) {
|
|
13
|
+
return internalRequest(this.sdk, '/dataImport/jobs', 'POST', { body });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get a job by id.
|
|
18
|
+
* @param {string} id
|
|
19
|
+
*/
|
|
20
|
+
async getJob(id) {
|
|
21
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
22
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${id}`, 'GET');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* List jobs.
|
|
27
|
+
* @param {Object} [query]
|
|
28
|
+
*/
|
|
29
|
+
async listJobs(query) {
|
|
30
|
+
if (query) {
|
|
31
|
+
return internalRequest(this.sdk, '/dataImport/jobs', 'GET', { query });
|
|
32
|
+
}
|
|
33
|
+
return internalRequest(this.sdk, '/dataImport/jobs', 'GET');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Attach a storage source file to a draft job.
|
|
38
|
+
* @param {string} jobId
|
|
39
|
+
* @param {Object} body
|
|
40
|
+
*/
|
|
41
|
+
async attachSource(jobId, body = {}) {
|
|
42
|
+
this.sdk.validateParams(
|
|
43
|
+
{ jobId },
|
|
44
|
+
{ jobId: { type: 'string', required: true } },
|
|
45
|
+
);
|
|
46
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/sources`, 'POST', {
|
|
47
|
+
body,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Mapped+matched preview of a job's source.
|
|
53
|
+
* @param {string} jobId
|
|
54
|
+
* @param {Object} body
|
|
55
|
+
*/
|
|
56
|
+
async preview(jobId, body = {}) {
|
|
57
|
+
this.sdk.validateParams(
|
|
58
|
+
{ jobId },
|
|
59
|
+
{ jobId: { type: 'string', required: true } },
|
|
60
|
+
);
|
|
61
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/preview`, 'POST', {
|
|
62
|
+
body,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Start a job (snapshot mapping, ACL, Zeus launch).
|
|
68
|
+
* @param {string} jobId
|
|
69
|
+
* @param {Object} [body]
|
|
70
|
+
*/
|
|
71
|
+
async start(jobId, body) {
|
|
72
|
+
this.sdk.validateParams(
|
|
73
|
+
{ jobId },
|
|
74
|
+
{ jobId: { type: 'string', required: true } },
|
|
75
|
+
);
|
|
76
|
+
if (body !== undefined) {
|
|
77
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/start`, 'POST', {
|
|
78
|
+
body,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/start`, 'POST');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Pause a running job.
|
|
86
|
+
* @param {string} jobId
|
|
87
|
+
*/
|
|
88
|
+
async pause(jobId) {
|
|
89
|
+
this.sdk.validateParams(
|
|
90
|
+
{ jobId },
|
|
91
|
+
{ jobId: { type: 'string', required: true } },
|
|
92
|
+
);
|
|
93
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/pause`, 'POST');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Resume a paused job.
|
|
98
|
+
* @param {string} jobId
|
|
99
|
+
*/
|
|
100
|
+
async resume(jobId) {
|
|
101
|
+
this.sdk.validateParams(
|
|
102
|
+
{ jobId },
|
|
103
|
+
{ jobId: { type: 'string', required: true } },
|
|
104
|
+
);
|
|
105
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/resume`, 'POST');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Cancel a job.
|
|
110
|
+
* @param {string} jobId
|
|
111
|
+
*/
|
|
112
|
+
async cancel(jobId) {
|
|
113
|
+
this.sdk.validateParams(
|
|
114
|
+
{ jobId },
|
|
115
|
+
{ jobId: { type: 'string', required: true } },
|
|
116
|
+
);
|
|
117
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/cancel`, 'POST');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* List job rows, optionally filtered.
|
|
122
|
+
* @param {string} jobId
|
|
123
|
+
* @param {Object} [query]
|
|
124
|
+
*/
|
|
125
|
+
async listRows(jobId, query) {
|
|
126
|
+
this.sdk.validateParams(
|
|
127
|
+
{ jobId },
|
|
128
|
+
{ jobId: { type: 'string', required: true } },
|
|
129
|
+
);
|
|
130
|
+
if (query) {
|
|
131
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/rows`, 'GET', {
|
|
132
|
+
query,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/rows`, 'GET');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Resolve an errored row.
|
|
140
|
+
* @param {string} jobId
|
|
141
|
+
* @param {string} rowId
|
|
142
|
+
* @param {Object} body
|
|
143
|
+
*/
|
|
144
|
+
async resolveRow(jobId, rowId, body = {}) {
|
|
145
|
+
this.sdk.validateParams(
|
|
146
|
+
{ jobId, rowId },
|
|
147
|
+
{
|
|
148
|
+
jobId: { type: 'string', required: true },
|
|
149
|
+
rowId: { type: 'string', required: true },
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
return internalRequest(
|
|
153
|
+
this.sdk,
|
|
154
|
+
`/dataImport/jobs/${jobId}/rows/${rowId}/resolve`,
|
|
155
|
+
'POST',
|
|
156
|
+
{ body },
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get a signed download URL for a completed export job.
|
|
162
|
+
* @param {string} jobId
|
|
163
|
+
*/
|
|
164
|
+
async download(jobId) {
|
|
165
|
+
this.sdk.validateParams(
|
|
166
|
+
{ jobId },
|
|
167
|
+
{ jobId: { type: 'string', required: true } },
|
|
168
|
+
);
|
|
169
|
+
return internalRequest(
|
|
170
|
+
this.sdk,
|
|
171
|
+
`/dataImport/jobs/${jobId}/download`,
|
|
172
|
+
'GET',
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Save a mapping template.
|
|
178
|
+
* @param {Object} body
|
|
179
|
+
*/
|
|
180
|
+
async createMapping(body = {}) {
|
|
181
|
+
return internalRequest(this.sdk, '/dataImport/mappings', 'POST', { body });
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* List mapping templates.
|
|
186
|
+
*/
|
|
187
|
+
async listMappings() {
|
|
188
|
+
return internalRequest(this.sdk, '/dataImport/mappings', 'GET');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Get a mapping template by id.
|
|
193
|
+
* @param {string} id
|
|
194
|
+
*/
|
|
195
|
+
async getMapping(id) {
|
|
196
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
197
|
+
return internalRequest(this.sdk, `/dataImport/mappings/${id}`, 'GET');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Update a mapping template.
|
|
202
|
+
* @param {string} id
|
|
203
|
+
* @param {Object} body
|
|
204
|
+
*/
|
|
205
|
+
async updateMapping(id, body = {}) {
|
|
206
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
207
|
+
return internalRequest(this.sdk, `/dataImport/mappings/${id}`, 'PUT', {
|
|
208
|
+
body,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Export facade. Jobs are still dataImportJobs rows; createJob forces mode=export.
|
|
215
|
+
*/
|
|
216
|
+
export class DataExportService {
|
|
217
|
+
constructor(sdk) {
|
|
218
|
+
this.sdk = sdk;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Create a draft export job (POST /dataImport/jobs with mode=export).
|
|
223
|
+
* @param {Object} [body]
|
|
224
|
+
*/
|
|
225
|
+
async createJob(body = {}) {
|
|
226
|
+
return internalRequest(this.sdk, '/dataImport/jobs', 'POST', {
|
|
227
|
+
body: { ...body, mode: 'export' },
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Get a signed download URL for a completed export job.
|
|
233
|
+
* @param {string} jobId
|
|
234
|
+
*/
|
|
235
|
+
async download(jobId) {
|
|
236
|
+
this.sdk.validateParams(
|
|
237
|
+
{ jobId },
|
|
238
|
+
{ jobId: { type: 'string', required: true } },
|
|
239
|
+
);
|
|
240
|
+
return internalRequest(
|
|
241
|
+
this.sdk,
|
|
242
|
+
`/dataImport/jobs/${jobId}/download`,
|
|
243
|
+
'GET',
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|