🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

node-appwrite

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-appwrite - npm Package Compare versions

Comparing version

to
2.2.4

@@ -12,3 +12,3 @@ const URL = require('url').URL;

'content-type': '',
'x-sdk-version': 'appwrite:nodejs:2.2.3',
'x-sdk-version': 'appwrite:nodejs:2.2.4',
'X-Appwrite-Response-Format' : '0.8.0',

@@ -24,8 +24,8 @@ };

*
* @param string value
* @param {string} project
*
* @return self
*/
setProject(value) {
this.addHeader('X-Appwrite-Project', value);
setProject(project) {
this.addHeader('X-Appwrite-Project', project);

@@ -40,8 +40,8 @@ return this;

*
* @param string value
* @param {string} key
*
* @return self
*/
setKey(value) {
this.addHeader('X-Appwrite-Key', value);
setKey(key) {
this.addHeader('X-Appwrite-Key', key);

@@ -56,8 +56,8 @@ return this;

*
* @param string value
* @param {string} jwt
*
* @return self
*/
setJWT(value) {
this.addHeader('X-Appwrite-JWT', value);
setJWT(jwt) {
this.addHeader('X-Appwrite-JWT', jwt);

@@ -70,8 +70,8 @@ return this;

*
* @param string value
* @param {string} locale
*
* @return self
*/
setLocale(value) {
this.addHeader('X-Appwrite-Locale', value);
setLocale(locale) {
this.addHeader('X-Appwrite-Locale', locale);

@@ -81,4 +81,7 @@ return this;

/***
* @param bool status
/**
* Set self signed.
*
* @param {bool} status
*
* @return this

@@ -92,4 +95,7 @@ */

/***
* @param endpoint
/**
* Set endpoint.
*
* @param {string} endpoint
*
* @return this

@@ -105,4 +111,4 @@ */

/**
* @param key string
* @param value string
* @param {string} key
* @param {string} value
*/

@@ -192,2 +198,2 @@ addHeader(key, value) {

module.exports = Client;
module.exports = Client;
const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -10,13 +11,12 @@ class Account extends Service {

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async get() {
let path = '/account';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -33,13 +33,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async delete() {
let path = '/account';
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -57,17 +56,30 @@

*
* @param string email
* @param string password
* @throws Exception
* @return {}
* @param {string} email
* @param {string} password
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateEmail(email, password) {
if (typeof email === 'undefined') {
throw new AppwriteException('Missing required parameter: "email"');
}
if (typeof password === 'undefined') {
throw new AppwriteException('Missing required parameter: "password"');
}
let path = '/account/email';
let payload = {};
if (typeof email !== 'undefined') {
payload['email'] = email;
}
if (typeof password !== 'undefined') {
payload['password'] = password;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'email': email,
'password': password
});
'content-type': 'application/json',
}, payload);
}

@@ -81,13 +93,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getLogs() {
let path = '/account/logs';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -100,15 +111,21 @@

*
* @param string name
* @throws Exception
* @return {}
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateName(name) {
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/account/name';
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'name': name
});
'content-type': 'application/json',
}, payload);
}

@@ -123,17 +140,26 @@

*
* @param string password
* @param string oldPassword
* @throws Exception
* @return {}
* @param {string} password
* @param {string} oldPassword
* @throws {AppwriteException}
* @returns {Promise}
*/
async updatePassword(password, oldPassword = '') {
async updatePassword(password, oldPassword) {
if (typeof password === 'undefined') {
throw new AppwriteException('Missing required parameter: "password"');
}
let path = '/account/password';
let payload = {};
if (typeof password !== 'undefined') {
payload['password'] = password;
}
if (typeof oldPassword !== 'undefined') {
payload['oldPassword'] = oldPassword;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'password': password,
'oldPassword': oldPassword
});
'content-type': 'application/json',
}, payload);
}

@@ -146,13 +172,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getPrefs() {
let path = '/account/prefs';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -166,15 +191,21 @@

*
* @param object prefs
* @throws Exception
* @return {}
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise}
*/
async updatePrefs(prefs) {
if (typeof prefs === 'undefined') {
throw new AppwriteException('Missing required parameter: "prefs"');
}
let path = '/account/prefs';
let payload = {};
if (typeof prefs !== 'undefined') {
payload['prefs'] = prefs;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'prefs': prefs
});
'content-type': 'application/json',
}, payload);
}

@@ -194,17 +225,30 @@

*
* @param string email
* @param string url
* @throws Exception
* @return {}
* @param {string} email
* @param {string} url
* @throws {AppwriteException}
* @returns {Promise}
*/
async createRecovery(email, url) {
if (typeof email === 'undefined') {
throw new AppwriteException('Missing required parameter: "email"');
}
if (typeof url === 'undefined') {
throw new AppwriteException('Missing required parameter: "url"');
}
let path = '/account/recovery';
let payload = {};
if (typeof email !== 'undefined') {
payload['email'] = email;
}
if (typeof url !== 'undefined') {
payload['url'] = url;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'email': email,
'url': url
});
'content-type': 'application/json',
}, payload);
}

