node-appwrite 7.0.0 → 8.0.0-RC1
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/databases/create-boolean-attribute.md +2 -2
- package/docs/examples/databases/create-collection.md +2 -2
- package/docs/examples/databases/create-datetime-attribute.md +20 -0
- package/docs/examples/databases/create-document.md +2 -2
- package/docs/examples/databases/create-email-attribute.md +2 -2
- package/docs/examples/databases/create-enum-attribute.md +2 -2
- package/docs/examples/databases/create-float-attribute.md +2 -2
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/databases/create-integer-attribute.md +2 -2
- package/docs/examples/databases/create-ip-attribute.md +2 -2
- package/docs/examples/databases/create-string-attribute.md +2 -2
- package/docs/examples/databases/create-url-attribute.md +2 -2
- package/docs/examples/databases/create.md +2 -2
- package/docs/examples/databases/delete-attribute.md +2 -2
- package/docs/examples/databases/delete-collection.md +2 -2
- package/docs/examples/databases/delete-document.md +2 -2
- package/docs/examples/databases/delete-index.md +2 -2
- package/docs/examples/databases/delete.md +2 -2
- package/docs/examples/databases/get-attribute.md +2 -2
- package/docs/examples/databases/get-collection.md +2 -2
- package/docs/examples/databases/get-document.md +2 -2
- package/docs/examples/databases/get-index.md +2 -2
- package/docs/examples/databases/get.md +2 -2
- package/docs/examples/databases/list-attributes.md +2 -2
- package/docs/examples/databases/list-collections.md +2 -2
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/list-indexes.md +2 -2
- package/docs/examples/databases/list.md +1 -1
- package/docs/examples/databases/update-collection.md +2 -2
- package/docs/examples/databases/update-document.md +2 -2
- package/docs/examples/databases/update.md +2 -2
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/functions/create-variable.md +20 -0
- package/docs/examples/functions/create.md +1 -1
- package/docs/examples/functions/delete-variable.md +20 -0
- package/docs/examples/functions/get-variable.md +20 -0
- package/docs/examples/functions/list-variables.md +20 -0
- package/docs/examples/functions/update-variable.md +20 -0
- package/docs/examples/functions/update.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/update-bucket.md +1 -1
- package/docs/examples/users/create-argon2user.md +20 -0
- package/docs/examples/users/create-bcrypt-user.md +20 -0
- package/docs/examples/users/create-m-d5user.md +20 -0
- package/docs/examples/users/create-p-h-pass-user.md +20 -0
- package/docs/examples/users/create-s-h-a-user.md +20 -0
- package/docs/examples/users/create-scrypt-modified-user.md +20 -0
- package/docs/examples/users/create-scrypt-user.md +20 -0
- package/docs/examples/users/create.md +1 -1
- package/index.d.ts +703 -235
- package/index.js +6 -0
- package/lib/client.js +5 -2
- package/lib/id.js +12 -0
- package/lib/permission.js +24 -0
- package/lib/query.js +30 -12
- package/lib/role.js +25 -0
- package/lib/services/account.js +53 -52
- package/lib/services/avatars.js +22 -20
- package/lib/services/databases.js +385 -243
- package/lib/services/functions.js +220 -110
- package/lib/services/health.js +7 -1
- package/lib/services/locale.js +7 -1
- package/lib/services/storage.js +78 -129
- package/lib/services/teams.js +39 -73
- package/lib/services/users.js +482 -63
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const Client = require('./lib/client.js');
|
|
2
2
|
const Query = require('./lib/query.js');
|
|
3
|
+
const Permission = require('./lib/permission.js');
|
|
4
|
+
const Role = require('./lib/role.js');
|
|
5
|
+
const ID = require('./lib/id.js');
|
|
3
6
|
const InputFile = require('./lib/inputFile.js');
|
|
4
7
|
const AppwriteException = require('./lib/exception.js');
|
|
5
8
|
const Account = require('./lib/services/account.js');
|
|
@@ -15,6 +18,9 @@ const Users = require('./lib/services/users.js');
|
|
|
15
18
|
module.exports = {
|
|
16
19
|
Client,
|
|
17
20
|
Query,
|
|
21
|
+
Permission,
|
|
22
|
+
Role,
|
|
23
|
+
ID,
|
|
18
24
|
InputFile,
|
|
19
25
|
AppwriteException,
|
|
20
26
|
Account,
|
package/lib/client.js
CHANGED
|
@@ -10,8 +10,11 @@ class Client {
|
|
|
10
10
|
this.endpoint = 'https://HOSTNAME/v1';
|
|
11
11
|
this.headers = {
|
|
12
12
|
'content-type': '',
|
|
13
|
-
'x-sdk-
|
|
14
|
-
'
|
|
13
|
+
'x-sdk-name': 'Node.js',
|
|
14
|
+
'x-sdk-platform': 'server',
|
|
15
|
+
'x-sdk-language': 'nodejs',
|
|
16
|
+
'x-sdk-version': '8.0.0-RC1',
|
|
17
|
+
'X-Appwrite-Response-Format' : '1.0.0-RC1',
|
|
15
18
|
};
|
|
16
19
|
this.selfSigned = false;
|
|
17
20
|
}
|
package/lib/id.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class Permission {
|
|
2
|
+
|
|
3
|
+
static read = (role) => {
|
|
4
|
+
return `read("${role}")`
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
static write = (role) => {
|
|
8
|
+
return `write("${role}")`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static create = (role) => {
|
|
12
|
+
return `create("${role}")`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static update = (role) => {
|
|
16
|
+
return `update("${role}")`
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static delete = (role) => {
|
|
20
|
+
return `delete("${role}")`
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = Permission;
|
package/lib/query.js
CHANGED
|
@@ -5,27 +5,45 @@ class Query {
|
|
|
5
5
|
static notEqual = (attribute, value) =>
|
|
6
6
|
Query.addQuery(attribute, "notEqual", value);
|
|
7
7
|
|
|
8
|
-
static
|
|
9
|
-
Query.addQuery(attribute, "
|
|
8
|
+
static lessThan = (attribute, value) =>
|
|
9
|
+
Query.addQuery(attribute, "lessThan", value);
|
|
10
10
|
|
|
11
|
-
static
|
|
12
|
-
Query.addQuery(attribute, "
|
|
11
|
+
static lessThanEqual = (attribute, value) =>
|
|
12
|
+
Query.addQuery(attribute, "lessThanEqual", value);
|
|
13
13
|
|
|
14
|
-
static
|
|
15
|
-
Query.addQuery(attribute, "
|
|
14
|
+
static greaterThan = (attribute, value) =>
|
|
15
|
+
Query.addQuery(attribute, "greaterThan", value);
|
|
16
16
|
|
|
17
|
-
static
|
|
18
|
-
Query.addQuery(attribute, "
|
|
17
|
+
static greaterThanEqual = (attribute, value) =>
|
|
18
|
+
Query.addQuery(attribute, "greaterThanEqual", value);
|
|
19
19
|
|
|
20
20
|
static search = (attribute, value) =>
|
|
21
21
|
Query.addQuery(attribute, "search", value);
|
|
22
22
|
|
|
23
|
-
static
|
|
23
|
+
static orderDesc = (attribute) =>
|
|
24
|
+
`orderDesc("${attribute}")`;
|
|
25
|
+
|
|
26
|
+
static orderAsc = (attribute) =>
|
|
27
|
+
`orderAsc("${attribute}")`;
|
|
28
|
+
|
|
29
|
+
static cursorAfter = (documentId) =>
|
|
30
|
+
`cursorAfter("${documentId}")`;
|
|
31
|
+
|
|
32
|
+
static cursorBefore = (documentId) =>
|
|
33
|
+
`cursorBefore("${documentId}")`;
|
|
34
|
+
|
|
35
|
+
static limit = (limit) =>
|
|
36
|
+
`limit(${limit})`;
|
|
37
|
+
|
|
38
|
+
static offset = (offset) =>
|
|
39
|
+
`offset(${offset})`;
|
|
40
|
+
|
|
41
|
+
static addQuery = (attribute, method, value) =>
|
|
24
42
|
value instanceof Array
|
|
25
|
-
? `${
|
|
43
|
+
? `${method}("${attribute}", [${value
|
|
26
44
|
.map((v) => Query.parseValues(v))
|
|
27
|
-
.join(",")})`
|
|
28
|
-
: `${
|
|
45
|
+
.join(",")}])`
|
|
46
|
+
: `${method}("${attribute}", [${Query.parseValues(value)}])`;
|
|
29
47
|
|
|
30
48
|
static parseValues = (value) =>
|
|
31
49
|
typeof value === "string" || value instanceof String
|
package/lib/role.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class Role {
|
|
2
|
+
static any = () => {
|
|
3
|
+
return 'any'
|
|
4
|
+
}
|
|
5
|
+
static user = (id) => {
|
|
6
|
+
return 'user:' + id
|
|
7
|
+
}
|
|
8
|
+
static users = () => {
|
|
9
|
+
return 'users'
|
|
10
|
+
}
|
|
11
|
+
static guests = () => {
|
|
12
|
+
return 'guests'
|
|
13
|
+
}
|
|
14
|
+
static team = (id, role = '') => {
|
|
15
|
+
if(role === '') {
|
|
16
|
+
return 'team:' + id
|
|
17
|
+
}
|
|
18
|
+
return 'team:' + id + '/' + role
|
|
19
|
+
}
|
|
20
|
+
static status = (status) => {
|
|
21
|
+
return 'status:' + status
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = Role;
|
package/lib/services/account.js
CHANGED
|
@@ -8,6 +8,12 @@ const fs = require('fs');
|
|
|
8
8
|
|
|
9
9
|
class Account extends Service {
|
|
10
10
|
|
|
11
|
+
constructor(client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Get Account
|
|
13
19
|
*
|
|
@@ -43,6 +49,8 @@ class Account extends Service {
|
|
|
43
49
|
* @returns {Promise}
|
|
44
50
|
*/
|
|
45
51
|
async updateEmail(email, password) {
|
|
52
|
+
let path = '/account/email';
|
|
53
|
+
let payload = {};
|
|
46
54
|
if (typeof email === 'undefined') {
|
|
47
55
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
48
56
|
}
|
|
@@ -51,8 +59,6 @@ class Account extends Service {
|
|
|
51
59
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
let path = '/account/email';
|
|
55
|
-
let payload = {};
|
|
56
62
|
|
|
57
63
|
if (typeof email !== 'undefined') {
|
|
58
64
|
payload['email'] = email;
|
|
@@ -73,21 +79,16 @@ class Account extends Service {
|
|
|
73
79
|
* Get currently logged in user list of latest security activity logs. Each
|
|
74
80
|
* log returns user IP address, location and date and time of log.
|
|
75
81
|
*
|
|
76
|
-
* @param {
|
|
77
|
-
* @param {number} offset
|
|
82
|
+
* @param {string[]} queries
|
|
78
83
|
* @throws {AppwriteException}
|
|
79
84
|
* @returns {Promise}
|
|
80
85
|
*/
|
|
81
|
-
async getLogs(
|
|
86
|
+
async getLogs(queries) {
|
|
82
87
|
let path = '/account/logs';
|
|
83
88
|
let payload = {};
|
|
84
89
|
|
|
85
|
-
if (typeof
|
|
86
|
-
payload['
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (typeof offset !== 'undefined') {
|
|
90
|
-
payload['offset'] = offset;
|
|
90
|
+
if (typeof queries !== 'undefined') {
|
|
91
|
+
payload['queries'] = queries;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
return await this.client.call('get', path, {
|
|
@@ -105,12 +106,12 @@ class Account extends Service {
|
|
|
105
106
|
* @returns {Promise}
|
|
106
107
|
*/
|
|
107
108
|
async updateName(name) {
|
|
109
|
+
let path = '/account/name';
|
|
110
|
+
let payload = {};
|
|
108
111
|
if (typeof name === 'undefined') {
|
|
109
112
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
let path = '/account/name';
|
|
113
|
-
let payload = {};
|
|
114
115
|
|
|
115
116
|
if (typeof name !== 'undefined') {
|
|
116
117
|
payload['name'] = name;
|
|
@@ -134,12 +135,12 @@ class Account extends Service {
|
|
|
134
135
|
* @returns {Promise}
|
|
135
136
|
*/
|
|
136
137
|
async updatePassword(password, oldPassword) {
|
|
138
|
+
let path = '/account/password';
|
|
139
|
+
let payload = {};
|
|
137
140
|
if (typeof password === 'undefined') {
|
|
138
141
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
let path = '/account/password';
|
|
142
|
-
let payload = {};
|
|
143
144
|
|
|
144
145
|
if (typeof password !== 'undefined') {
|
|
145
146
|
payload['password'] = password;
|
|
@@ -157,30 +158,31 @@ class Account extends Service {
|
|
|
157
158
|
/**
|
|
158
159
|
* Update Account Phone
|
|
159
160
|
*
|
|
160
|
-
* Update currently logged in user
|
|
161
|
-
* number, the
|
|
162
|
-
* is not sent automatically however you can use the
|
|
163
|
-
*
|
|
161
|
+
* Update the currently logged in user's phone number. After updating the
|
|
162
|
+
* phone number, the phone verification status will be reset. A confirmation
|
|
163
|
+
* SMS is not sent automatically, however you can use the [POST
|
|
164
|
+
* /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
|
|
165
|
+
* endpoint to send a confirmation SMS.
|
|
164
166
|
*
|
|
165
|
-
* @param {string}
|
|
167
|
+
* @param {string} phone
|
|
166
168
|
* @param {string} password
|
|
167
169
|
* @throws {AppwriteException}
|
|
168
170
|
* @returns {Promise}
|
|
169
171
|
*/
|
|
170
|
-
async updatePhone(
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
async updatePhone(phone, password) {
|
|
173
|
+
let path = '/account/phone';
|
|
174
|
+
let payload = {};
|
|
175
|
+
if (typeof phone === 'undefined') {
|
|
176
|
+
throw new AppwriteException('Missing required parameter: "phone"');
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
if (typeof password === 'undefined') {
|
|
176
180
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
let path = '/account/phone';
|
|
180
|
-
let payload = {};
|
|
181
183
|
|
|
182
|
-
if (typeof
|
|
183
|
-
payload['
|
|
184
|
+
if (typeof phone !== 'undefined') {
|
|
185
|
+
payload['phone'] = phone;
|
|
184
186
|
}
|
|
185
187
|
|
|
186
188
|
if (typeof password !== 'undefined') {
|
|
@@ -221,12 +223,12 @@ class Account extends Service {
|
|
|
221
223
|
* @returns {Promise}
|
|
222
224
|
*/
|
|
223
225
|
async updatePrefs(prefs) {
|
|
226
|
+
let path = '/account/prefs';
|
|
227
|
+
let payload = {};
|
|
224
228
|
if (typeof prefs === 'undefined') {
|
|
225
229
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
226
230
|
}
|
|
227
231
|
|
|
228
|
-
let path = '/account/prefs';
|
|
229
|
-
let payload = {};
|
|
230
232
|
|
|
231
233
|
if (typeof prefs !== 'undefined') {
|
|
232
234
|
payload['prefs'] = prefs;
|
|
@@ -255,6 +257,8 @@ class Account extends Service {
|
|
|
255
257
|
* @returns {Promise}
|
|
256
258
|
*/
|
|
257
259
|
async createRecovery(email, url) {
|
|
260
|
+
let path = '/account/recovery';
|
|
261
|
+
let payload = {};
|
|
258
262
|
if (typeof email === 'undefined') {
|
|
259
263
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
260
264
|
}
|
|
@@ -263,8 +267,6 @@ class Account extends Service {
|
|
|
263
267
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
264
268
|
}
|
|
265
269
|
|
|
266
|
-
let path = '/account/recovery';
|
|
267
|
-
let payload = {};
|
|
268
270
|
|
|
269
271
|
if (typeof email !== 'undefined') {
|
|
270
272
|
payload['email'] = email;
|
|
@@ -300,6 +302,8 @@ class Account extends Service {
|
|
|
300
302
|
* @returns {Promise}
|
|
301
303
|
*/
|
|
302
304
|
async updateRecovery(userId, secret, password, passwordAgain) {
|
|
305
|
+
let path = '/account/recovery';
|
|
306
|
+
let payload = {};
|
|
303
307
|
if (typeof userId === 'undefined') {
|
|
304
308
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
305
309
|
}
|
|
@@ -316,8 +320,6 @@ class Account extends Service {
|
|
|
316
320
|
throw new AppwriteException('Missing required parameter: "passwordAgain"');
|
|
317
321
|
}
|
|
318
322
|
|
|
319
|
-
let path = '/account/recovery';
|
|
320
|
-
let payload = {};
|
|
321
323
|
|
|
322
324
|
if (typeof userId !== 'undefined') {
|
|
323
325
|
payload['userId'] = userId;
|
|
@@ -387,12 +389,12 @@ class Account extends Service {
|
|
|
387
389
|
* @returns {Promise}
|
|
388
390
|
*/
|
|
389
391
|
async getSession(sessionId) {
|
|
392
|
+
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
393
|
+
let payload = {};
|
|
390
394
|
if (typeof sessionId === 'undefined') {
|
|
391
395
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
392
396
|
}
|
|
393
397
|
|
|
394
|
-
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
395
|
-
let payload = {};
|
|
396
398
|
|
|
397
399
|
return await this.client.call('get', path, {
|
|
398
400
|
'content-type': 'application/json',
|
|
@@ -411,12 +413,12 @@ class Account extends Service {
|
|
|
411
413
|
* @returns {Promise}
|
|
412
414
|
*/
|
|
413
415
|
async updateSession(sessionId) {
|
|
416
|
+
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
417
|
+
let payload = {};
|
|
414
418
|
if (typeof sessionId === 'undefined') {
|
|
415
419
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
416
420
|
}
|
|
417
421
|
|
|
418
|
-
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
419
|
-
let payload = {};
|
|
420
422
|
|
|
421
423
|
return await this.client.call('patch', path, {
|
|
422
424
|
'content-type': 'application/json',
|
|
@@ -436,12 +438,12 @@ class Account extends Service {
|
|
|
436
438
|
* @returns {Promise}
|
|
437
439
|
*/
|
|
438
440
|
async deleteSession(sessionId) {
|
|
441
|
+
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
442
|
+
let payload = {};
|
|
439
443
|
if (typeof sessionId === 'undefined') {
|
|
440
444
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
441
445
|
}
|
|
442
446
|
|
|
443
|
-
let path = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
444
|
-
let payload = {};
|
|
445
447
|
|
|
446
448
|
return await this.client.call('delete', path, {
|
|
447
449
|
'content-type': 'application/json',
|
|
@@ -491,12 +493,12 @@ class Account extends Service {
|
|
|
491
493
|
* @returns {Promise}
|
|
492
494
|
*/
|
|
493
495
|
async createVerification(url) {
|
|
496
|
+
let path = '/account/verification';
|
|
497
|
+
let payload = {};
|
|
494
498
|
if (typeof url === 'undefined') {
|
|
495
499
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
496
500
|
}
|
|
497
501
|
|
|
498
|
-
let path = '/account/verification';
|
|
499
|
-
let payload = {};
|
|
500
502
|
|
|
501
503
|
if (typeof url !== 'undefined') {
|
|
502
504
|
payload['url'] = url;
|
|
@@ -521,6 +523,8 @@ class Account extends Service {
|
|
|
521
523
|
* @returns {Promise}
|
|
522
524
|
*/
|
|
523
525
|
async updateVerification(userId, secret) {
|
|
526
|
+
let path = '/account/verification';
|
|
527
|
+
let payload = {};
|
|
524
528
|
if (typeof userId === 'undefined') {
|
|
525
529
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
526
530
|
}
|
|
@@ -529,8 +533,6 @@ class Account extends Service {
|
|
|
529
533
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
530
534
|
}
|
|
531
535
|
|
|
532
|
-
let path = '/account/verification';
|
|
533
|
-
let payload = {};
|
|
534
536
|
|
|
535
537
|
if (typeof userId !== 'undefined') {
|
|
536
538
|
payload['userId'] = userId;
|
|
@@ -548,13 +550,12 @@ class Account extends Service {
|
|
|
548
550
|
/**
|
|
549
551
|
* Create Phone Verification
|
|
550
552
|
*
|
|
551
|
-
* Use this endpoint to send a verification
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
* [complete the verification
|
|
553
|
+
* Use this endpoint to send a verification SMS to the currently logged in
|
|
554
|
+
* user. This endpoint is meant for use after updating a user's phone number
|
|
555
|
+
* using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone)
|
|
556
|
+
* endpoint. Learn more about how to [complete the verification
|
|
556
557
|
* process](/docs/client/account#accountUpdatePhoneVerification). The
|
|
557
|
-
* verification
|
|
558
|
+
* verification code sent to the user's phone number is valid for 15 minutes.
|
|
558
559
|
*
|
|
559
560
|
* @throws {AppwriteException}
|
|
560
561
|
* @returns {Promise}
|
|
@@ -582,6 +583,8 @@ class Account extends Service {
|
|
|
582
583
|
* @returns {Promise}
|
|
583
584
|
*/
|
|
584
585
|
async updatePhoneVerification(userId, secret) {
|
|
586
|
+
let path = '/account/verification/phone';
|
|
587
|
+
let payload = {};
|
|
585
588
|
if (typeof userId === 'undefined') {
|
|
586
589
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
587
590
|
}
|
|
@@ -590,8 +593,6 @@ class Account extends Service {
|
|
|
590
593
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
591
594
|
}
|
|
592
595
|
|
|
593
|
-
let path = '/account/verification/phone';
|
|
594
|
-
let payload = {};
|
|
595
596
|
|
|
596
597
|
if (typeof userId !== 'undefined') {
|
|
597
598
|
payload['userId'] = userId;
|
|
@@ -607,4 +608,4 @@ class Account extends Service {
|
|
|
607
608
|
}
|
|
608
609
|
}
|
|
609
610
|
|
|
610
|
-
module.exports = Account;
|
|
611
|
+
module.exports = Account;
|
package/lib/services/avatars.js
CHANGED
|
@@ -8,6 +8,12 @@ const fs = require('fs');
|
|
|
8
8
|
|
|
9
9
|
class Avatars extends Service {
|
|
10
10
|
|
|
11
|
+
constructor(client)
|
|
12
|
+
{
|
|
13
|
+
super(client);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* Get Browser Icon
|
|
13
19
|
*
|
|
@@ -29,12 +35,12 @@ class Avatars extends Service {
|
|
|
29
35
|
* @returns {Promise}
|
|
30
36
|
*/
|
|
31
37
|
async getBrowser(code, width, height, quality) {
|
|
38
|
+
let path = '/avatars/browsers/{code}'.replace('{code}', code);
|
|
39
|
+
let payload = {};
|
|
32
40
|
if (typeof code === 'undefined') {
|
|
33
41
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
34
42
|
}
|
|
35
43
|
|
|
36
|
-
let path = '/avatars/browsers/{code}'.replace('{code}', code);
|
|
37
|
-
let payload = {};
|
|
38
44
|
|
|
39
45
|
if (typeof width !== 'undefined') {
|
|
40
46
|
payload['width'] = width;
|
|
@@ -74,12 +80,12 @@ class Avatars extends Service {
|
|
|
74
80
|
* @returns {Promise}
|
|
75
81
|
*/
|
|
76
82
|
async getCreditCard(code, width, height, quality) {
|
|
83
|
+
let path = '/avatars/credit-cards/{code}'.replace('{code}', code);
|
|
84
|
+
let payload = {};
|
|
77
85
|
if (typeof code === 'undefined') {
|
|
78
86
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
let path = '/avatars/credit-cards/{code}'.replace('{code}', code);
|
|
82
|
-
let payload = {};
|
|
83
89
|
|
|
84
90
|
if (typeof width !== 'undefined') {
|
|
85
91
|
payload['width'] = width;
|
|
@@ -110,12 +116,12 @@ class Avatars extends Service {
|
|
|
110
116
|
* @returns {Promise}
|
|
111
117
|
*/
|
|
112
118
|
async getFavicon(url) {
|
|
119
|
+
let path = '/avatars/favicon';
|
|
120
|
+
let payload = {};
|
|
113
121
|
if (typeof url === 'undefined') {
|
|
114
122
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
let path = '/avatars/favicon';
|
|
118
|
-
let payload = {};
|
|
119
125
|
|
|
120
126
|
if (typeof url !== 'undefined') {
|
|
121
127
|
payload['url'] = url;
|
|
@@ -131,7 +137,8 @@ class Avatars extends Service {
|
|
|
131
137
|
*
|
|
132
138
|
* You can use this endpoint to show different country flags icons to your
|
|
133
139
|
* users. The code argument receives the 2 letter country code. Use width,
|
|
134
|
-
* height and quality arguments to change the output settings.
|
|
140
|
+
* height and quality arguments to change the output settings. Country codes
|
|
141
|
+
* follow the [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) standard.
|
|
135
142
|
*
|
|
136
143
|
* When one dimension is specified and the other is 0, the image is scaled
|
|
137
144
|
* with preserved aspect ratio. If both dimensions are 0, the API provides an
|
|
@@ -147,12 +154,12 @@ class Avatars extends Service {
|
|
|
147
154
|
* @returns {Promise}
|
|
148
155
|
*/
|
|
149
156
|
async getFlag(code, width, height, quality) {
|
|
157
|
+
let path = '/avatars/flags/{code}'.replace('{code}', code);
|
|
158
|
+
let payload = {};
|
|
150
159
|
if (typeof code === 'undefined') {
|
|
151
160
|
throw new AppwriteException('Missing required parameter: "code"');
|
|
152
161
|
}
|
|
153
162
|
|
|
154
|
-
let path = '/avatars/flags/{code}'.replace('{code}', code);
|
|
155
|
-
let payload = {};
|
|
156
163
|
|
|
157
164
|
if (typeof width !== 'undefined') {
|
|
158
165
|
payload['width'] = width;
|
|
@@ -192,12 +199,12 @@ class Avatars extends Service {
|
|
|
192
199
|
* @returns {Promise}
|
|
193
200
|
*/
|
|
194
201
|
async getImage(url, width, height) {
|
|
202
|
+
let path = '/avatars/image';
|
|
203
|
+
let payload = {};
|
|
195
204
|
if (typeof url === 'undefined') {
|
|
196
205
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
let path = '/avatars/image';
|
|
200
|
-
let payload = {};
|
|
201
208
|
|
|
202
209
|
if (typeof url !== 'undefined') {
|
|
203
210
|
payload['url'] = url;
|
|
@@ -239,12 +246,11 @@ class Avatars extends Service {
|
|
|
239
246
|
* @param {string} name
|
|
240
247
|
* @param {number} width
|
|
241
248
|
* @param {number} height
|
|
242
|
-
* @param {string} color
|
|
243
249
|
* @param {string} background
|
|
244
250
|
* @throws {AppwriteException}
|
|
245
251
|
* @returns {Promise}
|
|
246
252
|
*/
|
|
247
|
-
async getInitials(name, width, height,
|
|
253
|
+
async getInitials(name, width, height, background) {
|
|
248
254
|
let path = '/avatars/initials';
|
|
249
255
|
let payload = {};
|
|
250
256
|
|
|
@@ -260,10 +266,6 @@ class Avatars extends Service {
|
|
|
260
266
|
payload['height'] = height;
|
|
261
267
|
}
|
|
262
268
|
|
|
263
|
-
if (typeof color !== 'undefined') {
|
|
264
|
-
payload['color'] = color;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
269
|
if (typeof background !== 'undefined') {
|
|
268
270
|
payload['background'] = background;
|
|
269
271
|
}
|
|
@@ -288,12 +290,12 @@ class Avatars extends Service {
|
|
|
288
290
|
* @returns {Promise}
|
|
289
291
|
*/
|
|
290
292
|
async getQR(text, size, margin, download) {
|
|
293
|
+
let path = '/avatars/qr';
|
|
294
|
+
let payload = {};
|
|
291
295
|
if (typeof text === 'undefined') {
|
|
292
296
|
throw new AppwriteException('Missing required parameter: "text"');
|
|
293
297
|
}
|
|
294
298
|
|
|
295
|
-
let path = '/avatars/qr';
|
|
296
|
-
let payload = {};
|
|
297
299
|
|
|
298
300
|
if (typeof text !== 'undefined') {
|
|
299
301
|
payload['text'] = text;
|
|
@@ -317,4 +319,4 @@ class Avatars extends Service {
|
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
321
|
|
|
320
|
-
module.exports = Avatars;
|
|
322
|
+
module.exports = Avatars;
|