infogare-api.js
Advanced tools
Comparing version 1.0.20 to 1.0.21
{ | ||
"name": "infogare-api.js", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"main": "src/core/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -89,2 +89,27 @@ const User = require('./User'); | ||
/** | ||
* Add a folder to a user | ||
* @param {string} uid The UID of the user | ||
* @param {string} folder The folder name | ||
* @returns Nothing | ||
*/ | ||
async addFolder(uid, folder) { | ||
if (!uid) { | ||
throw new Error('uid is required'); | ||
} | ||
if (!folder) { | ||
throw new Error('folder is required'); | ||
} | ||
if (!this.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
const response = await fetch(`${App.apiEndpoint}/user/${uid}/folders?appId=${this.appId}`, { | ||
method: 'POST', | ||
body: JSON.stringify({ folder: folder }), | ||
}); | ||
if (!response.ok) { | ||
throw new UserException(response, 'add folder ' + folder); | ||
} | ||
} | ||
/** | ||
* Get user public profile | ||
@@ -91,0 +116,0 @@ * @param {string} uid The UID of the user |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28585
923
14