@@ -225,21 +269,48 @@

*
* @param string userId
* @param string secret
* @param string password
* @param string passwordAgain
* @throws Exception
* @return {}
* @param {string} userId
* @param {string} secret
* @param {string} password
* @param {string} passwordAgain
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateRecovery(userId, secret, password, passwordAgain) {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof secret === 'undefined') {
throw new AppwriteException('Missing required parameter: "secret"');
}
if (typeof password === 'undefined') {
throw new AppwriteException('Missing required parameter: "password"');
}
if (typeof passwordAgain === 'undefined') {
throw new AppwriteException('Missing required parameter: "passwordAgain"');
}
let path = '/account/recovery';
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
}
if (typeof secret !== 'undefined') {
payload['secret'] = secret;
}
if (typeof password !== 'undefined') {
payload['password'] = password;
}
if (typeof passwordAgain !== 'undefined') {
payload['passwordAgain'] = passwordAgain;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'userId': userId,
'secret': secret,
'password': password,
'passwordAgain': passwordAgain
});
'content-type': 'application/json',
}, payload);
}

@@ -253,13 +324,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getSessions() {
let path = '/account/sessions';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -273,13 +343,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteSessions() {
let path = '/account/sessions';
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -294,14 +363,17 @@

*
* @param string sessionId
* @throws Exception
* @return {}
* @param {string} sessionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteSession(sessionId) {
let path = '/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}', 'g'), sessionId);
if (typeof sessionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "sessionId"');
}
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -328,15 +400,21 @@

*
* @param string url
* @throws Exception
* @return {}
* @param {string} url
* @throws {AppwriteException}
* @returns {Promise}
*/
async createVerification(url) {
if (typeof url === 'undefined') {
throw new AppwriteException('Missing required parameter: "url"');
}
let path = '/account/verification';
let payload = {};
if (typeof url !== 'undefined') {
payload['url'] = url;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'url': url
});
'content-type': 'application/json',
}, payload);
}

@@ -352,17 +430,30 @@

*
* @param string userId
* @param string secret
* @throws Exception
* @return {}
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateVerification(userId, secret) {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof secret === 'undefined') {
throw new AppwriteException('Missing required parameter: "secret"');
}
let path = '/account/verification';
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
}
if (typeof secret !== 'undefined') {
payload['secret'] = secret;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'userId': userId,
'secret': secret
});
'content-type': 'application/json',
}, payload);
}

