1
0
Fork 0
mirror of synced 2024-09-10 06:36:39 +12:00
appwrite/app/sdks/node/lib/services/account.js

162 lines
3.5 KiB
JavaScript
Raw Normal View History

2019-06-10 06:13:55 +12:00
const Service = require('../service.js');
class Account extends Service {
/**
* Get Account
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/get.md
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async get() {
let path = '/account';
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Delete Account
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/delete.md
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async delete() {
let path = '/account';
return await this.client.call('delete', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Account Email
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/update-email.md
2019-06-10 06:13:55 +12:00
*
* @param string email
* @param string password
* @throws Exception
* @return {}
*/
async updateEmail(email, password) {
let path = '/account/email';
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'email': email,
'password': password
});
}
/**
* Update Account Name
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/update-name.md
2019-06-10 06:13:55 +12:00
*
* @param string name
* @throws Exception
* @return {}
*/
async updateName(name) {
let path = '/account/name';
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'name': name
});
}
/**
* Update Account Password
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/update-password.md
2019-06-10 06:13:55 +12:00
*
* @param string password
* @param string oldPassword
* @throws Exception
* @return {}
*/
async updatePassword(password, oldPassword) {
let path = '/account/password';
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'password': password,
'old-password': oldPassword
});
}
/**
* Get Account Preferences
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/get-prefs.md
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getPrefs() {
let path = '/account/prefs';
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Update Account Prefs
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/update-prefs.md
2019-06-10 06:13:55 +12:00
*
* @param string prefs
* @throws Exception
* @return {}
*/
async updatePrefs(prefs) {
let path = '/account/prefs';
return await this.client.call('patch', path, {'content-type': 'application/json'},
{
'prefs': prefs
});
}
/**
* Get Account Security Log
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/get-security.md
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getSecurity() {
let path = '/account/security';
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
/**
* Get Account Active Sessions
*
2019-10-09 17:16:38 +13:00
* /docs/references/account/get-sessions.md
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getSessions() {
let path = '/account/sessions';
return await this.client.call('get', path, {'content-type': 'application/json'},
{
});
}
}
module.exports = Account;