1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Added user delete method to the console SDK

This commit is contained in:
Eldad Fux 2020-09-19 07:09:18 +03:00
parent 3abfd53d88
commit 626d0d7281
6 changed files with 54 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# Appwrite Web SDK
![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.

View file

@ -1,7 +1,7 @@
# Appwrite Console SDK
![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1)
![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1)
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.

View file

@ -0,0 +1,15 @@
let sdk = new Appwrite();
sdk
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
;
let promise = sdk.users.deleteUser('[USER_ID]');
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});

View file

@ -4750,6 +4750,30 @@
}, payload);
},
/**
* Delete User
*
* Delete a user by its unique ID.
*
* @param {string} userId
* @throws {Error}
* @return {Promise}
*/
deleteUser: function(userId) {
if(userId === undefined) {
throw new Error('Missing required parameter: "userId"');
}
let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId);
let payload = {};
return http
.delete(path, {
'content-type': 'application/json',
}, payload);
},
/**
* Get User Logs
*

View file

@ -415,7 +415,8 @@ let path='/users';let payload={};if(email){payload.email=email}
if(password){payload.password=password}
if(name){payload.name=name}
return http.post(path,{'content-type':'application/json',},payload)},get:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getLogs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},deleteUser:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
let path='/users/{userId}'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.delete(path,{'content-type':'application/json',},payload)},getLogs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
let path='/users/{userId}/logs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},getPrefs:function(userId){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
let path='/users/{userId}/prefs'.replace(new RegExp('{userId}','g'),userId);let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(userId,prefs){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')}

View file

@ -1706,6 +1706,17 @@ declare namespace Appwrite {
*/
get(userId: string): Promise<object>;
/**
* Delete User
*
* Delete a user by its unique ID.
*
* @param {string} userId
* @throws {Error}
* @return {Promise}
*/
deleteUser(userId: string): Promise<object>;
/**
* Get User Logs
*