@@ -369,0 +460,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -13,20 +14,32 @@ class Avatars extends Service {

*
* @param string code
* @param number width
* @param number height
* @param number quality
* @throws Exception
* @return {}
* @param {string} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise}
*/
async getBrowser(code, width = 100, height = 100, quality = 100) {
let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code);
async getBrowser(code, width, height, quality) {
if (typeof code === 'undefined') {
throw new AppwriteException('Missing required parameter: "code"');
}
let path = '/avatars/browsers/{code}'.replace('{code}', code);
let payload = {};
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof quality !== 'undefined') {
payload['quality'] = quality;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'width': width,
'height': height,
'quality': quality
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -41,20 +54,32 @@

*
* @param string code
* @param number width
* @param number height
* @param number quality
* @throws Exception
* @return {}
* @param {string} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCreditCard(code, width = 100, height = 100, quality = 100) {
let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code);
async getCreditCard(code, width, height, quality) {
if (typeof code === 'undefined') {
throw new AppwriteException('Missing required parameter: "code"');
}
let path = '/avatars/credit-cards/{code}'.replace('{code}', code);
let payload = {};
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof quality !== 'undefined') {
payload['quality'] = quality;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'width': width,
'height': height,
'quality': quality
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -69,15 +94,21 @@

*
* @param string url
* @throws Exception
* @return {}
* @param {string} url
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFavicon(url) {
if (typeof url === 'undefined') {
throw new AppwriteException('Missing required parameter: "url"');
}
let path = '/avatars/favicon';
let payload = {};
if (typeof url !== 'undefined') {
payload['url'] = url;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'url': url
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -92,20 +123,32 @@

*
* @param string code
* @param number width
* @param number height
* @param number quality
* @throws Exception
* @return {}
* @param {string} code
* @param {number} width
* @param {number} height
* @param {number} quality
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFlag(code, width = 100, height = 100, quality = 100) {
let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code);
async getFlag(code, width, height, quality) {
if (typeof code === 'undefined') {
throw new AppwriteException('Missing required parameter: "code"');
}
let path = '/avatars/flags/{code}'.replace('{code}', code);
let payload = {};
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof quality !== 'undefined') {
payload['quality'] = quality;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'width': width,
'height': height,
'quality': quality
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -121,19 +164,31 @@

*
* @param string url
* @param number width
* @param number height
* @throws Exception
* @return {}
* @param {string} url
* @param {number} width
* @param {number} height
* @throws {AppwriteException}
* @returns {Promise}
*/
async getImage(url, width = 400, height = 400) {
async getImage(url, width, height) {
if (typeof url === 'undefined') {
throw new AppwriteException('Missing required parameter: "url"');
}
let path = '/avatars/image';
let payload = {};
if (typeof url !== 'undefined') {
payload['url'] = url;
}
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'url': url,
'width': width,
'height': height
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -155,23 +210,37 @@

*
* @param string name
* @param number width
* @param number height
* @param string color
* @param string background
* @throws Exception
* @return {}
* @param {string} name
* @param {number} width
* @param {number} height
* @param {string} color
* @param {string} background
* @throws {AppwriteException}
* @returns {Promise}
*/
async getInitials(name = '', width = 500, height = 500, color = '', background = '') {
async getInitials(name, width, height, color, background) {
let path = '/avatars/initials';
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof color !== 'undefined') {
payload['color'] = color;
}
if (typeof background !== 'undefined') {
payload['background'] = background;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'name': name,
'width': width,
'height': height,
'color': color,
'background': background
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -185,21 +254,36 @@

*
* @param string text
* @param number size
* @param number margin
* @param boolean download
* @throws Exception
* @return {}
* @param {string} text
* @param {number} size
* @param {number} margin
* @param {boolean} download
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQR(text, size = 400, margin = 1, download = false) {
async getQR(text, size, margin, download) {
if (typeof text === 'undefined') {
throw new AppwriteException('Missing required parameter: "text"');
}
let path = '/avatars/qr';
let payload = {};
if (typeof text !== 'undefined') {
payload['text'] = text;
}
if (typeof size !== 'undefined') {
payload['size'] = size;
}
if (typeof margin !== 'undefined') {
payload['margin'] = margin;
}
if (typeof download !== 'undefined') {
payload['download'] = download;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'text': text,
'size': size,
'margin': margin,
'download': download
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -206,0 +290,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -13,21 +14,32 @@ class Database extends Service {

*
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async listCollections(search = '', limit = 25, offset = 0, orderType = 'ASC') {
async listCollections(search, limit, offset, orderType) {
let path = '/database/collections';
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -40,21 +52,48 @@

*
* @param string name
* @param string[] read
* @param string[] write
* @param string[] rules
* @throws Exception
* @return {}
* @param {string} name
* @param {string[]} read
* @param {string[]} write
* @param {string[]} rules
* @throws {AppwriteException}
* @returns {Promise}
*/
async createCollection(name, read, write, rules) {
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof read === 'undefined') {
throw new AppwriteException('Missing required parameter: "read"');
}
if (typeof write === 'undefined') {
throw new AppwriteException('Missing required parameter: "write"');
}
if (typeof rules === 'undefined') {
throw new AppwriteException('Missing required parameter: "rules"');
}
let path = '/database/collections';
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
if (typeof rules !== 'undefined') {
payload['rules'] = rules;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'name': name,
'read': read,
'write': write,
'rules': rules
});
'content-type': 'application/json',
}, payload);
}

@@ -68,14 +107,17 @@

*
* @param string collectionId
* @throws Exception
* @return {}
* @param {string} collectionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCollection(collectionId) {
let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId);
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -88,22 +130,41 @@

*
* @param string collectionId
* @param string name
* @param string[] read
* @param string[] write
* @param string[] rules
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {string} name
* @param {string[]} read
* @param {string[]} write
* @param {string[]} rules
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateCollection(collectionId, name, read = [], write = [], rules = []) {
let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId);
async updateCollection(collectionId, name, read, write, rules) {
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;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
if (typeof rules !== 'undefined') {
payload['rules'] = rules;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'name': name,
'read': read,
'write': write,
'rules': rules
});
'content-type': 'application/json',
}, payload);
}

@@ -117,14 +178,17 @@

*
* @param string collectionId
* @throws Exception
* @return {}
* @param {string} collectionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteCollection(collectionId) {
let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId);
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
let path = '/database/collections/{collectionId}'.replace('{collectionId}', collectionId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -140,28 +204,52 @@

*
* @param string collectionId
* @param string[] filters
* @param number limit
* @param number offset
* @param string orderField
* @param string orderType
* @param string orderCast
* @param string search
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {string[]} filters
* @param {number} limit
* @param {number} offset
* @param {string} orderField
* @param {string} orderType
* @param {string} orderCast
* @param {string} search
* @throws {AppwriteException}
* @returns {Promise}
*/
async listDocuments(collectionId, filters = [], limit = 25, offset = 0, orderField = '', orderType = 'ASC', orderCast = 'string', search = '') {
let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId);
async listDocuments(collectionId, filters, limit, offset, orderField, orderType, orderCast, search) {
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
let path = '/database/collections/{collectionId}/documents'.replace('{collectionId}', collectionId);
let payload = {};
if (typeof filters !== 'undefined') {
payload['filters'] = filters;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderField !== 'undefined') {
payload['orderField'] = orderField;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
if (typeof orderCast !== 'undefined') {
payload['orderCast'] = orderCast;
}
if (typeof search !== 'undefined') {
payload['search'] = search;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'filters': filters,
'limit': limit,
'offset': offset,
'orderField': orderField,
'orderType': orderType,
'orderCast': orderCast,
'search': search
});
'content-type': 'application/json',
}, payload);
}

@@ -177,26 +265,51 @@

*
* @param string collectionId
* @param object data
* @param string[] read
* @param string[] write
* @param string parentDocument
* @param string parentProperty
* @param string parentPropertyType
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {object} data
* @param {string[]} read
* @param {string[]} write
* @param {string} parentDocument
* @param {string} parentProperty
* @param {string} parentPropertyType
* @throws {AppwriteException}
* @returns {Promise}
*/
async createDocument(collectionId, data, read = [], write = [], parentDocument = '', parentProperty = '', parentPropertyType = 'assign') {
let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId);
async createDocument(collectionId, data, read, write, parentDocument, parentProperty, parentPropertyType) {
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof data === 'undefined') {
throw new AppwriteException('Missing required parameter: "data"');
}
let path = '/database/collections/{collectionId}/documents'.replace('{collectionId}', collectionId);
let payload = {};
if (typeof data !== 'undefined') {
payload['data'] = data;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
if (typeof parentDocument !== 'undefined') {
payload['parentDocument'] = parentDocument;
}
if (typeof parentProperty !== 'undefined') {
payload['parentProperty'] = parentProperty;
}
if (typeof parentPropertyType !== 'undefined') {
payload['parentPropertyType'] = parentPropertyType;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'data': data,
'read': read,
'write': write,
'parentDocument': parentDocument,
'parentProperty': parentProperty,
'parentPropertyType': parentPropertyType
});
'content-type': 'application/json',
}, payload);
}

@@ -210,15 +323,22 @@

*
* @param string collectionId
* @param string documentId
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {string} documentId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getDocument(collectionId, documentId) {
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId);
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof documentId === 'undefined') {
throw new AppwriteException('Missing required parameter: "documentId"');
}
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -232,21 +352,41 @@

*
* @param string collectionId
* @param string documentId
* @param object data
* @param string[] read
* @param string[] write
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {string} documentId
* @param {object} data
* @param {string[]} read
* @param {string[]} write
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateDocument(collectionId, documentId, data, read = [], write = []) {
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId);
async updateDocument(collectionId, documentId, data, read, write) {
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof documentId === 'undefined') {
throw new AppwriteException('Missing required parameter: "documentId"');
}
if (typeof data === 'undefined') {
throw new AppwriteException('Missing required parameter: "data"');
}
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
let payload = {};
if (typeof data !== 'undefined') {
payload['data'] = data;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'data': data,
'read': read,
'write': write
});
'content-type': 'application/json',
}, payload);
}

