@unboundcx/sdk 4.13.16 → 4.13.18
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/package.json +1 -1
- package/services/dataImport.js +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.18",
|
|
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/dataImport.js
CHANGED
|
@@ -33,6 +33,18 @@ export class DataImportService {
|
|
|
33
33
|
return internalRequest(this.sdk, '/dataImport/jobs', 'GET');
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Autosave wizard state on a draft job.
|
|
38
|
+
* @param {string} id
|
|
39
|
+
* @param {Object} body { mapping?, wizardStep?, name?, errorMode?, skipTriggers? }
|
|
40
|
+
*/
|
|
41
|
+
async updateJob(id, body = {}) {
|
|
42
|
+
this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
|
|
43
|
+
return internalRequest(this.sdk, `/dataImport/jobs/${id}`, 'PATCH', {
|
|
44
|
+
body,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
36
48
|
/**
|
|
37
49
|
* Attach a storage source file to a draft job.
|
|
38
50
|
* @param {string} jobId
|
|
@@ -135,6 +147,27 @@ export class DataImportService {
|
|
|
135
147
|
return internalRequest(this.sdk, `/dataImport/jobs/${jobId}/rows`, 'GET');
|
|
136
148
|
}
|
|
137
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Download job rows as CSV (source columns + rowNumber,status,errorCode,errorMessage).
|
|
152
|
+
* Returns the raw CSV text (UTF-8, BOM-prefixed).
|
|
153
|
+
* @param {string} jobId
|
|
154
|
+
* @param {Object} [query] { status } default 'error'; also 'resolved', 'skipped',
|
|
155
|
+
* a comma list, or 'all' for no filter.
|
|
156
|
+
*/
|
|
157
|
+
async downloadRowsCsv(jobId, query = { status: 'error' }) {
|
|
158
|
+
this.sdk.validateParams(
|
|
159
|
+
{ jobId },
|
|
160
|
+
{ jobId: { type: 'string', required: true } },
|
|
161
|
+
);
|
|
162
|
+
return internalRequest(
|
|
163
|
+
this.sdk,
|
|
164
|
+
`/dataImport/jobs/${jobId}/rows.csv`,
|
|
165
|
+
'GET',
|
|
166
|
+
{ query },
|
|
167
|
+
true,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
138
171
|
/**
|
|
139
172
|
* Resolve an errored row.
|
|
140
173
|
* @param {string} jobId
|