@docbrasil/api-systemmanager 1.0.61 → 1.0.64

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/user/user.js CHANGED
@@ -119,6 +119,80 @@ class User {
119
119
  }
120
120
  }
121
121
 
122
+ /**
123
+ * @author CloudBrasil <abernardo.br@gmail.com>
124
+ * @description Remove the signature of user by session
125
+ * @param {string} session Is token JWT of user NOT allow SU
126
+ * @return {Promise}
127
+ * @public
128
+ * @async
129
+ * @example
130
+ *
131
+ * const API = require('@docbrasil/api-systemmanager');
132
+ * const api = new API();
133
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
134
+ * await api.user.profile.removeSignature(session);
135
+ */
136
+ async removeSignature(session) {
137
+ const self = this;
138
+
139
+ try {
140
+ Joi.assert(session, Joi.string().required());
141
+
142
+ const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
143
+ return self._returnData(await apiCall);
144
+ } catch (ex) {
145
+ throw ex;
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @author CloudBrasil <abernardo.br@gmail.com>
151
+ * @description Sava a new signature of user by session
152
+ * @param {object} data The signature data to save
153
+ * @param {string} data.type CURSIVE or HANDWRITE
154
+ * @param {string} data.file CURSIVE the <fontname>:<name used on the signature>
155
+ * HANDWRITE the base 64 image (w/o the mime a base prefix)
156
+ * @param {string} session Is token JWT of user NOT allow SU
157
+ * @return {Promise}
158
+ * @public
159
+ * @async
160
+ * @example
161
+ *
162
+ * const API = require('@docbrasil/api-systemmanager');
163
+ * const api = new API();
164
+ * const data = {
165
+ * type: 'CURSIVE',
166
+ * file: 'allura:Mary John Heart'
167
+ * };
168
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
169
+ * await api.user.profile.saveSignature(data, session);
170
+ *
171
+ * const API = require('@docbrasil/api-systemmanager');
172
+ * const api = new API();
173
+ * const data = {
174
+ * type: 'HANDWRITE',
175
+ * file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
176
+ * };
177
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
178
+ * await api.user.profile.saveSignature(session);
179
+ */
180
+ async saveSignature(data, session) {
181
+ const self = this;
182
+
183
+ try {
184
+ Joi.assert(data, Joi.object().required());
185
+ Joi.assert(data.type, Joi.string().required());
186
+ Joi.assert(data.file, Joi.string().required());
187
+ Joi.assert(session, Joi.string().required());
188
+
189
+ const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
190
+ return self._returnData(await apiCall);
191
+ } catch (ex) {
192
+ throw ex;
193
+ }
194
+ }
195
+
122
196
  /**
123
197
  * @author CloudBrasil <abernardo.br@gmail.com>
124
198
  * @description Update a user profile by id
@@ -178,6 +252,36 @@ class User {
178
252
  throw ex;
179
253
  }
180
254
  }
255
+
256
+ /**
257
+ * @author CloudBrasil <abernardo.br@gmail.com>
258
+ * @description Change a user's organization
259
+ * @param {string} id Organization id
260
+ * @param {string} session Is token JWT of user NOT allow SU
261
+ * @return {Promise}
262
+ * @public
263
+ * @async
264
+ * @example
265
+ *
266
+ * const API = require('@docbrasil/api-systemmanager');
267
+ * const api = new API();
268
+ * const id = '616eccaaa9360a05293b10fe';
269
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
270
+ * await api.user.changeOrganization.updateAvatar(id, session);
271
+ */
272
+ async changeOrganization(id, session) {
273
+ const self = this;
274
+
275
+ try {
276
+ Joi.assert(id, Joi.string().required());
277
+ Joi.assert(session, Joi.string().required());
278
+
279
+ const apiCall = self._client.put(`/organizations/${id}/change`, self._setHeader(session));
280
+ return self._returnData(await apiCall);
281
+ } catch (ex) {
282
+ throw ex;
283
+ }
284
+ }
181
285
  }
182
286
 
183
287
  export default User;
package/dist/bundle.cjs CHANGED
@@ -650,6 +650,7 @@ class Documents {
650
650
  ocrDocumentBackend: ___default["default"].get(params, 'ocrDocumentBackend', false),
651
651
  bytes: ___default["default"].get(params, 'bytes'),
652
652
  docAreaPermission: ___default["default"].get(params, 'docAreaPermission', {}),
653
+ docTypeFields: ___default["default"].get(params, 'docTypeFields', []), // {"extraId": userId},
653
654
  docTypeFieldsData: ___default["default"].get(params, 'docTypeFieldsData', {}), // {"extraId": userId},
654
655
  signedUrl: ___default["default"].get(params, 'signedUrl', ''),
655
656
  urlType: ___default["default"].get(params, 'urlType', 'S3'),
@@ -1769,6 +1770,80 @@ class User {
1769
1770
  }
1770
1771
  }
1771
1772
 
1773
+ /**
1774
+ * @author CloudBrasil <abernardo.br@gmail.com>
1775
+ * @description Remove the signature of user by session
1776
+ * @param {string} session Is token JWT of user NOT allow SU
1777
+ * @return {Promise}
1778
+ * @public
1779
+ * @async
1780
+ * @example
1781
+ *
1782
+ * const API = require('@docbrasil/api-systemmanager');
1783
+ * const api = new API();
1784
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1785
+ * await api.user.profile.removeSignature(session);
1786
+ */
1787
+ async removeSignature(session) {
1788
+ const self = this;
1789
+
1790
+ try {
1791
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
1792
+
1793
+ const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
1794
+ return self._returnData(await apiCall);
1795
+ } catch (ex) {
1796
+ throw ex;
1797
+ }
1798
+ }
1799
+
1800
+ /**
1801
+ * @author CloudBrasil <abernardo.br@gmail.com>
1802
+ * @description Sava a new signature of user by session
1803
+ * @param {object} data The signature data to save
1804
+ * @param {string} data.type CURSIVE or HANDWRITE
1805
+ * @param {string} data.file CURSIVE the <fontname>:<name used on the signature>
1806
+ * HANDWRITE the base 64 image (w/o the mime a base prefix)
1807
+ * @param {string} session Is token JWT of user NOT allow SU
1808
+ * @return {Promise}
1809
+ * @public
1810
+ * @async
1811
+ * @example
1812
+ *
1813
+ * const API = require('@docbrasil/api-systemmanager');
1814
+ * const api = new API();
1815
+ * const data = {
1816
+ * type: 'CURSIVE',
1817
+ * file: 'allura:Mary John Heart'
1818
+ * };
1819
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1820
+ * await api.user.profile.saveSignature(data, session);
1821
+ *
1822
+ * const API = require('@docbrasil/api-systemmanager');
1823
+ * const api = new API();
1824
+ * const data = {
1825
+ * type: 'HANDWRITE',
1826
+ * file: 'iVBORw0KGgoAAAANSUhEUgAAAj...'
1827
+ * };
1828
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1829
+ * await api.user.profile.saveSignature(session);
1830
+ */
1831
+ async saveSignature(data, session) {
1832
+ const self = this;
1833
+
1834
+ try {
1835
+ Joi__default["default"].assert(data, Joi__default["default"].object().required());
1836
+ Joi__default["default"].assert(data.type, Joi__default["default"].string().required());
1837
+ Joi__default["default"].assert(data.file, Joi__default["default"].string().required());
1838
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
1839
+
1840
+ const apiCall = self._client.delete(`/users/signature`, self._setHeader(session));
1841
+ return self._returnData(await apiCall);
1842
+ } catch (ex) {
1843
+ throw ex;
1844
+ }
1845
+ }
1846
+
1772
1847
  /**
1773
1848
  * @author CloudBrasil <abernardo.br@gmail.com>
1774
1849
  * @description Update a user profile by id
@@ -1828,6 +1903,36 @@ class User {
1828
1903
  throw ex;
1829
1904
  }
1830
1905
  }
1906
+
1907
+ /**
1908
+ * @author CloudBrasil <abernardo.br@gmail.com>
1909
+ * @description Change a user's organization
1910
+ * @param {string} id Organization id
1911
+ * @param {string} session Is token JWT of user NOT allow SU
1912
+ * @return {Promise}
1913
+ * @public
1914
+ * @async
1915
+ * @example
1916
+ *
1917
+ * const API = require('@docbrasil/api-systemmanager');
1918
+ * const api = new API();
1919
+ * const id = '616eccaaa9360a05293b10fe';
1920
+ * const session = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...';
1921
+ * await api.user.changeOrganization.updateAvatar(id, session);
1922
+ */
1923
+ async changeOrganization(id, session) {
1924
+ const self = this;
1925
+
1926
+ try {
1927
+ Joi__default["default"].assert(id, Joi__default["default"].string().required());
1928
+ Joi__default["default"].assert(session, Joi__default["default"].string().required());
1929
+
1930
+ const apiCall = self._client.put(`/organizations/${id}/change`, self._setHeader(session));
1931
+ return self._returnData(await apiCall);
1932
+ } catch (ex) {
1933
+ throw ex;
1934
+ }
1935
+ }
1831
1936
  }
1832
1937
 
1833
1938
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};