@@ -261,15 +401,22 @@

*
* @param string collectionId
* @param string documentId
* @throws Exception
* @return {}
* @param {string} collectionId
* @param {string} documentId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteDocument(collectionId, documentId) {
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId);
if (typeof collectionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "collectionId"');
}
if (typeof documentId === 'undefined') {
throw new AppwriteException('Missing required parameter: "documentId"');
}
let path = '/database/collections/{collectionId}/documents/{documentId}'.replace('{collectionId}', collectionId).replace('{documentId}', documentId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -276,0 +423,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -11,21 +12,32 @@ class Functions extends Service {

*
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async list(search = '', limit = 25, offset = 0, orderType = 'ASC') {
async list(search, limit, offset, orderType) {
let path = '/functions';
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -40,27 +52,59 @@

*
* @param string name
* @param string[] execute
* @param string env
* @param object vars
* @param string[] events
* @param string schedule
* @param number timeout
* @throws Exception
* @return {}
* @param {string} name
* @param {string[]} execute
* @param {string} env
* @param {object} vars
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @throws {AppwriteException}
* @returns {Promise}
*/
async create(name, execute, env, vars = {}, events = [], schedule = '', timeout = 15) {
async create(name, execute, env, vars, events, schedule, timeout) {
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
if (typeof execute === 'undefined') {
throw new AppwriteException('Missing required parameter: "execute"');
}
if (typeof env === 'undefined') {
throw new AppwriteException('Missing required parameter: "env"');
}
let path = '/functions';
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof execute !== 'undefined') {
payload['execute'] = execute;
}
if (typeof env !== 'undefined') {
payload['env'] = env;
}
if (typeof vars !== 'undefined') {
payload['vars'] = vars;
}
if (typeof events !== 'undefined') {
payload['events'] = events;
}
if (typeof schedule !== 'undefined') {
payload['schedule'] = schedule;
}
if (typeof timeout !== 'undefined') {
payload['timeout'] = timeout;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'name': name,
'execute': execute,
'env': env,
'vars': vars,
'events': events,
'schedule': schedule,
'timeout': timeout
});
'content-type': 'application/json',
}, payload);
}

@@ -73,14 +117,17 @@

*
* @param string functionId
* @throws Exception
* @return {}
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async get(functionId) {
let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -93,26 +140,55 @@

*
* @param string functionId
* @param string name
* @param string[] execute
* @param object vars
* @param string[] events
* @param string schedule
* @param number timeout
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} name
* @param {string[]} execute
* @param {object} vars
* @param {string[]} events
* @param {string} schedule
* @param {number} timeout
* @throws {AppwriteException}
* @returns {Promise}
*/
async update(functionId, name, execute, vars = {}, events = [], schedule = '', timeout = 15) {
let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId);
async update(functionId, name, execute, vars, events, schedule, timeout) {
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"');
}
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof execute !== 'undefined') {
payload['execute'] = execute;
}
if (typeof vars !== 'undefined') {
payload['vars'] = vars;
}
if (typeof events !== 'undefined') {
payload['events'] = events;
}
if (typeof schedule !== 'undefined') {
payload['schedule'] = schedule;
}
if (typeof timeout !== 'undefined') {
payload['timeout'] = timeout;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'name': name,
'execute': execute,
'vars': vars,
'events': events,
'schedule': schedule,
'timeout': timeout
});
'content-type': 'application/json',
}, payload);
}

