@docbrasil/api-systemmanager 1.0.113 → 1.0.114

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/doc/api.md CHANGED
@@ -1954,6 +1954,7 @@ Class for process, permission user
1954
1954
  * [.exportStatusData(params, session)](#Process+exportStatusData)
1955
1955
  * [.exportProcessData(params, session)](#Process+exportProcessData)
1956
1956
  * [.processDocs(params, session)](#Process+processDocs) ⇒ <code>promise</code> \| <code>array.&lt;object&gt;</code>
1957
+ * [.downloadDocs(params, session)](#Process+downloadDocs) ⇒ <code>promise</code>
1957
1958
 
1958
1959
  <a name="Process+start"></a>
1959
1960
 
@@ -2179,6 +2180,38 @@ const params = {
2179
2180
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2180
2181
  const retSearch = await api.user.process.processDocs(params, session);
2181
2182
  ```
2183
+ <a name="Process+downloadDocs"></a>
2184
+
2185
+ ### process.downloadDocs(params, session) ⇒ <code>promise</code>
2186
+ Method to download the process documents
2187
+
2188
+ **Kind**: instance method of [<code>Process</code>](#Process)
2189
+ **Returns**: <code>promise</code> - returned data from the search
2190
+ **Access**: public
2191
+ **Author**: CloudBrasil <abernardo.br@gmail.com>
2192
+
2193
+ | Param | Type | Description |
2194
+ | --- | --- | --- |
2195
+ | params | <code>object</code> | Params to download the process documents |
2196
+ | params.orgId | <code>string</code> | Organization id (_id database) |
2197
+ | params.type | <code>string</code> | Document Type |
2198
+ | params.docIds | <code>array</code> | Documents Ids |
2199
+ | params.footer | <code>string</code> | Documents Footer |
2200
+ | session | <code>string</code> | Session, token JWT |
2201
+
2202
+ **Example**
2203
+ ```js
2204
+ const API = require('@docbrasil/api-systemmanager');
2205
+ const api = new API();
2206
+ const params = {
2207
+ orgId: '55e4a3bd6be6b45210833fae',
2208
+ type: 'Docs',
2209
+ docIds: ['55e4a3bd6be6b45210833fae'],
2210
+ footer: 'Documento - {page} de {pages}'
2211
+ };
2212
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
2213
+ const result = await api.user.process.downloadDocs(params, session);
2214
+ ```
2182
2215
  <a name="Register"></a>
2183
2216
 
2184
2217
  ## Register
package/docs/Process.html CHANGED
@@ -224,6 +224,326 @@
224
224
 
225
225
 
226
226
 
227
+ <h4 class="name" id="downloadDocs">
228
+ <a class="href-link" href="#downloadDocs">#</a>
229
+
230
+
231
+ <span class='tag'>async</span>
232
+
233
+
234
+ <span class="code-name">
235
+
236
+ downloadDocs<span class="signature">(params, session)</span><span class="type-signature"> &rarr; {promise}</span>
237
+
238
+ </span>
239
+ </h4>
240
+
241
+
242
+
243
+
244
+ <div class="description">
245
+ Method to download the process documents
246
+ </div>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+ <h5>Parameters:</h5>
258
+
259
+ <div class="table-container">
260
+ <table class="params table">
261
+ <thead>
262
+ <tr>
263
+
264
+ <th>Name</th>
265
+
266
+
267
+ <th>Type</th>
268
+
269
+
270
+
271
+
272
+
273
+ <th class="last">Description</th>
274
+ </tr>
275
+ </thead>
276
+
277
+ <tbody>
278
+
279
+
280
+
281
+ <tr class="deep-level-0">
282
+
283
+ <td class="name"><code>params</code></td>
284
+
285
+
286
+ <td class="type">
287
+
288
+
289
+ <code class="param-type">object</code>
290
+
291
+
292
+
293
+ </td>
294
+
295
+
296
+
297
+
298
+
299
+ <td class="description last">Params to download the process documents</td>
300
+ </tr>
301
+
302
+
303
+
304
+
305
+ <tr class="deep-level-1">
306
+
307
+ <td class="name"><code>orgId</code></td>
308
+
309
+
310
+ <td class="type">
311
+
312
+
313
+ <code class="param-type">string</code>
314
+
315
+
316
+
317
+ </td>
318
+
319
+
320
+
321
+
322
+
323
+ <td class="description last">Organization id (_id database)</td>
324
+ </tr>
325
+
326
+
327
+
328
+ <tr class="deep-level-1">
329
+
330
+ <td class="name"><code>type</code></td>
331
+
332
+
333
+ <td class="type">
334
+
335
+
336
+ <code class="param-type">string</code>
337
+
338
+
339
+
340
+ </td>
341
+
342
+
343
+
344
+
345
+
346
+ <td class="description last">Document Type</td>
347
+ </tr>
348
+
349
+
350
+
351
+ <tr class="deep-level-1">
352
+
353
+ <td class="name"><code>docIds</code></td>
354
+
355
+
356
+ <td class="type">
357
+
358
+
359
+ <code class="param-type">array</code>
360
+
361
+
362
+
363
+ </td>
364
+
365
+
366
+
367
+
368
+
369
+ <td class="description last">Documents Ids</td>
370
+ </tr>
371
+
372
+
373
+
374
+ <tr class="deep-level-1">
375
+
376
+ <td class="name"><code>footer</code></td>
377
+
378
+
379
+ <td class="type">
380
+
381
+
382
+ <code class="param-type">string</code>
383
+
384
+
385
+
386
+ </td>
387
+
388
+
389
+
390
+
391
+
392
+ <td class="description last">Documents Footer</td>
393
+ </tr>
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+ <tr class="deep-level-0">
402
+
403
+ <td class="name"><code>session</code></td>
404
+
405
+
406
+ <td class="type">
407
+
408
+
409
+ <code class="param-type">string</code>
410
+
411
+
412
+
413
+ </td>
414
+
415
+
416
+
417
+
418
+
419
+ <td class="description last">Session, token JWT</td>
420
+ </tr>
421
+
422
+
423
+
424
+ </tbody>
425
+ </table>
426
+ </div>
427
+
428
+
429
+
430
+
431
+
432
+ <dl class="details">
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+ <dt class="tag-author">Author:</dt>
452
+ <dd class="tag-author">
453
+ <ul>
454
+ <li><a href="mailto:abernardo.br@gmail.com">CloudBrasil</a></li>
455
+ </ul>
456
+ </dd>
457
+
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+ <p class="tag-source">
472
+ <a href="user_process.js.html" class="button">View Source</a>
473
+ <span>
474
+ <a href="user_process.js.html">user/process.js</a>, <a href="user_process.js.html#line414">line 414</a>
475
+ </span>
476
+ </p>
477
+
478
+ </dl>
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+ <div class='columns method-parameter'>
498
+ <div class="column is-2"><label>Returns:</label></div>
499
+ <div class="column is-10">
500
+
501
+
502
+
503
+ <div class="columns">
504
+
505
+ <div class='param-desc column is-7'>returned data from the search</div>
506
+
507
+
508
+ <div class='column is-5 has-text-left'>
509
+ <label>Type: </label>
510
+
511
+ <code class="param-type">promise</code>
512
+
513
+
514
+ </div>
515
+
516
+ </div>
517
+
518
+
519
+ </div>
520
+ </div>
521
+
522
+
523
+
524
+
525
+ <h5>Example</h5>
526
+
527
+
528
+ <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
529
+ const api = new API();
530
+ const params = {
531
+ orgId: '55e4a3bd6be6b45210833fae',
532
+ type: 'Docs',
533
+ docIds: ['55e4a3bd6be6b45210833fae'],
534
+ footer: 'Documento - {page} de {pages}'
535
+ };
536
+ const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
537
+ const result = await api.user.process.downloadDocs(params, session);</code></pre>
538
+
539
+
540
+
541
+ </div>
542
+
543
+ <div class="member">
544
+
545
+
546
+
227
547
  <h4 class="name" id="exportProcessData">
228
548
  <a class="href-link" href="#exportProcessData">#</a>
229
549
 
@@ -473,6 +473,59 @@ class Process {
473
473
  throw ex;
474
474
  }
475
475
  }
476
+
477
+ /**
478
+ * @author CloudBrasil &lt;abernardo.br@gmail.com>
479
+ * @description Method to download the process documents
480
+ * @param {object} params Params to download the process documents
481
+ * @param {string} params.orgId Organization id (_id database)
482
+ * @param {string} params.type Document Type
483
+ * @param {array} params.docIds Documents Ids
484
+ * @param {string} params.footer Documents Footer
485
+ * @param {string} session Session, token JWT
486
+ * @returns {promise} returned data from the search
487
+ * @public
488
+ * @example
489
+ *
490
+ * const API = require('@docbrasil/api-systemmanager');
491
+ * const api = new API();
492
+ * const params = {
493
+ * orgId: '55e4a3bd6be6b45210833fae',
494
+ * type: 'Docs',
495
+ * docIds: ['55e4a3bd6be6b45210833fae'],
496
+ * footer: 'Documento - {page} de {pages}'
497
+ * };
498
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
499
+ * const result = await api.user.process.downloadDocs(params, session);
500
+ */
501
+ async downloadDocs(params, session) {
502
+ const self = this;
503
+
504
+ try {
505
+ Joi.assert(params, Joi.object().required(), 'Params to download the process documents');
506
+ Joi.assert(params.orgId, Joi.string().required(), 'Organization id (_id database)');
507
+ Joi.assert(params.type, Joi.string().required(), 'Document Type');
508
+ Joi.assert(params.docIds, Joi.array().required(), 'Document Ids');
509
+ Joi.assert(params.footer, Joi.string(), 'Documents Footer');
510
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
511
+
512
+ const {orgId, type, docIds, footer} = params;
513
+ const data = {
514
+ docIds
515
+ };
516
+
517
+ if (footer) {
518
+ data.footer = footer
519
+ }
520
+
521
+ const apiCall = self._client
522
+ .post(`/organizations/${orgId}/documents/download/${type}`, data, self._setHeader(session));
523
+
524
+ return self._returnData(await apiCall);
525
+ } catch (ex) {
526
+ throw ex;
527
+ }
528
+ }
476
529
  }
477
530
 
478
531
  export default Process;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@docbrasil/api-systemmanager",
3
3
  "description": "Module API System Manager",
4
- "version": "1.0.113",
4
+ "version": "1.0.114",
5
5
  "scripts": {
6
6
  "htmldoc": "rm -rf docs && jsdoc api/** -d docs -t ./node_modules/better-docs",
7
7
  "doc": "rm -rf doc && mkdir doc && jsdoc2md api/**/* api/* > doc/api.md",