@docbrasil/api-systemmanager 1.1.50 → 1.1.52

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/api/dispatch.js CHANGED
@@ -11,9 +11,9 @@ class Dispatch {
11
11
  Joi.assert(options.parent, Joi.object().required());
12
12
 
13
13
  const self = this;
14
+ self._cache = options.parent.options.cache;
15
+ self._forceCache = options.parent.options.forceCache;
14
16
  self.parent = options.parent;
15
- self._cache = self.parent.options.cache;
16
- self._forceCache = self.parent.options.forceCache;
17
17
  self._client = Axios.create({baseURL: self.parent.options.uri, withCredentials: true});
18
18
 
19
19
  // Add request interceptor for offline handling
@@ -120,6 +120,45 @@ class Application {
120
120
  throw ex;
121
121
  }
122
122
  }
123
+
124
+ /**
125
+ * @author Myndware <augusto.pissarra@myndware.com>
126
+ * @description Gets the application and pages to start the cache process
127
+ * @param {object} params
128
+ * @param {object} params.orgId the orgId of this application
129
+ * @param {object} params.appId the application id
130
+ * @param {string} session Session, token JWT
131
+ * @returns {promise}
132
+ * @public
133
+ * @example
134
+ *
135
+ * const API = require('@docbrasil/api-systemmanager');
136
+ * const api = new API();
137
+ * const params = {
138
+ * orgId: '55e4a3bd6be6b45210833f78',
139
+ * appId: '55e4a3bd6be6b45210833fae',
140
+ * };
141
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
142
+ * await api.user.application.getCache(params, session);
143
+ */
144
+ async getCache(params, session) {
145
+ const self = this;
146
+
147
+ try {
148
+ Joi.assert(params, Joi.object().required(), 'Params to get task');
149
+ Joi.assert(params.orgId, Joi.string().required(), 'The organizations id');
150
+ Joi.assert(params.appId, Joi.string().required(), 'The application id');
151
+ Joi.assert(session, Joi.string().required(), 'Session token JWT');
152
+
153
+ const { orgId, appId} = params;
154
+ const apiCall = self._client
155
+ .get(`/organizations/${orgId}/applications/${appId}/cache`, self._setHeader(session));
156
+
157
+ return self._returnData(await apiCall);
158
+ } catch (ex) {
159
+ throw ex;
160
+ }
161
+ }
123
162
  }
124
163
 
125
164
  export default Application;
package/dist/bundle.cjs CHANGED
@@ -23,9 +23,9 @@ class Dispatch {
23
23
  Joi__default["default"].assert(options.parent, Joi__default["default"].object().required());
24
24
 
25
25
  const self = this;
26
+ self._cache = options.parent.options.cache;
27
+ self._forceCache = options.parent.options.forceCache;
26
28
  self.parent = options.parent;
27
- self._cache = self.parent.options.cache;
28
- self._forceCache = self.parent.options.forceCache;
29
29
  self._client = Axios__default["default"].create({baseURL: self.parent.options.uri, withCredentials: true});
30
30
 
31
31
  // Add request interceptor for offline handling
@@ -11416,6 +11416,45 @@ class Application {
11416
11416
  throw ex;
11417
11417
  }
11418
11418
  }
11419
+
11420
+ /**
11421
+ * @author Myndware <augusto.pissarra@myndware.com>
11422
+ * @description Gets the application and pages to start the cache process
11423
+ * @param {object} params
11424
+ * @param {object} params.orgId the orgId of this application
11425
+ * @param {object} params.appId the application id
11426
+ * @param {string} session Session, token JWT
11427
+ * @returns {promise}
11428
+ * @public
11429
+ * @example
11430
+ *
11431
+ * const API = require('@docbrasil/api-systemmanager');
11432
+ * const api = new API();
11433
+ * const params = {
11434
+ * orgId: '55e4a3bd6be6b45210833f78',
11435
+ * appId: '55e4a3bd6be6b45210833fae',
11436
+ * };
11437
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
11438
+ * await api.user.application.getCache(params, session);
11439
+ */
11440
+ async getCache(params, session) {
11441
+ const self = this;
11442
+
11443
+ try {
11444
+ Joi__default["default"].assert(params, Joi__default["default"].object().required(), 'Params to get task');
11445
+ Joi__default["default"].assert(params.orgId, Joi__default["default"].string().required(), 'The organizations id');
11446
+ Joi__default["default"].assert(params.appId, Joi__default["default"].string().required(), 'The application id');
11447
+ Joi__default["default"].assert(session, Joi__default["default"].string().required(), 'Session token JWT');
11448
+
11449
+ const { orgId, appId} = params;
11450
+ const apiCall = self._client
11451
+ .get(`/organizations/${orgId}/applications/${appId}/cache`, self._setHeader(session));
11452
+
11453
+ return self._returnData(await apiCall);
11454
+ } catch (ex) {
11455
+ throw ex;
11456
+ }
11457
+ }
11419
11458
  }
11420
11459
 
11421
11460
  /**