@@ -125,14 +201,17 @@

*
* @param string functionId
* @throws Exception
* @return {}
* @param {string} functionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async delete(functionId) {
let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}'.replace('{functionId}', functionId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -148,22 +227,37 @@

*
* @param string functionId
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async listExecutions(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') {
let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId);
async listExecutions(functionId, search, limit, offset, orderType) {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -179,16 +273,22 @@

*
* @param string functionId
* @param string data
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} data
* @throws {AppwriteException}
* @returns {Promise}
*/
async createExecution(functionId, data = '') {
let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId);
async createExecution(functionId, data) {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
let payload = {};
if (typeof data !== 'undefined') {
payload['data'] = data;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'data': data
});
'content-type': 'application/json',
}, payload);
}

@@ -201,15 +301,22 @@

*
* @param string functionId
* @param string executionId
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} executionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getExecution(functionId, executionId) {
let path = '/functions/{functionId}/executions/{executionId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{executionId}', 'g'), executionId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof executionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "executionId"');
}
let path = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -224,16 +331,26 @@

*
* @param string functionId
* @param string tag
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} tag
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateTag(functionId, tag) {
let path = '/functions/{functionId}/tag'.replace(new RegExp('{functionId}', 'g'), functionId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof tag === 'undefined') {
throw new AppwriteException('Missing required parameter: "tag"');
}
let path = '/functions/{functionId}/tag'.replace('{functionId}', functionId);
let payload = {};
if (typeof tag !== 'undefined') {
payload['tag'] = tag;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'tag': tag
});
'content-type': 'application/json',
}, payload);
}

@@ -247,22 +364,37 @@

*
* @param string functionId
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async listTags(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') {
let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId);
async listTags(functionId, search, limit, offset, orderType) {
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
let path = '/functions/{functionId}/tags'.replace('{functionId}', functionId);
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -284,18 +416,35 @@

*
* @param string functionId
* @param string command
* @param File code
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} command
* @param {File} code
* @throws {AppwriteException}
* @returns {Promise}
*/
async createTag(functionId, command, code) {
let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof command === 'undefined') {
throw new AppwriteException('Missing required parameter: "command"');
}
if (typeof code === 'undefined') {
throw new AppwriteException('Missing required parameter: "code"');
}
let path = '/functions/{functionId}/tags'.replace('{functionId}', functionId);
let payload = {};
if (typeof command !== 'undefined') {
payload['command'] = command;
}
if (typeof code !== 'undefined') {
payload['code'] = code;
}
return await this.client.call('post', path, {
'content-type': 'multipart/form-data',
},
{
'command': command,
'code': code
});
'content-type': 'multipart/form-data',
}, payload);
}

@@ -308,15 +457,22 @@

