@docbrasil/api-systemmanager 1.0.112 → 1.0.113

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.
@@ -345,6 +345,47 @@ class Process {
345
345
  throw ex;
346
346
  }
347
347
  }
348
+
349
+ /**
350
+ * @author CloudBrasil <abernardo.br@gmail.com>
351
+ * @description Method to get Process Docs
352
+ * @param {object} params Params to get process docs
353
+ * @param {string} params.orgProcessId Organization Process Id
354
+ * @param {string} params.processId Process Id
355
+ * @param {string} params.orgId Organization id (_id database)
356
+ * @param {string} session Session, token JWT
357
+ * @returns {promise} returned data from the get process docs
358
+ * @returns {array<object>} Docs returned from process
359
+ * @public
360
+ * @example
361
+ *
362
+ * const API = require('@docbrasil/api-systemmanager');
363
+ * const api = new API();
364
+ * const params = {
365
+ * orgProcessId: '55e4a3bd6be6b45210833fae',
366
+ * processId: '55e4a3bd6be6b45210833fae',
367
+ * orgId: '55e4a3bd6be6b45210833fae',
368
+ * };
369
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
370
+ * const retSearch = await api.user.process.processDocs(params, session);
371
+ */
372
+ async processDocs(params, session) {
373
+ const self = this;
374
+
375
+ try {
376
+ Joi.assert(params, Joi.object().required(), 'Params to get process docs');
377
+ Joi.assert(params.orgProcessId, Joi.string().required(), 'Organization Process Id');
378
+ Joi.assert(params.processId, Joi.string().required(), 'Process Id');
379
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
380
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
381
+
382
+ const {orgProcessId, processId, orgId} = params;
383
+ const apiCall = self._client.get(`/organizations/${orgId}/orgprocess/${orgProcessId}/process/${processId}/documents`, self._setHeader(session));
384
+ return self._returnData(await apiCall);
385
+ } catch (ex) {
386
+ throw ex;
387
+ }
388
+ }
348
389
  }
349
390
 
350
391
  export default Process;
package/dist/bundle.cjs CHANGED
@@ -1846,6 +1846,47 @@ class Process {
1846
1846
  throw ex;
1847
1847
  }
1848
1848
  }
1849
+
1850
+ /**
1851
+ * @author CloudBrasil <abernardo.br@gmail.com>
1852
+ * @description Method to get Process Docs
1853
+ * @param {object} params Params to get process docs
1854
+ * @param {string} params.orgProcessId Organization Process Id
1855
+ * @param {string} params.processId Process Id
1856
+ * @param {string} params.orgId Organization id (_id database)
1857
+ * @param {string} session Session, token JWT
1858
+ * @returns {promise} returned data from the get process docs
1859
+ * @returns {array<object>} Docs returned from process
1860
+ * @public
1861
+ * @example
1862
+ *
1863
+ * const API = require('@docbrasil/api-systemmanager');
1864
+ * const api = new API();
1865
+ * const params = {
1866
+ * orgProcessId: '55e4a3bd6be6b45210833fae',
1867
+ * processId: '55e4a3bd6be6b45210833fae',
1868
+ * orgId: '55e4a3bd6be6b45210833fae',
1869
+ * };
1870
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1871
+ * const retSearch = await api.user.process.processDocs(params, session);
1872
+ */
1873
+ async processDocs(params, session) {
1874
+ const self = this;
1875
+
1876
+ try {
1877
+ Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to get process docs');
1878
+ Joi__default["default"].assert(params.orgProcessId, Joi__default["default"].string().required(), 'Organization Process Id');
1879
+ Joi__default["default"].assert(params.processId, Joi__default["default"].string().required(), 'Process Id');
1880
+ Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'Organization id (_id database)');
1881
+ Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
1882
+
1883
+ const {orgProcessId, processId, orgId} = params;
1884
+ const apiCall = self._client.get(`/organizations/${orgId}/orgprocess/${orgProcessId}/process/${processId}/documents`, self._setHeader(session));
1885
+ return self._returnData(await apiCall);
1886
+ } catch (ex) {
1887
+ throw ex;
1888
+ }
1889
+ }
1849
1890
  }
1850
1891
 
1851
1892
  /**