@docbrasil/api-systemmanager 1.0.63 → 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 +30 -0
- package/dist/bundle.cjs +30 -0
- package/dist/bundle.mjs +1 -1
- package/doc/api.md +23 -0
- package/package.json +1 -1
package/api/user/user.js
CHANGED
|
@@ -252,6 +252,36 @@ class User {
|
|
|
252
252
|
throw ex;
|
|
253
253
|
}
|
|
254
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
|
+
}
|
|
255
285
|
}
|
|
256
286
|
|
|
257
287
|
export default User;
|
package/dist/bundle.cjs
CHANGED
|
@@ -1903,6 +1903,36 @@ class User {
|
|
|
1903
1903
|
throw ex;
|
|
1904
1904
|
}
|
|
1905
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
|
+
}
|
|
1906
1936
|
}
|
|
1907
1937
|
|
|
1908
1938
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|