*
* @param string functionId
* @param string tagId
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} tagId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getTag(functionId, tagId) {
let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof tagId === 'undefined') {
throw new AppwriteException('Missing required parameter: "tagId"');
}
let path = '/functions/{functionId}/tags/{tagId}'.replace('{functionId}', functionId).replace('{tagId}', tagId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -329,15 +485,22 @@

*
* @param string functionId
* @param string tagId
* @throws Exception
* @return {}
* @param {string} functionId
* @param {string} tagId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteTag(functionId, tagId) {
let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId);
if (typeof functionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "functionId"');
}
if (typeof tagId === 'undefined') {
throw new AppwriteException('Missing required parameter: "tagId"');
}
let path = '/functions/{functionId}/tags/{tagId}'.replace('{functionId}', functionId).replace('{tagId}', tagId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -344,0 +507,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -10,13 +11,12 @@ class Health extends Service {

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async get() {
let path = '/health';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -29,13 +29,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getAntiVirus() {
let path = '/health/anti-virus';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -49,13 +48,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCache() {
let path = '/health/cache';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -68,13 +66,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getDB() {
let path = '/health/db';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -89,13 +86,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueCertificates() {
let path = '/health/queue/certificates';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -106,13 +102,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueFunctions() {
let path = '/health/queue/functions';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -126,13 +121,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueLogs() {
let path = '/health/queue/logs';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -146,13 +140,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueTasks() {
let path = '/health/queue/tasks';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -166,13 +159,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueUsage() {
let path = '/health/queue/usage';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -186,13 +178,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getQueueWebhooks() {
let path = '/health/queue/webhooks';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -205,13 +196,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getStorageLocal() {
let path = '/health/storage/local';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -230,13 +220,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getTime() {
let path = '/health/time';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -243,0 +232,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -15,13 +16,12 @@ class Locale extends Service {

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async get() {
let path = '/locale';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -35,13 +35,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getContinents() {
let path = '/locale/continents';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -55,13 +54,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCountries() {
let path = '/locale/countries';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -75,13 +73,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCountriesEU() {
let path = '/locale/countries/eu';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -95,13 +92,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCountriesPhones() {
let path = '/locale/countries/phones';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -116,13 +112,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getCurrencies() {
let path = '/locale/currencies';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -136,13 +131,12 @@

*
* @throws Exception
* @return {}
* @throws {AppwriteException}
* @returns {Promise}
*/
async getLanguages() {
let path = '/locale/languages';
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -149,0 +143,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -12,21 +13,32 @@ class Storage extends Service {

*
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async listFiles(search = '', limit = 25, offset = 0, orderType = 'ASC') {
async listFiles(search, limit, offset, orderType) {
let path = '/storage/files';
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -41,19 +53,31 @@

*
* @param File file
* @param string[] read
* @param string[] write
* @throws Exception
* @return {}
* @param {File} file
* @param {string[]} read
* @param {string[]} write
* @throws {AppwriteException}
* @returns {Promise}
*/
async createFile(file, read = [], write = []) {
async createFile(file, read, write) {
if (typeof file === 'undefined') {
throw new AppwriteException('Missing required parameter: "file"');
}
let path = '/storage/files';
let payload = {};
if (typeof file !== 'undefined') {
payload['file'] = file;
}
if (typeof read !== 'undefined') {
payload['read'] = read;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
return await this.client.call('post', path, {
'content-type': 'multipart/form-data',
},
{
'file': file,
'read': read,
'write': write
});
'content-type': 'multipart/form-data',
}, payload);
}

@@ -67,14 +91,17 @@

*
* @param string fileId
* @throws Exception
* @return {}
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFile(fileId) {
let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId);
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -88,18 +115,35 @@

*
* @param string fileId
* @param string[] read
* @param string[] write
* @throws Exception
* @return {}
* @param {string} fileId
* @param {string[]} read
* @param {string[]} write
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateFile(fileId, read, write) {
let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId);
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
if (typeof read === 'undefined') {
throw new AppwriteException('Missing required parameter: "read"');
}
if (typeof write === 'undefined') {
throw new AppwriteException('Missing required parameter: "write"');
}
let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
let payload = {};
if (typeof read !== 'undefined') {
payload['read'] = read;
}
if (typeof write !== 'undefined') {
payload['write'] = write;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'read': read,
'write': write
});
'content-type': 'application/json',
}, payload);
}

@@ -113,14 +157,17 @@

*
* @param string fileId
* @throws Exception
* @return {}
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteFile(fileId) {
let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId);
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
let path = '/storage/files/{fileId}'.replace('{fileId}', fileId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -135,14 +182,17 @@

*
* @param string fileId
* @throws Exception
* @return {}
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFileDownload(fileId) {
let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId);
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
let path = '/storage/files/{fileId}/download'.replace('{fileId}', fileId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -158,34 +208,67 @@

*
* @param string fileId
* @param number width
* @param number height
* @param number quality
* @param number borderWidth
* @param string borderColor
* @param number borderRadius
* @param number opacity
* @param number rotation
* @param string background
* @param string output
* @throws Exception
* @return {}
* @param {string} fileId
* @param {number} width
* @param {number} height
* @param {number} quality
* @param {number} borderWidth
* @param {string} borderColor
* @param {number} borderRadius
* @param {number} opacity
* @param {number} rotation
* @param {string} background
* @param {string} output
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFilePreview(fileId, width = 0, height = 0, quality = 100, borderWidth = 0, borderColor = '', borderRadius = 0, opacity = 1, rotation = 0, background = '', output = '') {
let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId);
async getFilePreview(fileId, width, height, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
let path = '/storage/files/{fileId}/preview'.replace('{fileId}', fileId);
let payload = {};
if (typeof width !== 'undefined') {
payload['width'] = width;
}
if (typeof height !== 'undefined') {
payload['height'] = height;
}
if (typeof quality !== 'undefined') {
payload['quality'] = quality;
}
if (typeof borderWidth !== 'undefined') {
payload['borderWidth'] = borderWidth;
}
if (typeof borderColor !== 'undefined') {
payload['borderColor'] = borderColor;
}
if (typeof borderRadius !== 'undefined') {
payload['borderRadius'] = borderRadius;
}
if (typeof opacity !== 'undefined') {
payload['opacity'] = opacity;
}
if (typeof rotation !== 'undefined') {
payload['rotation'] = rotation;
}
if (typeof background !== 'undefined') {
payload['background'] = background;
}
if (typeof output !== 'undefined') {
payload['output'] = output;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'width': width,
'height': height,
'quality': quality,
'borderWidth': borderWidth,
'borderColor': borderColor,
'borderRadius': borderRadius,
'opacity': opacity,
'rotation': rotation,
'background': background,
'output': output
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -200,14 +283,17 @@

*
* @param string fileId
* @throws Exception
* @return {}
* @param {string} fileId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getFileView(fileId) {
let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId);
if (typeof fileId === 'undefined') {
throw new AppwriteException('Missing required parameter: "fileId"');
}
let path = '/storage/files/{fileId}/view'.replace('{fileId}', fileId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
}, 'arraybuffer');
'content-type': 'application/json',
}, payload, 'arraybuffer');
}

@@ -214,0 +300,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -13,21 +14,32 @@ class Teams extends Service {

*
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async list(search = '', limit = 25, offset = 0, orderType = 'ASC') {
async list(search, limit, offset, orderType) {
let path = '/teams';
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -43,17 +55,26 @@

*
* @param string name
* @param string[] roles
* @throws Exception
* @return {}
* @param {string} name
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise}
*/
async create(name, roles = ["owner"]) {
async create(name, roles) {
if (typeof name === 'undefined') {
throw new AppwriteException('Missing required parameter: "name"');
}
let path = '/teams';
let payload = {};
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof roles !== 'undefined') {
payload['roles'] = roles;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'name': name,
'roles': roles
});
'content-type': 'application/json',
}, payload);
}

@@ -67,14 +88,17 @@

*
* @param string teamId
* @throws Exception
* @return {}
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise}
*/
async get(teamId) {
let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId);
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
let path = '/teams/{teamId}'.replace('{teamId}', teamId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -88,16 +112,26 @@

*
* @param string teamId
* @param string name
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise}
*/
async update(teamId, name) {
let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId);
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;
}
return await this.client.call('put', path, {
'content-type': 'application/json',
},
{
'name': name
});
'content-type': 'application/json',
}, payload);
}

@@ -111,14 +145,17 @@

*
* @param string teamId
* @throws Exception
* @return {}
* @param {string} teamId
* @throws {AppwriteException}
* @returns {Promise}
*/
async delete(teamId) {
let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId);
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
let path = '/teams/{teamId}'.replace('{teamId}', teamId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -132,22 +169,37 @@

*
* @param string teamId
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async getMemberships(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') {
let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId);
async getMemberships(teamId, search, limit, offset, orderType) {
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -172,22 +224,49 @@

*
* @param string teamId
* @param string email
* @param string[] roles
* @param string url
* @param string name
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} email
* @param {string[]} roles
* @param {string} url
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise}
*/
async createMembership(teamId, email, roles, url, name = '') {
let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId);
async createMembership(teamId, email, roles, url, name) {
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof email === 'undefined') {
throw new AppwriteException('Missing required parameter: "email"');
}
if (typeof roles === 'undefined') {
throw new AppwriteException('Missing required parameter: "roles"');
}
if (typeof url === 'undefined') {
throw new AppwriteException('Missing required parameter: "url"');
}
let path = '/teams/{teamId}/memberships'.replace('{teamId}', teamId);
let payload = {};
if (typeof email !== 'undefined') {
payload['email'] = email;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
if (typeof roles !== 'undefined') {
payload['roles'] = roles;
}
if (typeof url !== 'undefined') {
payload['url'] = url;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'email': email,
'name': name,
'roles': roles,
'url': url
});
'content-type': 'application/json',
}, payload);
}

@@ -198,17 +277,31 @@

*
* @param string teamId
* @param string membershipId
* @param string[] roles
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} membershipId
* @param {string[]} roles
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateMembershipRoles(teamId, membershipId, roles) {
let path = '/teams/{teamId}/memberships/{membershipId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{membershipId}', 'g'), membershipId);
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof membershipId === 'undefined') {
throw new AppwriteException('Missing required parameter: "membershipId"');
}
if (typeof roles === 'undefined') {
throw new AppwriteException('Missing required parameter: "roles"');
}
let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
let payload = {};
if (typeof roles !== 'undefined') {
payload['roles'] = roles;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'roles': roles
});
'content-type': 'application/json',
}, payload);
}

@@ -223,15 +316,22 @@

*
* @param string teamId
* @param string membershipId
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} membershipId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteMembership(teamId, membershipId) {
let path = '/teams/{teamId}/memberships/{membershipId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{membershipId}', 'g'), membershipId);
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof membershipId === 'undefined') {
throw new AppwriteException('Missing required parameter: "membershipId"');
}
let path = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -246,19 +346,40 @@

*
* @param string teamId
* @param string membershipId
* @param string userId
* @param string secret
* @throws Exception
* @return {}
* @param {string} teamId
* @param {string} membershipId
* @param {string} userId
* @param {string} secret
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateMembershipStatus(teamId, membershipId, userId, secret) {
let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{membershipId}', 'g'), membershipId);
if (typeof teamId === 'undefined') {
throw new AppwriteException('Missing required parameter: "teamId"');
}
if (typeof membershipId === 'undefined') {
throw new AppwriteException('Missing required parameter: "membershipId"');
}
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof secret === 'undefined') {
throw new AppwriteException('Missing required parameter: "secret"');
}
let path = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId);
let payload = {};
if (typeof userId !== 'undefined') {
payload['userId'] = userId;
}
if (typeof secret !== 'undefined') {
payload['secret'] = secret;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'userId': userId,
'secret': secret
});
'content-type': 'application/json',
}, payload);
}

