@docbrasil/api-systemmanager 1.1.88 → 1.1.89

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.
@@ -245,6 +245,89 @@ class AISession {
245
245
  throw ex;
246
246
  }
247
247
  }
248
+ /**
249
+ * @author Myndware <augusto.pissarra@myndware.com>
250
+ * @description Add documents to an existing agent session.
251
+ * The agent will handle the documentIds accordingly.
252
+ * @param {object} params Parameters
253
+ * @param {string} params.sessionId The session ID
254
+ * @param {array<string>} params.documentIds Array of document IDs to add
255
+ * @param {string} authorization Authorization token
256
+ * @return {Promise<object>} data The result from the agent
257
+ * @public
258
+ * @async
259
+ * @example
260
+ *
261
+ * const API = require('@docbrasil/api-systemmanager');
262
+ * const api = new API();
263
+ * const authorization = '...';
264
+ * const params = {
265
+ * sessionId: 'session-abc-123',
266
+ * documentIds: ['doc-123', 'doc-456']
267
+ * };
268
+ * const retData = await api.ai.sessions.addDocuments(params, authorization);
269
+ */
270
+ async addDocuments(params, authorization) {
271
+ const self = this;
272
+
273
+ try {
274
+ Joi.assert(params, Joi.object().required().error(new Error('params is required')));
275
+ Joi.assert(params.sessionId, Joi.string().required().error(new Error('sessionId is required')));
276
+ Joi.assert(params.documentIds, Joi.array().items(Joi.string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
277
+
278
+ const { sessionId, documentIds } = params;
279
+
280
+ const client = self.parent.dispatch.getAkamaiClient();
281
+ const apiCall = client
282
+ .post(`/agents/${sessionId}/documents/add`, { documentIds }, self._setHeader(authorization));
283
+
284
+ return self._returnData(await apiCall);
285
+ } catch (ex) {
286
+ throw ex;
287
+ }
288
+ }
289
+
290
+ /**
291
+ * @author Myndware <augusto.pissarra@myndware.com>
292
+ * @description Remove documents from an existing agent session.
293
+ * The agent will handle the documentIds accordingly.
294
+ * @param {object} params Parameters
295
+ * @param {string} params.sessionId The session ID
296
+ * @param {array<string>} params.documentIds Array of document IDs to remove
297
+ * @param {string} authorization Authorization token
298
+ * @return {Promise<object>} data The result from the agent
299
+ * @public
300
+ * @async
301
+ * @example
302
+ *
303
+ * const API = require('@docbrasil/api-systemmanager');
304
+ * const api = new API();
305
+ * const authorization = '...';
306
+ * const params = {
307
+ * sessionId: 'session-abc-123',
308
+ * documentIds: ['doc-123', 'doc-456']
309
+ * };
310
+ * const retData = await api.ai.sessions.removeDocuments(params, authorization);
311
+ */
312
+ async removeDocuments(params, authorization) {
313
+ const self = this;
314
+
315
+ try {
316
+ Joi.assert(params, Joi.object().required().error(new Error('params is required')));
317
+ Joi.assert(params.sessionId, Joi.string().required().error(new Error('sessionId is required')));
318
+ Joi.assert(params.documentIds, Joi.array().items(Joi.string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
319
+
320
+ const { sessionId, documentIds } = params;
321
+
322
+ const client = self.parent.dispatch.getAkamaiClient();
323
+ const apiCall = client
324
+ .post(`/agents/${sessionId}/documents/remove`, { documentIds }, self._setHeader(authorization));
325
+
326
+ return self._returnData(await apiCall);
327
+ } catch (ex) {
328
+ throw ex;
329
+ }
330
+ }
248
331
  }
249
332
 
250
333
  export default AISession;
package/dist/bundle.cjs CHANGED
@@ -16409,6 +16409,89 @@ class AISession {
16409
16409
  throw ex;
16410
16410
  }
16411
16411
  }
16412
+ /**
16413
+ * @author Myndware <augusto.pissarra@myndware.com>
16414
+ * @description Add documents to an existing agent session.
16415
+ * The agent will handle the documentIds accordingly.
16416
+ * @param {object} params Parameters
16417
+ * @param {string} params.sessionId The session ID
16418
+ * @param {array<string>} params.documentIds Array of document IDs to add
16419
+ * @param {string} authorization Authorization token
16420
+ * @return {Promise<object>} data The result from the agent
16421
+ * @public
16422
+ * @async
16423
+ * @example
16424
+ *
16425
+ * const API = require('@docbrasil/api-systemmanager');
16426
+ * const api = new API();
16427
+ * const authorization = '...';
16428
+ * const params = {
16429
+ * sessionId: 'session-abc-123',
16430
+ * documentIds: ['doc-123', 'doc-456']
16431
+ * };
16432
+ * const retData = await api.ai.sessions.addDocuments(params, authorization);
16433
+ */
16434
+ async addDocuments(params, authorization) {
16435
+ const self = this;
16436
+
16437
+ try {
16438
+ Joi__default["default"].assert(params, Joi__default["default"].object().required().error(new Error('params is required')));
16439
+ Joi__default["default"].assert(params.sessionId, Joi__default["default"].string().required().error(new Error('sessionId is required')));
16440
+ Joi__default["default"].assert(params.documentIds, Joi__default["default"].array().items(Joi__default["default"].string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
16441
+
16442
+ const { sessionId, documentIds } = params;
16443
+
16444
+ const client = self.parent.dispatch.getAkamaiClient();
16445
+ const apiCall = client
16446
+ .post(`/agents/${sessionId}/documents/add`, { documentIds }, self._setHeader(authorization));
16447
+
16448
+ return self._returnData(await apiCall);
16449
+ } catch (ex) {
16450
+ throw ex;
16451
+ }
16452
+ }
16453
+
16454
+ /**
16455
+ * @author Myndware <augusto.pissarra@myndware.com>
16456
+ * @description Remove documents from an existing agent session.
16457
+ * The agent will handle the documentIds accordingly.
16458
+ * @param {object} params Parameters
16459
+ * @param {string} params.sessionId The session ID
16460
+ * @param {array<string>} params.documentIds Array of document IDs to remove
16461
+ * @param {string} authorization Authorization token
16462
+ * @return {Promise<object>} data The result from the agent
16463
+ * @public
16464
+ * @async
16465
+ * @example
16466
+ *
16467
+ * const API = require('@docbrasil/api-systemmanager');
16468
+ * const api = new API();
16469
+ * const authorization = '...';
16470
+ * const params = {
16471
+ * sessionId: 'session-abc-123',
16472
+ * documentIds: ['doc-123', 'doc-456']
16473
+ * };
16474
+ * const retData = await api.ai.sessions.removeDocuments(params, authorization);
16475
+ */
16476
+ async removeDocuments(params, authorization) {
16477
+ const self = this;
16478
+
16479
+ try {
16480
+ Joi__default["default"].assert(params, Joi__default["default"].object().required().error(new Error('params is required')));
16481
+ Joi__default["default"].assert(params.sessionId, Joi__default["default"].string().required().error(new Error('sessionId is required')));
16482
+ Joi__default["default"].assert(params.documentIds, Joi__default["default"].array().items(Joi__default["default"].string()).min(1).required().error(new Error('documentIds is required and must be a non-empty array')));
16483
+
16484
+ const { sessionId, documentIds } = params;
16485
+
16486
+ const client = self.parent.dispatch.getAkamaiClient();
16487
+ const apiCall = client
16488
+ .post(`/agents/${sessionId}/documents/remove`, { documentIds }, self._setHeader(authorization));
16489
+
16490
+ return self._returnData(await apiCall);
16491
+ } catch (ex) {
16492
+ throw ex;
16493
+ }
16494
+ }
16412
16495
  }
16413
16496
 
16414
16497
  /**