@unboundcx/sdk 4.13.62 → 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.62",
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
  *