@@ -265,0 +386,0 @@ }

const Service = require('../service.js');
const AppwriteException = require('../exception.js');

@@ -11,21 +12,32 @@ class Users extends Service {

*
* @param string search
* @param number limit
* @param number offset
* @param string orderType
* @throws Exception
* @return {}
* @param {string} search
* @param {number} limit
* @param {number} offset
* @param {string} orderType
* @throws {AppwriteException}
* @returns {Promise}
*/
async list(search = '', limit = 25, offset = 0, orderType = 'ASC') {
async list(search, limit, offset, orderType) {
let path = '/users';
let payload = {};
if (typeof search !== 'undefined') {
payload['search'] = search;
}
if (typeof limit !== 'undefined') {
payload['limit'] = limit;
}
if (typeof offset !== 'undefined') {
payload['offset'] = offset;
}
if (typeof orderType !== 'undefined') {
payload['orderType'] = orderType;
}
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
'search': search,
'limit': limit,
'offset': offset,
'orderType': orderType
});
'content-type': 'application/json',
}, payload);
}

@@ -38,19 +50,35 @@

*
* @param string email
* @param string password
* @param string name
* @throws Exception
* @return {}
* @param {string} email
* @param {string} password
* @param {string} name
* @throws {AppwriteException}
* @returns {Promise}
*/
async create(email, password, name = '') {
async create(email, password, name) {
if (typeof email === 'undefined') {
throw new AppwriteException('Missing required parameter: "email"');
}
if (typeof password === 'undefined') {
throw new AppwriteException('Missing required parameter: "password"');
}
let path = '/users';
let payload = {};
if (typeof email !== 'undefined') {
payload['email'] = email;
}
if (typeof password !== 'undefined') {
payload['password'] = password;
}
if (typeof name !== 'undefined') {
payload['name'] = name;
}
return await this.client.call('post', path, {
'content-type': 'application/json',
},
{
'email': email,
'password': password,
'name': name
});
'content-type': 'application/json',
}, payload);
}

