node-appwrite 8.2.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-recovery.md +1 -1
- package/docs/examples/account/create-verification.md +1 -1
- package/docs/examples/account/delete-identity.md +20 -0
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/get.md +1 -1
- package/docs/examples/account/list-identities.md +20 -0
- package/docs/examples/account/list-logs.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +1 -1
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-password.md +2 -2
- package/docs/examples/account/update-phone-verification.md +1 -1
- package/docs/examples/account/update-phone.md +1 -1
- package/docs/examples/account/update-prefs.md +1 -1
- package/docs/examples/account/update-recovery.md +1 -1
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +1 -1
- package/docs/examples/avatars/get-browser.md +1 -1
- package/docs/examples/avatars/get-credit-card.md +1 -1
- package/docs/examples/avatars/get-favicon.md +1 -1
- package/docs/examples/avatars/get-flag.md +1 -1
- package/docs/examples/avatars/get-image.md +1 -1
- package/docs/examples/avatars/get-initials.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +1 -1
- package/docs/examples/databases/create-collection.md +1 -1
- package/docs/examples/databases/create-datetime-attribute.md +1 -1
- package/docs/examples/databases/create-document.md +1 -1
- package/docs/examples/databases/create-email-attribute.md +1 -1
- package/docs/examples/databases/create-enum-attribute.md +1 -1
- package/docs/examples/databases/create-float-attribute.md +1 -1
- package/docs/examples/databases/create-index.md +1 -1
- package/docs/examples/databases/create-integer-attribute.md +1 -1
- package/docs/examples/databases/create-ip-attribute.md +1 -1
- package/docs/examples/databases/create-relationship-attribute.md +20 -0
- package/docs/examples/databases/create-string-attribute.md +1 -1
- package/docs/examples/databases/create-url-attribute.md +1 -1
- package/docs/examples/databases/create.md +1 -1
- package/docs/examples/databases/delete-attribute.md +1 -1
- package/docs/examples/databases/delete-collection.md +1 -1
- package/docs/examples/databases/delete-document.md +1 -1
- package/docs/examples/databases/delete-index.md +1 -1
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-document.md +1 -1
- package/docs/examples/databases/get-index.md +1 -1
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-documents.md +1 -1
- package/docs/examples/databases/list-indexes.md +1 -1
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +20 -0
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +20 -0
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +20 -0
- package/docs/examples/databases/update-enum-attribute.md +20 -0
- package/docs/examples/databases/update-float-attribute.md +20 -0
- package/docs/examples/databases/update-integer-attribute.md +20 -0
- package/docs/examples/databases/update-ip-attribute.md +20 -0
- package/docs/examples/databases/update-relationship-attribute.md +20 -0
- package/docs/examples/databases/update-string-attribute.md +20 -0
- package/docs/examples/databases/update-url-attribute.md +20 -0
- package/docs/examples/databases/update.md +1 -1
- package/docs/examples/functions/create-build.md +1 -1
- package/docs/examples/functions/create-deployment.md +2 -2
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +1 -1
- package/docs/examples/functions/create.md +2 -2
- package/docs/examples/functions/delete-deployment.md +1 -1
- package/docs/examples/functions/delete-variable.md +1 -1
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +20 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-variable.md +1 -1
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +1 -1
- package/docs/examples/functions/list-executions.md +1 -1
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-variables.md +1 -1
- package/docs/examples/functions/list.md +1 -1
- package/docs/examples/functions/update-deployment.md +1 -1
- package/docs/examples/functions/update-variable.md +1 -1
- package/docs/examples/functions/update.md +2 -2
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-d-b.md +1 -1
- package/docs/examples/health/get-pub-sub.md +20 -0
- package/docs/examples/health/get-queue-certificates.md +1 -1
- package/docs/examples/health/get-queue-functions.md +1 -1
- package/docs/examples/health/get-queue-logs.md +1 -1
- package/docs/examples/health/get-queue-webhooks.md +1 -1
- package/docs/examples/health/get-queue.md +20 -0
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/health/get.md +1 -1
- package/docs/examples/locale/get.md +1 -1
- package/docs/examples/locale/list-codes.md +20 -0
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-e-u.md +1 -1
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/storage/create-bucket.md +1 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +1 -1
- package/docs/examples/storage/get-bucket.md +1 -1
- package/docs/examples/storage/get-file-download.md +1 -1
- package/docs/examples/storage/get-file-preview.md +1 -1
- package/docs/examples/storage/get-file-view.md +1 -1
- package/docs/examples/storage/get-file.md +1 -1
- package/docs/examples/storage/list-buckets.md +1 -1
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +1 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/teams/create-membership.md +2 -2
- package/docs/examples/teams/create.md +1 -1
- package/docs/examples/teams/delete-membership.md +1 -1
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +1 -1
- package/docs/examples/teams/get-prefs.md +20 -0
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-memberships.md +1 -1
- package/docs/examples/teams/list.md +1 -1
- package/docs/examples/teams/update-membership-status.md +1 -1
- package/docs/examples/teams/{update-membership-roles.md → update-membership.md} +2 -2
- package/docs/examples/teams/{update.md → update-name.md} +2 -2
- package/docs/examples/teams/update-prefs.md +20 -0
- package/docs/examples/users/create-argon2user.md +1 -1
- package/docs/examples/users/create-bcrypt-user.md +1 -1
- package/docs/examples/users/create-m-d5user.md +1 -1
- package/docs/examples/users/create-p-h-pass-user.md +1 -1
- package/docs/examples/users/create-s-h-a-user.md +1 -1
- package/docs/examples/users/create-scrypt-modified-user.md +1 -1
- package/docs/examples/users/create-scrypt-user.md +1 -1
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +20 -0
- package/docs/examples/users/delete-session.md +1 -1
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +20 -0
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list.md +1 -1
- package/docs/examples/users/update-email-verification.md +1 -1
- package/docs/examples/users/update-email.md +1 -1
- package/docs/examples/users/update-labels.md +20 -0
- package/docs/examples/users/update-name.md +1 -1
- package/docs/examples/users/update-password.md +2 -2
- package/docs/examples/users/update-phone-verification.md +1 -1
- package/docs/examples/users/update-phone.md +1 -1
- package/docs/examples/users/update-prefs.md +1 -1
- package/docs/examples/users/update-status.md +1 -1
- package/index.d.ts +767 -165
- package/lib/client.js +5 -2
- package/lib/inputFile.js +6 -8
- package/lib/query.js +18 -0
- package/lib/services/account.js +94 -50
- package/lib/services/avatars.js +14 -14
- package/lib/services/databases.js +826 -180
- package/lib/services/functions.js +254 -101
- package/lib/services/graphql.js +4 -4
- package/lib/services/health.js +57 -22
- package/lib/services/locale.js +32 -14
- package/lib/services/storage.js +76 -63
- package/lib/services/teams.js +112 -43
- package/lib/services/users.js +135 -50
- package/package.json +6 -4
package/lib/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const os = require('os');
|
|
1
2
|
const URL = require('url').URL;
|
|
2
3
|
const axios = require('axios');
|
|
3
4
|
const FormData = require('form-data');
|
|
@@ -9,12 +10,14 @@ class Client {
|
|
|
9
10
|
constructor() {
|
|
10
11
|
this.endpoint = 'https://HOSTNAME/v1';
|
|
11
12
|
this.headers = {
|
|
13
|
+
'accept-encoding': '*',
|
|
12
14
|
'content-type': '',
|
|
15
|
+
'user-agent' : `AppwriteNodeJSSDK/10.0.0 (${os.type()}; ${os.version()}; ${os.arch()})`,
|
|
13
16
|
'x-sdk-name': 'Node.js',
|
|
14
17
|
'x-sdk-platform': 'server',
|
|
15
18
|
'x-sdk-language': 'nodejs',
|
|
16
|
-
'x-sdk-version': '
|
|
17
|
-
'X-Appwrite-Response-Format' : '1.
|
|
19
|
+
'x-sdk-version': '10.0.0',
|
|
20
|
+
'X-Appwrite-Response-Format' : '1.4.0',
|
|
18
21
|
};
|
|
19
22
|
this.selfSigned = false;
|
|
20
23
|
}
|
package/lib/inputFile.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { Readable } = require('stream');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const { promisify } = require('util');
|
|
4
3
|
|
|
5
4
|
class InputFile {
|
|
6
5
|
stream; // Content of file, readable stream
|
|
@@ -14,16 +13,15 @@ class InputFile {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
static fromBuffer = (buffer, filename) => {
|
|
17
|
-
const stream = Readable.from(buffer
|
|
16
|
+
const stream = Readable.from(buffer);
|
|
18
17
|
const size = Buffer.byteLength(buffer);
|
|
19
18
|
return new InputFile(stream, filename, size);
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
static fromBlob = (blob, filename) => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
return new InputFile(stream, filename);
|
|
21
|
+
static fromBlob = async (blob, filename) => {
|
|
22
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
23
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
24
|
+
return InputFile.fromBuffer(buffer, filename);
|
|
27
25
|
};
|
|
28
26
|
|
|
29
27
|
static fromStream = (stream, filename, size) => {
|
|
@@ -32,7 +30,7 @@ class InputFile {
|
|
|
32
30
|
|
|
33
31
|
static fromPlainText = (content, filename) => {
|
|
34
32
|
const buffer = Buffer.from(content, "utf-8");
|
|
35
|
-
const stream = Readable.from(buffer
|
|
33
|
+
const stream = Readable.from(buffer);
|
|
36
34
|
const size = Buffer.byteLength(buffer);
|
|
37
35
|
return new InputFile(stream, filename, size);
|
|
38
36
|
};
|
package/lib/query.js
CHANGED
|
@@ -17,6 +17,24 @@ class Query {
|
|
|
17
17
|
static greaterThanEqual = (attribute, value) =>
|
|
18
18
|
Query.addQuery(attribute, "greaterThanEqual", value);
|
|
19
19
|
|
|
20
|
+
static isNull = (attribute) =>
|
|
21
|
+
`isNull("${attribute}")`;
|
|
22
|
+
|
|
23
|
+
static isNotNull = (attribute) =>
|
|
24
|
+
`isNotNull("${attribute}")`;
|
|
25
|
+
|
|
26
|
+
static between = (attribute, start, end) =>
|
|
27
|
+
Query.addQuery(attribute, "between", [start, end]);
|
|
28
|
+
|
|
29
|
+
static startsWith = (attribute, value) =>
|
|
30
|
+
Query.addQuery(attribute, "startsWith", value);
|
|
31
|
+
|
|
32
|
+
static endsWith = (attribute, value) =>
|
|
33
|
+
Query.addQuery(attribute, "endsWith", value);
|
|
34
|
+
|
|
35
|
+
static select = (attributes) =>
|
|
36
|
+
`select([${attributes.map((attr) => `"${attr}"`).join(",")}])`;
|
|
37
|
+
|
|
20
38
|
static search = (attribute, value) =>
|
|
21
39
|
Query.addQuery(attribute, "search", value);
|
|
22
40
|
|
package/lib/services/account.js
CHANGED
|
@@ -17,16 +17,16 @@ class Account extends Service {
|
|
|
17
17
|
/**
|
|
18
18
|
* Get Account
|
|
19
19
|
*
|
|
20
|
-
* Get currently logged in user
|
|
20
|
+
* Get the currently logged in user.
|
|
21
21
|
*
|
|
22
22
|
* @throws {AppwriteException}
|
|
23
23
|
* @returns {Promise}
|
|
24
24
|
*/
|
|
25
25
|
async get() {
|
|
26
|
-
|
|
26
|
+
const apiPath = '/account';
|
|
27
27
|
let payload = {};
|
|
28
28
|
|
|
29
|
-
return await this.client.call('get',
|
|
29
|
+
return await this.client.call('get', apiPath, {
|
|
30
30
|
'content-type': 'application/json',
|
|
31
31
|
}, payload);
|
|
32
32
|
}
|
|
@@ -49,7 +49,7 @@ class Account extends Service {
|
|
|
49
49
|
* @returns {Promise}
|
|
50
50
|
*/
|
|
51
51
|
async updateEmail(email, password) {
|
|
52
|
-
|
|
52
|
+
const apiPath = '/account/email';
|
|
53
53
|
let payload = {};
|
|
54
54
|
if (typeof email === 'undefined') {
|
|
55
55
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
@@ -68,7 +68,51 @@ class Account extends Service {
|
|
|
68
68
|
payload['password'] = password;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return await this.client.call('patch',
|
|
71
|
+
return await this.client.call('patch', apiPath, {
|
|
72
|
+
'content-type': 'application/json',
|
|
73
|
+
}, payload);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* List Identities
|
|
78
|
+
*
|
|
79
|
+
* Get the list of identities for the currently logged in user.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} queries
|
|
82
|
+
* @throws {AppwriteException}
|
|
83
|
+
* @returns {Promise}
|
|
84
|
+
*/
|
|
85
|
+
async listIdentities(queries) {
|
|
86
|
+
const apiPath = '/account/identities';
|
|
87
|
+
let payload = {};
|
|
88
|
+
|
|
89
|
+
if (typeof queries !== 'undefined') {
|
|
90
|
+
payload['queries'] = queries;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return await this.client.call('get', apiPath, {
|
|
94
|
+
'content-type': 'application/json',
|
|
95
|
+
}, payload);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Delete Identity
|
|
100
|
+
*
|
|
101
|
+
* Delete an identity by its unique ID.
|
|
102
|
+
*
|
|
103
|
+
* @param {string} identityId
|
|
104
|
+
* @throws {AppwriteException}
|
|
105
|
+
* @returns {Promise}
|
|
106
|
+
*/
|
|
107
|
+
async deleteIdentity(identityId) {
|
|
108
|
+
const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
109
|
+
let payload = {};
|
|
110
|
+
if (typeof identityId === 'undefined') {
|
|
111
|
+
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return await this.client.call('delete', apiPath, {
|
|
72
116
|
'content-type': 'application/json',
|
|
73
117
|
}, payload);
|
|
74
118
|
}
|
|
@@ -76,22 +120,22 @@ class Account extends Service {
|
|
|
76
120
|
/**
|
|
77
121
|
* List Logs
|
|
78
122
|
*
|
|
79
|
-
* Get
|
|
80
|
-
* log returns user IP address, location and date and time of log.
|
|
123
|
+
* Get the list of latest security activity logs for the currently logged in
|
|
124
|
+
* user. Each log returns user IP address, location and date and time of log.
|
|
81
125
|
*
|
|
82
126
|
* @param {string[]} queries
|
|
83
127
|
* @throws {AppwriteException}
|
|
84
128
|
* @returns {Promise}
|
|
85
129
|
*/
|
|
86
130
|
async listLogs(queries) {
|
|
87
|
-
|
|
131
|
+
const apiPath = '/account/logs';
|
|
88
132
|
let payload = {};
|
|
89
133
|
|
|
90
134
|
if (typeof queries !== 'undefined') {
|
|
91
135
|
payload['queries'] = queries;
|
|
92
136
|
}
|
|
93
137
|
|
|
94
|
-
return await this.client.call('get',
|
|
138
|
+
return await this.client.call('get', apiPath, {
|
|
95
139
|
'content-type': 'application/json',
|
|
96
140
|
}, payload);
|
|
97
141
|
}
|
|
@@ -106,7 +150,7 @@ class Account extends Service {
|
|
|
106
150
|
* @returns {Promise}
|
|
107
151
|
*/
|
|
108
152
|
async updateName(name) {
|
|
109
|
-
|
|
153
|
+
const apiPath = '/account/name';
|
|
110
154
|
let payload = {};
|
|
111
155
|
if (typeof name === 'undefined') {
|
|
112
156
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
@@ -117,7 +161,7 @@ class Account extends Service {
|
|
|
117
161
|
payload['name'] = name;
|
|
118
162
|
}
|
|
119
163
|
|
|
120
|
-
return await this.client.call('patch',
|
|
164
|
+
return await this.client.call('patch', apiPath, {
|
|
121
165
|
'content-type': 'application/json',
|
|
122
166
|
}, payload);
|
|
123
167
|
}
|
|
@@ -135,7 +179,7 @@ class Account extends Service {
|
|
|
135
179
|
* @returns {Promise}
|
|
136
180
|
*/
|
|
137
181
|
async updatePassword(password, oldPassword) {
|
|
138
|
-
|
|
182
|
+
const apiPath = '/account/password';
|
|
139
183
|
let payload = {};
|
|
140
184
|
if (typeof password === 'undefined') {
|
|
141
185
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
@@ -150,7 +194,7 @@ class Account extends Service {
|
|
|
150
194
|
payload['oldPassword'] = oldPassword;
|
|
151
195
|
}
|
|
152
196
|
|
|
153
|
-
return await this.client.call('patch',
|
|
197
|
+
return await this.client.call('patch', apiPath, {
|
|
154
198
|
'content-type': 'application/json',
|
|
155
199
|
}, payload);
|
|
156
200
|
}
|
|
@@ -170,7 +214,7 @@ class Account extends Service {
|
|
|
170
214
|
* @returns {Promise}
|
|
171
215
|
*/
|
|
172
216
|
async updatePhone(phone, password) {
|
|
173
|
-
|
|
217
|
+
const apiPath = '/account/phone';
|
|
174
218
|
let payload = {};
|
|
175
219
|
if (typeof phone === 'undefined') {
|
|
176
220
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
@@ -189,7 +233,7 @@ class Account extends Service {
|
|
|
189
233
|
payload['password'] = password;
|
|
190
234
|
}
|
|
191
235
|
|
|
192
|
-
return await this.client.call('patch',
|
|
236
|
+
return await this.client.call('patch', apiPath, {
|
|
193
237
|
'content-type': 'application/json',
|
|
194
238
|
}, payload);
|
|
195
239
|
}
|
|
@@ -197,16 +241,16 @@ class Account extends Service {
|
|
|
197
241
|
/**
|
|
198
242
|
* Get Account Preferences
|
|
199
243
|
*
|
|
200
|
-
* Get
|
|
244
|
+
* Get the preferences as a key-value object for the currently logged in user.
|
|
201
245
|
*
|
|
202
246
|
* @throws {AppwriteException}
|
|
203
247
|
* @returns {Promise}
|
|
204
248
|
*/
|
|
205
249
|
async getPrefs() {
|
|
206
|
-
|
|
250
|
+
const apiPath = '/account/prefs';
|
|
207
251
|
let payload = {};
|
|
208
252
|
|
|
209
|
-
return await this.client.call('get',
|
|
253
|
+
return await this.client.call('get', apiPath, {
|
|
210
254
|
'content-type': 'application/json',
|
|
211
255
|
}, payload);
|
|
212
256
|
}
|
|
@@ -223,7 +267,7 @@ class Account extends Service {
|
|
|
223
267
|
* @returns {Promise}
|
|
224
268
|
*/
|
|
225
269
|
async updatePrefs(prefs) {
|
|
226
|
-
|
|
270
|
+
const apiPath = '/account/prefs';
|
|
227
271
|
let payload = {};
|
|
228
272
|
if (typeof prefs === 'undefined') {
|
|
229
273
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
@@ -234,7 +278,7 @@ class Account extends Service {
|
|
|
234
278
|
payload['prefs'] = prefs;
|
|
235
279
|
}
|
|
236
280
|
|
|
237
|
-
return await this.client.call('patch',
|
|
281
|
+
return await this.client.call('patch', apiPath, {
|
|
238
282
|
'content-type': 'application/json',
|
|
239
283
|
}, payload);
|
|
240
284
|
}
|
|
@@ -257,7 +301,7 @@ class Account extends Service {
|
|
|
257
301
|
* @returns {Promise}
|
|
258
302
|
*/
|
|
259
303
|
async createRecovery(email, url) {
|
|
260
|
-
|
|
304
|
+
const apiPath = '/account/recovery';
|
|
261
305
|
let payload = {};
|
|
262
306
|
if (typeof email === 'undefined') {
|
|
263
307
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
@@ -276,7 +320,7 @@ class Account extends Service {
|
|
|
276
320
|
payload['url'] = url;
|
|
277
321
|
}
|
|
278
322
|
|
|
279
|
-
return await this.client.call('post',
|
|
323
|
+
return await this.client.call('post', apiPath, {
|
|
280
324
|
'content-type': 'application/json',
|
|
281
325
|
}, payload);
|
|
282
326
|
}
|
|
@@ -302,7 +346,7 @@ class Account extends Service {
|
|
|
302
346
|
* @returns {Promise}
|
|
303
347
|
*/
|
|
304
348
|
async updateRecovery(userId, secret, password, passwordAgain) {
|
|
305
|
-
|
|
349
|
+
const apiPath = '/account/recovery';
|
|
306
350
|
let payload = {};
|
|
307
351
|
if (typeof userId === 'undefined') {
|
|
308
352
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -337,7 +381,7 @@ class Account extends Service {
|
|
|
337
381
|
payload['passwordAgain'] = passwordAgain;
|
|
338
382
|
}
|
|
339
383
|
|
|
340
|
-
return await this.client.call('put',
|
|
384
|
+
return await this.client.call('put', apiPath, {
|
|
341
385
|
'content-type': 'application/json',
|
|
342
386
|
}, payload);
|
|
343
387
|
}
|
|
@@ -345,17 +389,17 @@ class Account extends Service {
|
|
|
345
389
|
/**
|
|
346
390
|
* List Sessions
|
|
347
391
|
*
|
|
348
|
-
* Get
|
|
349
|
-
*
|
|
392
|
+
* Get the list of active sessions across different devices for the currently
|
|
393
|
+
* logged in user.
|
|
350
394
|
*
|
|
351
395
|
* @throws {AppwriteException}
|
|
352
396
|
* @returns {Promise}
|
|
353
397
|
*/
|
|
354
398
|
async listSessions() {
|
|
355
|
-
|
|
399
|
+
const apiPath = '/account/sessions';
|
|
356
400
|
let payload = {};
|
|
357
401
|
|
|
358
|
-
return await this.client.call('get',
|
|
402
|
+
return await this.client.call('get', apiPath, {
|
|
359
403
|
'content-type': 'application/json',
|
|
360
404
|
}, payload);
|
|
361
405
|
}
|
|
@@ -370,10 +414,10 @@ class Account extends Service {
|
|
|
370
414
|
* @returns {Promise}
|
|
371
415
|
*/
|
|
372
416
|
async deleteSessions() {
|
|
373
|
-
|
|
417
|
+
const apiPath = '/account/sessions';
|
|
374
418
|
let payload = {};
|
|
375
419
|
|
|
376
|
-
return await this.client.call('delete',
|
|
420
|
+
return await this.client.call('delete', apiPath, {
|
|
377
421
|
'content-type': 'application/json',
|
|
378
422
|
}, payload);
|
|
379
423
|
}
|
|
@@ -389,14 +433,14 @@ class Account extends Service {
|
|
|
389
433
|
* @returns {Promise}
|
|
390
434
|
*/
|
|
391
435
|
async getSession(sessionId) {
|
|
392
|
-
|
|
436
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
393
437
|
let payload = {};
|
|
394
438
|
if (typeof sessionId === 'undefined') {
|
|
395
439
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
396
440
|
}
|
|
397
441
|
|
|
398
442
|
|
|
399
|
-
return await this.client.call('get',
|
|
443
|
+
return await this.client.call('get', apiPath, {
|
|
400
444
|
'content-type': 'application/json',
|
|
401
445
|
}, payload);
|
|
402
446
|
}
|
|
@@ -413,14 +457,14 @@ class Account extends Service {
|
|
|
413
457
|
* @returns {Promise}
|
|
414
458
|
*/
|
|
415
459
|
async updateSession(sessionId) {
|
|
416
|
-
|
|
460
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
417
461
|
let payload = {};
|
|
418
462
|
if (typeof sessionId === 'undefined') {
|
|
419
463
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
420
464
|
}
|
|
421
465
|
|
|
422
466
|
|
|
423
|
-
return await this.client.call('patch',
|
|
467
|
+
return await this.client.call('patch', apiPath, {
|
|
424
468
|
'content-type': 'application/json',
|
|
425
469
|
}, payload);
|
|
426
470
|
}
|
|
@@ -428,24 +472,24 @@ class Account extends Service {
|
|
|
428
472
|
/**
|
|
429
473
|
* Delete Session
|
|
430
474
|
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
475
|
+
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
476
|
+
* use a session ID to logout on another device. If you're looking to logout
|
|
477
|
+
* the user on all devices, use [Delete
|
|
478
|
+
* Sessions](/docs/client/account#accountDeleteSessions) instead.
|
|
435
479
|
*
|
|
436
480
|
* @param {string} sessionId
|
|
437
481
|
* @throws {AppwriteException}
|
|
438
482
|
* @returns {Promise}
|
|
439
483
|
*/
|
|
440
484
|
async deleteSession(sessionId) {
|
|
441
|
-
|
|
485
|
+
const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
442
486
|
let payload = {};
|
|
443
487
|
if (typeof sessionId === 'undefined') {
|
|
444
488
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
445
489
|
}
|
|
446
490
|
|
|
447
491
|
|
|
448
|
-
return await this.client.call('delete',
|
|
492
|
+
return await this.client.call('delete', apiPath, {
|
|
449
493
|
'content-type': 'application/json',
|
|
450
494
|
}, payload);
|
|
451
495
|
}
|
|
@@ -461,10 +505,10 @@ class Account extends Service {
|
|
|
461
505
|
* @returns {Promise}
|
|
462
506
|
*/
|
|
463
507
|
async updateStatus() {
|
|
464
|
-
|
|
508
|
+
const apiPath = '/account/status';
|
|
465
509
|
let payload = {};
|
|
466
510
|
|
|
467
|
-
return await this.client.call('patch',
|
|
511
|
+
return await this.client.call('patch', apiPath, {
|
|
468
512
|
'content-type': 'application/json',
|
|
469
513
|
}, payload);
|
|
470
514
|
}
|
|
@@ -493,7 +537,7 @@ class Account extends Service {
|
|
|
493
537
|
* @returns {Promise}
|
|
494
538
|
*/
|
|
495
539
|
async createVerification(url) {
|
|
496
|
-
|
|
540
|
+
const apiPath = '/account/verification';
|
|
497
541
|
let payload = {};
|
|
498
542
|
if (typeof url === 'undefined') {
|
|
499
543
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
@@ -504,7 +548,7 @@ class Account extends Service {
|
|
|
504
548
|
payload['url'] = url;
|
|
505
549
|
}
|
|
506
550
|
|
|
507
|
-
return await this.client.call('post',
|
|
551
|
+
return await this.client.call('post', apiPath, {
|
|
508
552
|
'content-type': 'application/json',
|
|
509
553
|
}, payload);
|
|
510
554
|
}
|
|
@@ -523,7 +567,7 @@ class Account extends Service {
|
|
|
523
567
|
* @returns {Promise}
|
|
524
568
|
*/
|
|
525
569
|
async updateVerification(userId, secret) {
|
|
526
|
-
|
|
570
|
+
const apiPath = '/account/verification';
|
|
527
571
|
let payload = {};
|
|
528
572
|
if (typeof userId === 'undefined') {
|
|
529
573
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -542,7 +586,7 @@ class Account extends Service {
|
|
|
542
586
|
payload['secret'] = secret;
|
|
543
587
|
}
|
|
544
588
|
|
|
545
|
-
return await this.client.call('put',
|
|
589
|
+
return await this.client.call('put', apiPath, {
|
|
546
590
|
'content-type': 'application/json',
|
|
547
591
|
}, payload);
|
|
548
592
|
}
|
|
@@ -561,10 +605,10 @@ class Account extends Service {
|
|
|
561
605
|
* @returns {Promise}
|
|
562
606
|
*/
|
|
563
607
|
async createPhoneVerification() {
|
|
564
|
-
|
|
608
|
+
const apiPath = '/account/verification/phone';
|
|
565
609
|
let payload = {};
|
|
566
610
|
|
|
567
|
-
return await this.client.call('post',
|
|
611
|
+
return await this.client.call('post', apiPath, {
|
|
568
612
|
'content-type': 'application/json',
|
|
569
613
|
}, payload);
|
|
570
614
|
}
|
|
@@ -583,7 +627,7 @@ class Account extends Service {
|
|
|
583
627
|
* @returns {Promise}
|
|
584
628
|
*/
|
|
585
629
|
async updatePhoneVerification(userId, secret) {
|
|
586
|
-
|
|
630
|
+
const apiPath = '/account/verification/phone';
|
|
587
631
|
let payload = {};
|
|
588
632
|
if (typeof userId === 'undefined') {
|
|
589
633
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -602,7 +646,7 @@ class Account extends Service {
|
|
|
602
646
|
payload['secret'] = secret;
|
|
603
647
|
}
|
|
604
648
|
|
|
605
|
-
return await this.client.call('put',
|
|
649
|
+
return await this.client.call('put', apiPath, {
|
|
606
650
|
'content-type': 'application/json',
|
|
607
651
|
}, payload);
|
|
608
652
|
}
|
package/lib/services/avatars.js
CHANGED
|
@@ -35,7 +35,7 @@ class Avatars extends Service {
|
|
|
35
35
|
* @returns {Promise}
|
|
36
36
|
*/
|
|
37
37
|
async getBrowser(code, width, height, quality) {
|
|
38
|
-
|
|
38
|
+
const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
|
|
39
39
|
let payload = {};
|
|
40
40
|
if (typeof code === 'undefined') {
|
|
41
41
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
@@ -54,7 +54,7 @@ class Avatars extends Service {
|
|
|
54
54
|
payload['quality'] = quality;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return await this.client.call('get',
|
|
57
|
+
return await this.client.call('get', apiPath, {
|
|
58
58
|
'content-type': 'application/json',
|
|
59
59
|
}, payload, 'arraybuffer');
|
|
60
60
|
}
|
|
@@ -80,7 +80,7 @@ class Avatars extends Service {
|
|
|
80
80
|
* @returns {Promise}
|
|
81
81
|
*/
|
|
82
82
|
async getCreditCard(code, width, height, quality) {
|
|
83
|
-
|
|
83
|
+
const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
|
|
84
84
|
let payload = {};
|
|
85
85
|
if (typeof code === 'undefined') {
|
|
86
86
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
@@ -99,7 +99,7 @@ class Avatars extends Service {
|
|
|
99
99
|
payload['quality'] = quality;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
return await this.client.call('get',
|
|
102
|
+
return await this.client.call('get', apiPath, {
|
|
103
103
|
'content-type': 'application/json',
|
|
104
104
|
}, payload, 'arraybuffer');
|
|
105
105
|
}
|
|
@@ -116,7 +116,7 @@ class Avatars extends Service {
|
|
|
116
116
|
* @returns {Promise}
|
|
117
117
|
*/
|
|
118
118
|
async getFavicon(url) {
|
|
119
|
-
|
|
119
|
+
const apiPath = '/avatars/favicon';
|
|
120
120
|
let payload = {};
|
|
121
121
|
if (typeof url === 'undefined') {
|
|
122
122
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
@@ -127,7 +127,7 @@ class Avatars extends Service {
|
|
|
127
127
|
payload['url'] = url;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
return await this.client.call('get',
|
|
130
|
+
return await this.client.call('get', apiPath, {
|
|
131
131
|
'content-type': 'application/json',
|
|
132
132
|
}, payload, 'arraybuffer');
|
|
133
133
|
}
|
|
@@ -154,7 +154,7 @@ class Avatars extends Service {
|
|
|
154
154
|
* @returns {Promise}
|
|
155
155
|
*/
|
|
156
156
|
async getFlag(code, width, height, quality) {
|
|
157
|
-
|
|
157
|
+
const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
|
|
158
158
|
let payload = {};
|
|
159
159
|
if (typeof code === 'undefined') {
|
|
160
160
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
@@ -173,7 +173,7 @@ class Avatars extends Service {
|
|
|
173
173
|
payload['quality'] = quality;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
return await this.client.call('get',
|
|
176
|
+
return await this.client.call('get', apiPath, {
|
|
177
177
|
'content-type': 'application/json',
|
|
178
178
|
}, payload, 'arraybuffer');
|
|
179
179
|
}
|
|
@@ -199,7 +199,7 @@ class Avatars extends Service {
|
|
|
199
199
|
* @returns {Promise}
|
|
200
200
|
*/
|
|
201
201
|
async getImage(url, width, height) {
|
|
202
|
-
|
|
202
|
+
const apiPath = '/avatars/image';
|
|
203
203
|
let payload = {};
|
|
204
204
|
if (typeof url === 'undefined') {
|
|
205
205
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
@@ -218,7 +218,7 @@ class Avatars extends Service {
|
|
|
218
218
|
payload['height'] = height;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
return await this.client.call('get',
|
|
221
|
+
return await this.client.call('get', apiPath, {
|
|
222
222
|
'content-type': 'application/json',
|
|
223
223
|
}, payload, 'arraybuffer');
|
|
224
224
|
}
|
|
@@ -251,7 +251,7 @@ class Avatars extends Service {
|
|
|
251
251
|
* @returns {Promise}
|
|
252
252
|
*/
|
|
253
253
|
async getInitials(name, width, height, background) {
|
|
254
|
-
|
|
254
|
+
const apiPath = '/avatars/initials';
|
|
255
255
|
let payload = {};
|
|
256
256
|
|
|
257
257
|
if (typeof name !== 'undefined') {
|
|
@@ -270,7 +270,7 @@ class Avatars extends Service {
|
|
|
270
270
|
payload['background'] = background;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
return await this.client.call('get',
|
|
273
|
+
return await this.client.call('get', apiPath, {
|
|
274
274
|
'content-type': 'application/json',
|
|
275
275
|
}, payload, 'arraybuffer');
|
|
276
276
|
}
|
|
@@ -290,7 +290,7 @@ class Avatars extends Service {
|
|
|
290
290
|
* @returns {Promise}
|
|
291
291
|
*/
|
|
292
292
|
async getQR(text, size, margin, download) {
|
|
293
|
-
|
|
293
|
+
const apiPath = '/avatars/qr';
|
|
294
294
|
let payload = {};
|
|
295
295
|
if (typeof text === 'undefined') {
|
|
296
296
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
@@ -313,7 +313,7 @@ class Avatars extends Service {
|
|
|
313
313
|
payload['download'] = download;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
return await this.client.call('get',
|
|
316
|
+
return await this.client.call('get', apiPath, {
|
|
317
317
|
'content-type': 'application/json',
|
|
318
318
|
}, payload, 'arraybuffer');
|
|
319
319
|
}
|