update scripts

This commit is contained in:
Damodar Lohani
2021-07-29 14:06:52 +05:45
parent 68ea2e2ab1
commit 6cd4f044e9
7 changed files with 242 additions and 62 deletions
+139 -17
View File
@@ -929,15 +929,19 @@
* Create a new Collection.
*
* @param {string} collectionId
* @param {string} name
* @param {string} read
* @param {string} write
* @throws {AppwriteException}
* @returns {Promise}
*/
createCollection: (collectionId, read, write) => __awaiter(this, void 0, void 0, function* () {
createCollection: (collectionId, name, read, write) => __awaiter(this, void 0, void 0, function* () {
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof read === 'undefined') {
throw new AppwriteException('Missing required parameter: "read"');
}
@@ -949,6 +953,9 @@
if (typeof collectionId !== 'undefined') {
payload['collectionId'] = collectionId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
@@ -987,17 +994,24 @@
* Update a collection by its unique ID.
*
* @param {string} collectionId
* @param {string} name
* @param {string} read
* @param {string} write
* @throws {AppwriteException}
* @returns {Promise}
*/
updateCollection: (collectionId, read, write) => __awaiter(this, void 0, void 0, function* () {
updateCollection: (collectionId, name, read, write) => __awaiter(this, void 0, void 0, function* () {
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
@@ -1481,6 +1495,7 @@
* with access to execute the function using the client API.
*
* @param {string} functionId
* @param {string} name
* @param {string[]} execute
* @param {string} runtime
* @param {object} vars
@@ -1490,10 +1505,13 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
create: (functionId, execute, runtime, vars, events, schedule, timeout) => __awaiter(this, void 0, void 0, function* () {
create: (functionId, name, execute, runtime, vars, events, schedule, timeout) => __awaiter(this, void 0, void 0, function* () {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof execute === 'undefined') {
throw new AppwriteException('Missing required parameter: "execute"');
}
@@ -1505,6 +1523,9 @@
if (typeof functionId !== 'undefined') {
payload['functionId'] = functionId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof execute !== 'undefined') {
payload['execute'] = execute;
}
@@ -2257,6 +2278,7 @@
*
*
* @param {string} projectId
* @param {string} name
* @param {string} teamId
* @param {string} description
* @param {string} logo
@@ -2270,10 +2292,13 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
create: (projectId, teamId, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) => __awaiter(this, void 0, void 0, function* () {
create: (projectId, name, teamId, description, logo, url, legalName, legalCountry, legalState, legalCity, legalAddress, legalTaxId) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
@@ -2282,6 +2307,9 @@
if (typeof projectId !== 'undefined') {
payload['projectId'] = projectId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof teamId !== 'undefined') {
payload['teamId'] = teamId;
}
@@ -2626,17 +2654,21 @@
*
* @param {string} projectId
* @param {string} keyId
* @param {string} name
* @param {string[]} scopes
* @throws {AppwriteException}
* @returns {Promise}
*/
createKey: (projectId, keyId, scopes) => __awaiter(this, void 0, void 0, function* () {
createKey: (projectId, keyId, name, scopes) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof keyId === 'undefined') {
throw new AppwriteException('Missing required parameter: "keyId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof scopes === 'undefined') {
throw new AppwriteException('Missing required parameter: "scopes"');
}
@@ -2645,6 +2677,9 @@
if (typeof keyId !== 'undefined') {
payload['keyId'] = keyId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof scopes !== 'undefined') {
payload['scopes'] = scopes;
}
@@ -2682,22 +2717,29 @@
*
* @param {string} projectId
* @param {string} keyId
* @param {string} name
* @param {string[]} scopes
* @throws {AppwriteException}
* @returns {Promise}
*/
updateKey: (projectId, keyId, scopes) => __awaiter(this, void 0, void 0, function* () {
updateKey: (projectId, keyId, name, scopes) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof keyId === 'undefined') {
throw new AppwriteException('Missing required parameter: "keyId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof scopes === 'undefined') {
throw new AppwriteException('Missing required parameter: "scopes"');
}
let path = '/projects/{projectId}/keys/{keyId}'.replace('{projectId}', projectId).replace('{keyId}', keyId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof scopes !== 'undefined') {
payload['scopes'] = scopes;
}
@@ -2789,13 +2831,14 @@
* @param {string} projectId
* @param {string} platformId
* @param {string} type
* @param {string} name
* @param {string} key
* @param {string} store
* @param {string} hostname
* @throws {AppwriteException}
* @returns {Promise}
*/
createPlatform: (projectId, platformId, type, key, store, hostname) => __awaiter(this, void 0, void 0, function* () {
createPlatform: (projectId, platformId, type, name, key, store, hostname) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
@@ -2805,6 +2848,9 @@
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/projects/{projectId}/platforms'.replace('{projectId}', projectId);
let payload = {};
if (typeof platformId !== 'undefined') {
@@ -2813,6 +2859,9 @@
if (typeof type !== 'undefined') {
payload['type'] = type;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof key !== 'undefined') {
payload['key'] = key;
}
@@ -2856,21 +2905,28 @@
*
* @param {string} projectId
* @param {string} platformId
* @param {string} name
* @param {string} key
* @param {string} store
* @param {string} hostname
* @throws {AppwriteException}
* @returns {Promise}
*/
updatePlatform: (projectId, platformId, key, store, hostname) => __awaiter(this, void 0, void 0, function* () {
updatePlatform: (projectId, platformId, name, key, store, hostname) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof platformId === 'undefined') {
throw new AppwriteException('Missing required parameter: "platformId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/projects/{projectId}/platforms/{platformId}'.replace('{projectId}', projectId).replace('{platformId}', platformId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof key !== 'undefined') {
payload['key'] = key;
}
@@ -2933,6 +2989,7 @@
*
* @param {string} projectId
* @param {string} taskId
* @param {string} name
* @param {string} status
* @param {string} schedule
* @param {boolean} security
@@ -2944,13 +3001,16 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
createTask: (projectId, taskId, status, schedule, security, httpMethod, httpUrl, httpHeaders, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
createTask: (projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof taskId === 'undefined') {
throw new AppwriteException('Missing required parameter: "taskId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof status === 'undefined') {
throw new AppwriteException('Missing required parameter: "status"');
}
@@ -2971,6 +3031,9 @@
if (typeof taskId !== 'undefined') {
payload['taskId'] = taskId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof status !== 'undefined') {
payload['status'] = status;
}
@@ -3029,6 +3092,7 @@
*
* @param {string} projectId
* @param {string} taskId
* @param {string} name
* @param {string} status
* @param {string} schedule
* @param {boolean} security
@@ -3040,13 +3104,16 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
updateTask: (projectId, taskId, status, schedule, security, httpMethod, httpUrl, httpHeaders, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
updateTask: (projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof taskId === 'undefined') {
throw new AppwriteException('Missing required parameter: "taskId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof status === 'undefined') {
throw new AppwriteException('Missing required parameter: "status"');
}
@@ -3064,6 +3131,9 @@
}
let path = '/projects/{projectId}/tasks/{taskId}'.replace('{projectId}', projectId).replace('{taskId}', taskId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof status !== 'undefined') {
payload['status'] = status;
}
@@ -3164,6 +3234,7 @@
*
* @param {string} projectId
* @param {string} webhookId
* @param {string} name
* @param {string[]} events
* @param {string} url
* @param {boolean} security
@@ -3172,13 +3243,16 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
createWebhook: (projectId, webhookId, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
createWebhook: (projectId, webhookId, name, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof webhookId === 'undefined') {
throw new AppwriteException('Missing required parameter: "webhookId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof events === 'undefined') {
throw new AppwriteException('Missing required parameter: "events"');
}
@@ -3193,6 +3267,9 @@
if (typeof webhookId !== 'undefined') {
payload['webhookId'] = webhookId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof events !== 'undefined') {
payload['events'] = events;
}
@@ -3242,6 +3319,7 @@
*
* @param {string} projectId
* @param {string} webhookId
* @param {string} name
* @param {string[]} events
* @param {string} url
* @param {boolean} security
@@ -3250,13 +3328,16 @@
* @throws {AppwriteException}
* @returns {Promise}
*/
updateWebhook: (projectId, webhookId, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
updateWebhook: (projectId, webhookId, name, events, url, security, httpUser, httpPass) => __awaiter(this, void 0, void 0, function* () {
if (typeof projectId === 'undefined') {
throw new AppwriteException('Missing required parameter: "projectId"');
}
if (typeof webhookId === 'undefined') {
throw new AppwriteException('Missing required parameter: "webhookId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof events === 'undefined') {
throw new AppwriteException('Missing required parameter: "events"');
}
@@ -3268,6 +3349,9 @@
}
let path = '/projects/{projectId}/webhooks/{webhookId}'.replace('{projectId}', projectId).replace('{webhookId}', webhookId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof events !== 'undefined') {
payload['events'] = events;
}
@@ -3627,19 +3711,26 @@
* project.
*
* @param {string} teamId
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise}
*/
create: (teamId, roles) => __awaiter(this, void 0, void 0, function* () {
create: (teamId, name, roles) => __awaiter(this, void 0, void 0, function* () {
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/teams';
let payload = {};
if (typeof teamId !== 'undefined') {
payload['teamId'] = teamId;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof roles !== 'undefined') {
payload['roles'] = roles;
}
@@ -3669,6 +3760,34 @@
'content-type': 'application/json',
}, payload);
}),
/**
* Update Team
*
* Update a team by its unique ID. Only team owners have write access for this
* resource.
*
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise}
*/
update: (teamId, name) => __awaiter(this, void 0, void 0, function* () {
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/teams/{teamId}'.replace('{teamId}', teamId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
const uri = new URL(this.config.endpoint + path);
return yield this.call('put', uri, {
'content-type': 'application/json',
}, payload);
}),
/**
* Delete Team
*
@@ -3730,14 +3849,17 @@
/**
* Create Team Membership
*
* Use this endpoint to invite a new member to join your team. An email with a
* link to join the team will be sent to the new member email address if the
* member doesn't exist in the project it will be created automatically.
* Use this endpoint to invite a new member to join your team. If initiated
* from Client SDK, an email with a link to join the team will be sent to the
* new member's email address if the member doesn't exist in the project it
* will be created automatically. If initiated from server side SDKs, new
* member will automatically be added to the team.
*
* Use the 'URL' parameter to redirect the user from the invitation email back
* to your app. When the user is redirected, use the [Update Team Membership
* Status](/docs/client/teams#teamsUpdateMembershipStatus) endpoint to allow
* the user to accept the invitation to the team.
* the user to accept the invitation to the team. While calling from side
* SDKs the redirect url can be empty string.
*
* Please note that in order to avoid a [Redirect
* Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
+1 -1
View File
@@ -23,7 +23,7 @@
)
); //convert to JSON string
console.projects.create(formData["projectId"], team).then(
console.projects.create(formData["projectId"], formData["name"], team).then(
function(project) {
alerts.remove(loaderId);
//router.change("/console/home?project=" + project["$id"]);