@@ -63,14 +91,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async get(userId) {
let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}'.replace('{userId}', userId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -83,14 +114,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async delete(userId) {
let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}'.replace('{userId}', userId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -103,14 +137,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getLogs(userId) {
let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}/logs'.replace('{userId}', userId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -123,14 +160,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getPrefs(userId) {
let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -144,16 +184,26 @@

*
* @param string userId
* @param object prefs
* @throws Exception
* @return {}
* @param {string} userId
* @param {object} prefs
* @throws {AppwriteException}
* @returns {Promise}
*/
async updatePrefs(userId, prefs) {
let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof prefs === 'undefined') {
throw new AppwriteException('Missing required parameter: "prefs"');
}
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
let payload = {};
if (typeof prefs !== 'undefined') {
payload['prefs'] = prefs;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'prefs': prefs
});
'content-type': 'application/json',
}, payload);
}

@@ -166,14 +216,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async getSessions(userId) {
let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
let payload = {};
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -186,14 +239,17 @@

*
* @param string userId
* @throws Exception
* @return {}
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteSessions(userId) {
let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -206,15 +262,22 @@

*
* @param string userId
* @param string sessionId
* @throws Exception
* @return {}
* @param {string} userId
* @param {string} sessionId
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteSession(userId, sessionId) {
let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof sessionId === 'undefined') {
throw new AppwriteException('Missing required parameter: "sessionId"');
}
let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
let payload = {};
return await this.client.call('delete', path, {
'content-type': 'application/json',
},
{
});
'content-type': 'application/json',
}, payload);
}

@@ -227,16 +290,26 @@

*
* @param string userId
* @param number status
* @throws Exception
* @return {}
* @param {string} userId
* @param {number} status
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateStatus(userId, status) {
let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId);
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof status === 'undefined') {
throw new AppwriteException('Missing required parameter: "status"');
}
let path = '/users/{userId}/status'.replace('{userId}', userId);
let payload = {};
if (typeof status !== 'undefined') {
payload['status'] = status;
}
return await this.client.call('patch', path, {
'content-type': 'application/json',
},
{
'status': status
});
'content-type': 'application/json',
}, payload);
}

@@ -243,0 +316,0 @@ }

@@ -5,5 +5,6 @@ {

"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "2.2.3",
"version": "2.2.4",
"license": "BSD-3-Clause",
"main": "index.js",
"main": "./index.js",
"types": "./index.d.ts",
"repository": {

@@ -18,2 +19,2 @@ "type": "git",

}
}
}