@docbrasil/api-systemmanager 1.1.16 → 1.1.18

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
@@ -1805,13 +1805,13 @@ Class for user registration in a user
1805
1805
  **Kind**: global class
1806
1806
 
1807
1807
  * [Help](#Help)
1808
- * [.getTopics(session)](#Help+getTopics)
1808
+ * [.getTopics(filter, session)](#Help+getTopics)
1809
1809
  * [.get(params, session)](#Help+get) ⇒ <code>promise</code>
1810
1810
 
1811
1811
  <a name="Help+getTopics"></a>
1812
1812
 
1813
- ### help.getTopics(session)
1814
- get heps topics
1813
+ ### help.getTopics(filter, session)
1814
+ get help topics for a user. Either by organizaiton product or by supplied filter. But always only the user language.
1815
1815
 
1816
1816
  **Kind**: instance method of [<code>Help</code>](#Help)
1817
1817
  **Access**: public
@@ -1819,6 +1819,7 @@ get heps topics
1819
1819
 
1820
1820
  | Param | Type | Description |
1821
1821
  | --- | --- | --- |
1822
+ | filter | <code>object</code> | a filter to apply. if empty, null or undefined, than we will bring the help topics by organizaiton product. |
1822
1823
  | session | <code>string</code> | JWT token |
1823
1824
 
1824
1825
  **Example**
@@ -1826,7 +1827,7 @@ get heps topics
1826
1827
  const API = require('@docbrasil/api-systemmanager');
1827
1828
  const api = new API();
1828
1829
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1829
- await api.user.help.getTopics(session);
1830
+ await api.user.help.getTopics({}, session);
1830
1831
  ```
1831
1832
  <a name="Help+get"></a>
1832
1833
 
package/docs/Help.html CHANGED
@@ -402,7 +402,7 @@
402
402
  <p class="tag-source">
403
403
  <a href="user_help.js.html" class="button">View Source</a>
404
404
  <span>
405
- <a href="user_help.js.html">user/help.js</a>, <a href="user_help.js.html#line94">line 94</a>
405
+ <a href="user_help.js.html">user/help.js</a>, <a href="user_help.js.html#line99">line 99</a>
406
406
  </span>
407
407
  </p>
408
408
 
@@ -479,7 +479,7 @@ await api.user.help.get(params, session);</code></pre>
479
479
 
480
480
  <span class="code-name">
481
481
 
482
- getTopics<span class="signature">(session)</span><span class="type-signature"></span>
482
+ getTopics<span class="signature">(filter, session)</span><span class="type-signature"></span>
483
483
 
484
484
  </span>
485
485
  </h4>
@@ -488,7 +488,7 @@ await api.user.help.get(params, session);</code></pre>
488
488
 
489
489
 
490
490
  <div class="description">
491
- get heps topics
491
+ get help topics for a user. Either by organizaiton product or by supplied filter. But always only the user language.
492
492
  </div>
493
493
 
494
494
 
@@ -524,6 +524,31 @@ await api.user.help.get(params, session);</code></pre>
524
524
 
525
525
 
526
526
 
527
+ <tr class="deep-level-0">
528
+
529
+ <td class="name"><code>filter</code></td>
530
+
531
+
532
+ <td class="type">
533
+
534
+
535
+ <code class="param-type">object</code>
536
+
537
+
538
+
539
+ </td>
540
+
541
+
542
+
543
+
544
+
545
+ <td class="description last">a filter to apply. if empty, null or undefined, than we will bring the help topics by organizaiton product.</td>
546
+ </tr>
547
+
548
+
549
+
550
+
551
+
527
552
  <tr class="deep-level-0">
528
553
 
529
554
  <td class="name"><code>session</code></td>
@@ -597,7 +622,7 @@ await api.user.help.get(params, session);</code></pre>
597
622
  <p class="tag-source">
598
623
  <a href="user_help.js.html" class="button">View Source</a>
599
624
  <span>
600
- <a href="user_help.js.html">user/help.js</a>, <a href="user_help.js.html#line63">line 63</a>
625
+ <a href="user_help.js.html">user/help.js</a>, <a href="user_help.js.html#line64">line 64</a>
601
626
  </span>
602
627
  </p>
603
628
 
@@ -629,7 +654,7 @@ await api.user.help.get(params, session);</code></pre>
629
654
  <pre class="prettyprint"><code>const API = require('@docbrasil/api-systemmanager');
630
655
  const api = new API();
631
656
  const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
632
- await api.user.help.getTopics(session);</code></pre>
657
+ await api.user.help.getTopics({}, session);</code></pre>
633
658
 
634
659
 
635
660
 
@@ -880,8 +880,8 @@ class Documents {
880
880
  Joi.assert(session, Joi.string().required(), 'Session token JWT');
881
881
 
882
882
  const {query, orgId} = params;
883
- const params = new URLSearchParams(query);
884
- const queryString = params.toString();
883
+ const searchParams = new URLSearchParams(query);
884
+ const queryString = searchParams.toString();
885
885
  const apiCall = self._client.get(`/organizations/${orgId}/documents/search?${queryString}`, self._setHeader(session));
886
886
 
887
887
  return self._returnData(await apiCall);
@@ -136,7 +136,8 @@ class Help {
136
136
 
137
137
  /**
138
138
  * @author Augusto Pissarra &lt;abernardo.br@gmail.com>
139
- * @description get heps topics
139
+ * @description get help topics for a user. Either by organizaiton product or by supplied filter. But always only the user language.
140
+ * @param {object} filter a filter to apply. if empty, null or undefined, than we will bring the help topics by organizaiton product.
140
141
  * @param {string} session JWT token
141
142
  * @public
142
143
  * @async
@@ -145,15 +146,19 @@ class Help {
145
146
  * const API = require('@docbrasil/api-systemmanager');
146
147
  * const api = new API();
147
148
  * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
148
- * await api.user.help.getTopics(session);
149
+ * await api.user.help.getTopics({}, session);
149
150
  */
150
- async getTopics(session) {
151
+ async getTopics(filter = {}, session) {
151
152
  const self = this;
152
153
 
153
154
  try {
154
155
  Joi.assert(session, Joi.string().required(), 'SM session (JWT) to call API');
155
-
156
- const apiCall = self._client.get('/help/topics', self._setHeader(session));
156
+ let query = '';
157
+ if(!_.isEmpty(filter)) {
158
+ const queryFilter = JSON.stringify(filter);
159
+ query = `?filter=${queryFilter.toString('base64')}`;
160
+ }
161
+ const apiCall = self._client.get(`/help/topics${query}`, self._setHeader(session));
157
162
  return self._returnData(await apiCall);
158
163
  } catch (ex) {
159
164
  throw ex;
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.1.16",
4
+ "version": "1.1.18",
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",
@@ -0,0 +1,18 @@
1
+ function doQuery(query) {
2
+ const searchParams = new URLSearchParams(query);
3
+ const queryString = searchParams.toString();
4
+ return queryString;
5
+ }
6
+
7
+ console.log(doQuery({
8
+ p: 200,
9
+ i: 1,
10
+ s: 'Mais recentes',
11
+ as: '',
12
+ m: 'w',
13
+ ai: '111',
14
+ di: '222',
15
+ ix: JSON.stringify([
16
+ ['extraUserid', '333', '=', 'text']
17
+ ])
18
+ }));