@unboundcx/sdk 4.13.61 → 4.13.63
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.63",
|
|
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",
|
|
@@ -173,6 +173,81 @@ export class KnowledgeBaseService {
|
|
|
173
173
|
return result;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* List version snapshots for a KB article, newest first
|
|
178
|
+
*
|
|
179
|
+
* @param {Object} params
|
|
180
|
+
* @param {string} params.id - Article ID
|
|
181
|
+
* @returns {Promise<Object>} { results: [{ id, version, createdAt, createdBy, contentLength, preview }] }
|
|
182
|
+
*/
|
|
183
|
+
async listArticleVersions({ id }) {
|
|
184
|
+
this.sdk.validateParams(
|
|
185
|
+
{ id },
|
|
186
|
+
{
|
|
187
|
+
id: { type: 'string', required: true },
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const result = await internalRequest(
|
|
192
|
+
this.sdk,
|
|
193
|
+
`/knowledgeBase/articles/${id}/versions`,
|
|
194
|
+
'GET',
|
|
195
|
+
);
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Get one full version snapshot (with content) for a KB article
|
|
201
|
+
*
|
|
202
|
+
* @param {Object} params
|
|
203
|
+
* @param {string} params.id - Article ID
|
|
204
|
+
* @param {string} params.versionId - Version snapshot ID
|
|
205
|
+
* @returns {Promise<Object>} Full version row including content
|
|
206
|
+
*/
|
|
207
|
+
async getArticleVersion({ id, versionId }) {
|
|
208
|
+
this.sdk.validateParams(
|
|
209
|
+
{ id, versionId },
|
|
210
|
+
{
|
|
211
|
+
id: { type: 'string', required: true },
|
|
212
|
+
versionId: { type: 'string', required: true },
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
const result = await internalRequest(
|
|
217
|
+
this.sdk,
|
|
218
|
+
`/knowledgeBase/articles/${id}/versions/${versionId}`,
|
|
219
|
+
'GET',
|
|
220
|
+
);
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Restore a KB article's content to a prior version snapshot.
|
|
226
|
+
* Snapshots the article's current content as a new version before
|
|
227
|
+
* overwriting it, then reprocesses if the article is published.
|
|
228
|
+
*
|
|
229
|
+
* @param {Object} params
|
|
230
|
+
* @param {string} params.id - Article ID
|
|
231
|
+
* @param {string} params.versionId - Version snapshot ID to restore
|
|
232
|
+
* @returns {Promise<Object>} Updated article record
|
|
233
|
+
*/
|
|
234
|
+
async restoreArticleVersion({ id, versionId }) {
|
|
235
|
+
this.sdk.validateParams(
|
|
236
|
+
{ id, versionId },
|
|
237
|
+
{
|
|
238
|
+
id: { type: 'string', required: true },
|
|
239
|
+
versionId: { type: 'string', required: true },
|
|
240
|
+
},
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const result = await internalRequest(
|
|
244
|
+
this.sdk,
|
|
245
|
+
`/knowledgeBase/articles/${id}/versions/${versionId}/restore`,
|
|
246
|
+
'POST',
|
|
247
|
+
);
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
250
|
+
|
|
176
251
|
/**
|
|
177
252
|
* Get analytics for a knowledge base
|
|
178
253
|
*
|
|
@@ -211,28 +211,38 @@ export class ParticipantService {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* Swap task ownership between the current owner and a joined helper.
|
|
214
|
+
* Swap task ownership between the current owner and a joined helper. When
|
|
215
|
+
* the helper has no access to the task's queue, this chains: it creates a
|
|
216
|
+
* new task in the helper's queue and makes them its owner. If `queueId` is
|
|
217
|
+
* omitted and the helper has access to more than one queue, the server
|
|
218
|
+
* responds 409 with `{ needsQueue: true, queues }` — retry with a chosen
|
|
219
|
+
* `queueId`.
|
|
215
220
|
*
|
|
216
221
|
* @param {Object} options - Options
|
|
217
222
|
* @param {string} options.taskId - Task ID
|
|
218
223
|
* @param {string} options.participantId - The helper participant taking/giving control
|
|
219
224
|
* @param {string} options.action - 'give' | 'take'
|
|
220
|
-
* @
|
|
225
|
+
* @param {string} [options.queueId] - Target queue for a cross-queue control chain (only relevant when the helper lacks access to the task's own queue)
|
|
226
|
+
* @returns {Promise<Object>} { taskId, workerId } for a same-queue swap; { taskId, newTaskId, workerId } for a cross-queue chain
|
|
221
227
|
*
|
|
222
228
|
* @example
|
|
223
229
|
* await sdk.taskRouter.participants.control({ taskId: 'task_123', participantId: 'tp_456', action: 'give' });
|
|
230
|
+
* @example
|
|
231
|
+
* await sdk.taskRouter.participants.control({ taskId: 'task_123', participantId: 'tp_456', action: 'take', queueId: 'queue_789' });
|
|
224
232
|
*/
|
|
225
|
-
async control({ taskId, participantId, action }) {
|
|
233
|
+
async control({ taskId, participantId, action, queueId }) {
|
|
226
234
|
this.sdk.validateParams(
|
|
227
|
-
{ taskId, participantId, action },
|
|
235
|
+
{ taskId, participantId, action, queueId },
|
|
228
236
|
{
|
|
229
237
|
taskId: { type: 'string', required: true },
|
|
230
238
|
participantId: { type: 'string', required: true },
|
|
231
239
|
action: { type: 'string', required: true },
|
|
240
|
+
queueId: { type: 'string', required: false },
|
|
232
241
|
},
|
|
233
242
|
);
|
|
234
243
|
|
|
235
244
|
const params = { body: { action } };
|
|
245
|
+
if (queueId !== undefined) params.body.queueId = queueId;
|
|
236
246
|
|
|
237
247
|
return await internalRequest(
|
|
238
248
|
this.sdk,
|