node-appwrite 9.0.0 → 10.0.1
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/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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/docs/examples/databases/update-collection.md +1 -1
- package/docs/examples/databases/update-datetime-attribute.md +1 -1
- package/docs/examples/databases/update-document.md +1 -1
- package/docs/examples/databases/update-email-attribute.md +1 -1
- package/docs/examples/databases/update-enum-attribute.md +1 -1
- package/docs/examples/databases/update-float-attribute.md +1 -1
- package/docs/examples/databases/update-integer-attribute.md +1 -1
- package/docs/examples/databases/update-ip-attribute.md +1 -1
- package/docs/examples/databases/update-relationship-attribute.md +1 -1
- package/docs/examples/databases/update-string-attribute.md +1 -1
- package/docs/examples/databases/update-url-attribute.md +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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-name.md +1 -1
- package/docs/examples/teams/update-prefs.md +1 -1
- 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 +1 -1
- 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 +435 -55
- package/lib/client.js +4 -2
- package/lib/role.js +74 -3
- package/lib/services/account.js +94 -50
- package/lib/services/avatars.js +14 -14
- package/lib/services/databases.js +120 -90
- package/lib/services/functions.js +223 -65
- 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 +44 -34
- package/lib/services/teams.js +29 -28
- package/lib/services/users.js +135 -50
- package/package.json +2 -2
package/lib/services/users.js
CHANGED
|
@@ -26,7 +26,7 @@ class Users extends Service {
|
|
|
26
26
|
* @returns {Promise}
|
|
27
27
|
*/
|
|
28
28
|
async list(queries, search) {
|
|
29
|
-
|
|
29
|
+
const apiPath = '/users';
|
|
30
30
|
let payload = {};
|
|
31
31
|
|
|
32
32
|
if (typeof queries !== 'undefined') {
|
|
@@ -37,7 +37,7 @@ class Users extends Service {
|
|
|
37
37
|
payload['search'] = search;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return await this.client.call('get',
|
|
40
|
+
return await this.client.call('get', apiPath, {
|
|
41
41
|
'content-type': 'application/json',
|
|
42
42
|
}, payload);
|
|
43
43
|
}
|
|
@@ -56,7 +56,7 @@ class Users extends Service {
|
|
|
56
56
|
* @returns {Promise}
|
|
57
57
|
*/
|
|
58
58
|
async create(userId, email, phone, password, name) {
|
|
59
|
-
|
|
59
|
+
const apiPath = '/users';
|
|
60
60
|
let payload = {};
|
|
61
61
|
if (typeof userId === 'undefined') {
|
|
62
62
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -83,7 +83,7 @@ class Users extends Service {
|
|
|
83
83
|
payload['name'] = name;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
return await this.client.call('post',
|
|
86
|
+
return await this.client.call('post', apiPath, {
|
|
87
87
|
'content-type': 'application/json',
|
|
88
88
|
}, payload);
|
|
89
89
|
}
|
|
@@ -104,7 +104,7 @@ class Users extends Service {
|
|
|
104
104
|
* @returns {Promise}
|
|
105
105
|
*/
|
|
106
106
|
async createArgon2User(userId, email, password, name) {
|
|
107
|
-
|
|
107
|
+
const apiPath = '/users/argon2';
|
|
108
108
|
let payload = {};
|
|
109
109
|
if (typeof userId === 'undefined') {
|
|
110
110
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -135,7 +135,7 @@ class Users extends Service {
|
|
|
135
135
|
payload['name'] = name;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
return await this.client.call('post',
|
|
138
|
+
return await this.client.call('post', apiPath, {
|
|
139
139
|
'content-type': 'application/json',
|
|
140
140
|
}, payload);
|
|
141
141
|
}
|
|
@@ -156,7 +156,7 @@ class Users extends Service {
|
|
|
156
156
|
* @returns {Promise}
|
|
157
157
|
*/
|
|
158
158
|
async createBcryptUser(userId, email, password, name) {
|
|
159
|
-
|
|
159
|
+
const apiPath = '/users/bcrypt';
|
|
160
160
|
let payload = {};
|
|
161
161
|
if (typeof userId === 'undefined') {
|
|
162
162
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -187,7 +187,56 @@ class Users extends Service {
|
|
|
187
187
|
payload['name'] = name;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
return await this.client.call('post',
|
|
190
|
+
return await this.client.call('post', apiPath, {
|
|
191
|
+
'content-type': 'application/json',
|
|
192
|
+
}, payload);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* List Identities
|
|
197
|
+
*
|
|
198
|
+
* Get identities for all users.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} queries
|
|
201
|
+
* @param {string} search
|
|
202
|
+
* @throws {AppwriteException}
|
|
203
|
+
* @returns {Promise}
|
|
204
|
+
*/
|
|
205
|
+
async listIdentities(queries, search) {
|
|
206
|
+
const apiPath = '/users/identities';
|
|
207
|
+
let payload = {};
|
|
208
|
+
|
|
209
|
+
if (typeof queries !== 'undefined') {
|
|
210
|
+
payload['queries'] = queries;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (typeof search !== 'undefined') {
|
|
214
|
+
payload['search'] = search;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return await this.client.call('get', apiPath, {
|
|
218
|
+
'content-type': 'application/json',
|
|
219
|
+
}, payload);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Delete Identity
|
|
224
|
+
*
|
|
225
|
+
* Delete an identity by its unique ID.
|
|
226
|
+
*
|
|
227
|
+
* @param {string} identityId
|
|
228
|
+
* @throws {AppwriteException}
|
|
229
|
+
* @returns {Promise}
|
|
230
|
+
*/
|
|
231
|
+
async deleteIdentity(identityId) {
|
|
232
|
+
const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId);
|
|
233
|
+
let payload = {};
|
|
234
|
+
if (typeof identityId === 'undefined') {
|
|
235
|
+
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
return await this.client.call('delete', apiPath, {
|
|
191
240
|
'content-type': 'application/json',
|
|
192
241
|
}, payload);
|
|
193
242
|
}
|
|
@@ -208,7 +257,7 @@ class Users extends Service {
|
|
|
208
257
|
* @returns {Promise}
|
|
209
258
|
*/
|
|
210
259
|
async createMD5User(userId, email, password, name) {
|
|
211
|
-
|
|
260
|
+
const apiPath = '/users/md5';
|
|
212
261
|
let payload = {};
|
|
213
262
|
if (typeof userId === 'undefined') {
|
|
214
263
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -239,7 +288,7 @@ class Users extends Service {
|
|
|
239
288
|
payload['name'] = name;
|
|
240
289
|
}
|
|
241
290
|
|
|
242
|
-
return await this.client.call('post',
|
|
291
|
+
return await this.client.call('post', apiPath, {
|
|
243
292
|
'content-type': 'application/json',
|
|
244
293
|
}, payload);
|
|
245
294
|
}
|
|
@@ -260,7 +309,7 @@ class Users extends Service {
|
|
|
260
309
|
* @returns {Promise}
|
|
261
310
|
*/
|
|
262
311
|
async createPHPassUser(userId, email, password, name) {
|
|
263
|
-
|
|
312
|
+
const apiPath = '/users/phpass';
|
|
264
313
|
let payload = {};
|
|
265
314
|
if (typeof userId === 'undefined') {
|
|
266
315
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -291,7 +340,7 @@ class Users extends Service {
|
|
|
291
340
|
payload['name'] = name;
|
|
292
341
|
}
|
|
293
342
|
|
|
294
|
-
return await this.client.call('post',
|
|
343
|
+
return await this.client.call('post', apiPath, {
|
|
295
344
|
'content-type': 'application/json',
|
|
296
345
|
}, payload);
|
|
297
346
|
}
|
|
@@ -317,7 +366,7 @@ class Users extends Service {
|
|
|
317
366
|
* @returns {Promise}
|
|
318
367
|
*/
|
|
319
368
|
async createScryptUser(userId, email, password, passwordSalt, passwordCpu, passwordMemory, passwordParallel, passwordLength, name) {
|
|
320
|
-
|
|
369
|
+
const apiPath = '/users/scrypt';
|
|
321
370
|
let payload = {};
|
|
322
371
|
if (typeof userId === 'undefined') {
|
|
323
372
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -388,7 +437,7 @@ class Users extends Service {
|
|
|
388
437
|
payload['name'] = name;
|
|
389
438
|
}
|
|
390
439
|
|
|
391
|
-
return await this.client.call('post',
|
|
440
|
+
return await this.client.call('post', apiPath, {
|
|
392
441
|
'content-type': 'application/json',
|
|
393
442
|
}, payload);
|
|
394
443
|
}
|
|
@@ -412,7 +461,7 @@ class Users extends Service {
|
|
|
412
461
|
* @returns {Promise}
|
|
413
462
|
*/
|
|
414
463
|
async createScryptModifiedUser(userId, email, password, passwordSalt, passwordSaltSeparator, passwordSignerKey, name) {
|
|
415
|
-
|
|
464
|
+
const apiPath = '/users/scrypt-modified';
|
|
416
465
|
let payload = {};
|
|
417
466
|
if (typeof userId === 'undefined') {
|
|
418
467
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -467,7 +516,7 @@ class Users extends Service {
|
|
|
467
516
|
payload['name'] = name;
|
|
468
517
|
}
|
|
469
518
|
|
|
470
|
-
return await this.client.call('post',
|
|
519
|
+
return await this.client.call('post', apiPath, {
|
|
471
520
|
'content-type': 'application/json',
|
|
472
521
|
}, payload);
|
|
473
522
|
}
|
|
@@ -489,7 +538,7 @@ class Users extends Service {
|
|
|
489
538
|
* @returns {Promise}
|
|
490
539
|
*/
|
|
491
540
|
async createSHAUser(userId, email, password, passwordVersion, name) {
|
|
492
|
-
|
|
541
|
+
const apiPath = '/users/sha';
|
|
493
542
|
let payload = {};
|
|
494
543
|
if (typeof userId === 'undefined') {
|
|
495
544
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -524,7 +573,7 @@ class Users extends Service {
|
|
|
524
573
|
payload['name'] = name;
|
|
525
574
|
}
|
|
526
575
|
|
|
527
|
-
return await this.client.call('post',
|
|
576
|
+
return await this.client.call('post', apiPath, {
|
|
528
577
|
'content-type': 'application/json',
|
|
529
578
|
}, payload);
|
|
530
579
|
}
|
|
@@ -539,14 +588,14 @@ class Users extends Service {
|
|
|
539
588
|
* @returns {Promise}
|
|
540
589
|
*/
|
|
541
590
|
async get(userId) {
|
|
542
|
-
|
|
591
|
+
const apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
543
592
|
let payload = {};
|
|
544
593
|
if (typeof userId === 'undefined') {
|
|
545
594
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
546
595
|
}
|
|
547
596
|
|
|
548
597
|
|
|
549
|
-
return await this.client.call('get',
|
|
598
|
+
return await this.client.call('get', apiPath, {
|
|
550
599
|
'content-type': 'application/json',
|
|
551
600
|
}, payload);
|
|
552
601
|
}
|
|
@@ -565,14 +614,14 @@ class Users extends Service {
|
|
|
565
614
|
* @returns {Promise}
|
|
566
615
|
*/
|
|
567
616
|
async delete(userId) {
|
|
568
|
-
|
|
617
|
+
const apiPath = '/users/{userId}'.replace('{userId}', userId);
|
|
569
618
|
let payload = {};
|
|
570
619
|
if (typeof userId === 'undefined') {
|
|
571
620
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
572
621
|
}
|
|
573
622
|
|
|
574
623
|
|
|
575
|
-
return await this.client.call('delete',
|
|
624
|
+
return await this.client.call('delete', apiPath, {
|
|
576
625
|
'content-type': 'application/json',
|
|
577
626
|
}, payload);
|
|
578
627
|
}
|
|
@@ -588,7 +637,7 @@ class Users extends Service {
|
|
|
588
637
|
* @returns {Promise}
|
|
589
638
|
*/
|
|
590
639
|
async updateEmail(userId, email) {
|
|
591
|
-
|
|
640
|
+
const apiPath = '/users/{userId}/email'.replace('{userId}', userId);
|
|
592
641
|
let payload = {};
|
|
593
642
|
if (typeof userId === 'undefined') {
|
|
594
643
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -603,7 +652,43 @@ class Users extends Service {
|
|
|
603
652
|
payload['email'] = email;
|
|
604
653
|
}
|
|
605
654
|
|
|
606
|
-
return await this.client.call('patch',
|
|
655
|
+
return await this.client.call('patch', apiPath, {
|
|
656
|
+
'content-type': 'application/json',
|
|
657
|
+
}, payload);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Update User Labels
|
|
662
|
+
*
|
|
663
|
+
* Update the user labels by its unique ID.
|
|
664
|
+
*
|
|
665
|
+
* Labels can be used to grant access to resources. While teams are a way for
|
|
666
|
+
* user's to share access to a resource, labels can be defined by the
|
|
667
|
+
* developer to grant access without an invitation. See the [Permissions
|
|
668
|
+
* docs](/docs/permissions) for more info.
|
|
669
|
+
*
|
|
670
|
+
* @param {string} userId
|
|
671
|
+
* @param {string[]} labels
|
|
672
|
+
* @throws {AppwriteException}
|
|
673
|
+
* @returns {Promise}
|
|
674
|
+
*/
|
|
675
|
+
async updateLabels(userId, labels) {
|
|
676
|
+
const apiPath = '/users/{userId}/labels'.replace('{userId}', userId);
|
|
677
|
+
let payload = {};
|
|
678
|
+
if (typeof userId === 'undefined') {
|
|
679
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
if (typeof labels === 'undefined') {
|
|
683
|
+
throw new AppwriteException('Missing required parameter: "labels"');
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
if (typeof labels !== 'undefined') {
|
|
688
|
+
payload['labels'] = labels;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return await this.client.call('put', apiPath, {
|
|
607
692
|
'content-type': 'application/json',
|
|
608
693
|
}, payload);
|
|
609
694
|
}
|
|
@@ -619,7 +704,7 @@ class Users extends Service {
|
|
|
619
704
|
* @returns {Promise}
|
|
620
705
|
*/
|
|
621
706
|
async listLogs(userId, queries) {
|
|
622
|
-
|
|
707
|
+
const apiPath = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
623
708
|
let payload = {};
|
|
624
709
|
if (typeof userId === 'undefined') {
|
|
625
710
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -630,7 +715,7 @@ class Users extends Service {
|
|
|
630
715
|
payload['queries'] = queries;
|
|
631
716
|
}
|
|
632
717
|
|
|
633
|
-
return await this.client.call('get',
|
|
718
|
+
return await this.client.call('get', apiPath, {
|
|
634
719
|
'content-type': 'application/json',
|
|
635
720
|
}, payload);
|
|
636
721
|
}
|
|
@@ -645,14 +730,14 @@ class Users extends Service {
|
|
|
645
730
|
* @returns {Promise}
|
|
646
731
|
*/
|
|
647
732
|
async listMemberships(userId) {
|
|
648
|
-
|
|
733
|
+
const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
649
734
|
let payload = {};
|
|
650
735
|
if (typeof userId === 'undefined') {
|
|
651
736
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
652
737
|
}
|
|
653
738
|
|
|
654
739
|
|
|
655
|
-
return await this.client.call('get',
|
|
740
|
+
return await this.client.call('get', apiPath, {
|
|
656
741
|
'content-type': 'application/json',
|
|
657
742
|
}, payload);
|
|
658
743
|
}
|
|
@@ -668,7 +753,7 @@ class Users extends Service {
|
|
|
668
753
|
* @returns {Promise}
|
|
669
754
|
*/
|
|
670
755
|
async updateName(userId, name) {
|
|
671
|
-
|
|
756
|
+
const apiPath = '/users/{userId}/name'.replace('{userId}', userId);
|
|
672
757
|
let payload = {};
|
|
673
758
|
if (typeof userId === 'undefined') {
|
|
674
759
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -683,7 +768,7 @@ class Users extends Service {
|
|
|
683
768
|
payload['name'] = name;
|
|
684
769
|
}
|
|
685
770
|
|
|
686
|
-
return await this.client.call('patch',
|
|
771
|
+
return await this.client.call('patch', apiPath, {
|
|
687
772
|
'content-type': 'application/json',
|
|
688
773
|
}, payload);
|
|
689
774
|
}
|
|
@@ -699,7 +784,7 @@ class Users extends Service {
|
|
|
699
784
|
* @returns {Promise}
|
|
700
785
|
*/
|
|
701
786
|
async updatePassword(userId, password) {
|
|
702
|
-
|
|
787
|
+
const apiPath = '/users/{userId}/password'.replace('{userId}', userId);
|
|
703
788
|
let payload = {};
|
|
704
789
|
if (typeof userId === 'undefined') {
|
|
705
790
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -714,7 +799,7 @@ class Users extends Service {
|
|
|
714
799
|
payload['password'] = password;
|
|
715
800
|
}
|
|
716
801
|
|
|
717
|
-
return await this.client.call('patch',
|
|
802
|
+
return await this.client.call('patch', apiPath, {
|
|
718
803
|
'content-type': 'application/json',
|
|
719
804
|
}, payload);
|
|
720
805
|
}
|
|
@@ -730,7 +815,7 @@ class Users extends Service {
|
|
|
730
815
|
* @returns {Promise}
|
|
731
816
|
*/
|
|
732
817
|
async updatePhone(userId, number) {
|
|
733
|
-
|
|
818
|
+
const apiPath = '/users/{userId}/phone'.replace('{userId}', userId);
|
|
734
819
|
let payload = {};
|
|
735
820
|
if (typeof userId === 'undefined') {
|
|
736
821
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -745,7 +830,7 @@ class Users extends Service {
|
|
|
745
830
|
payload['number'] = number;
|
|
746
831
|
}
|
|
747
832
|
|
|
748
|
-
return await this.client.call('patch',
|
|
833
|
+
return await this.client.call('patch', apiPath, {
|
|
749
834
|
'content-type': 'application/json',
|
|
750
835
|
}, payload);
|
|
751
836
|
}
|
|
@@ -760,14 +845,14 @@ class Users extends Service {
|
|
|
760
845
|
* @returns {Promise}
|
|
761
846
|
*/
|
|
762
847
|
async getPrefs(userId) {
|
|
763
|
-
|
|
848
|
+
const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
764
849
|
let payload = {};
|
|
765
850
|
if (typeof userId === 'undefined') {
|
|
766
851
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
767
852
|
}
|
|
768
853
|
|
|
769
854
|
|
|
770
|
-
return await this.client.call('get',
|
|
855
|
+
return await this.client.call('get', apiPath, {
|
|
771
856
|
'content-type': 'application/json',
|
|
772
857
|
}, payload);
|
|
773
858
|
}
|
|
@@ -785,7 +870,7 @@ class Users extends Service {
|
|
|
785
870
|
* @returns {Promise}
|
|
786
871
|
*/
|
|
787
872
|
async updatePrefs(userId, prefs) {
|
|
788
|
-
|
|
873
|
+
const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
789
874
|
let payload = {};
|
|
790
875
|
if (typeof userId === 'undefined') {
|
|
791
876
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -800,7 +885,7 @@ class Users extends Service {
|
|
|
800
885
|
payload['prefs'] = prefs;
|
|
801
886
|
}
|
|
802
887
|
|
|
803
|
-
return await this.client.call('patch',
|
|
888
|
+
return await this.client.call('patch', apiPath, {
|
|
804
889
|
'content-type': 'application/json',
|
|
805
890
|
}, payload);
|
|
806
891
|
}
|
|
@@ -815,14 +900,14 @@ class Users extends Service {
|
|
|
815
900
|
* @returns {Promise}
|
|
816
901
|
*/
|
|
817
902
|
async listSessions(userId) {
|
|
818
|
-
|
|
903
|
+
const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
819
904
|
let payload = {};
|
|
820
905
|
if (typeof userId === 'undefined') {
|
|
821
906
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
822
907
|
}
|
|
823
908
|
|
|
824
909
|
|
|
825
|
-
return await this.client.call('get',
|
|
910
|
+
return await this.client.call('get', apiPath, {
|
|
826
911
|
'content-type': 'application/json',
|
|
827
912
|
}, payload);
|
|
828
913
|
}
|
|
@@ -837,14 +922,14 @@ class Users extends Service {
|
|
|
837
922
|
* @returns {Promise}
|
|
838
923
|
*/
|
|
839
924
|
async deleteSessions(userId) {
|
|
840
|
-
|
|
925
|
+
const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
841
926
|
let payload = {};
|
|
842
927
|
if (typeof userId === 'undefined') {
|
|
843
928
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
844
929
|
}
|
|
845
930
|
|
|
846
931
|
|
|
847
|
-
return await this.client.call('delete',
|
|
932
|
+
return await this.client.call('delete', apiPath, {
|
|
848
933
|
'content-type': 'application/json',
|
|
849
934
|
}, payload);
|
|
850
935
|
}
|
|
@@ -860,7 +945,7 @@ class Users extends Service {
|
|
|
860
945
|
* @returns {Promise}
|
|
861
946
|
*/
|
|
862
947
|
async deleteSession(userId, sessionId) {
|
|
863
|
-
|
|
948
|
+
const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
|
|
864
949
|
let payload = {};
|
|
865
950
|
if (typeof userId === 'undefined') {
|
|
866
951
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -871,7 +956,7 @@ class Users extends Service {
|
|
|
871
956
|
}
|
|
872
957
|
|
|
873
958
|
|
|
874
|
-
return await this.client.call('delete',
|
|
959
|
+
return await this.client.call('delete', apiPath, {
|
|
875
960
|
'content-type': 'application/json',
|
|
876
961
|
}, payload);
|
|
877
962
|
}
|
|
@@ -888,7 +973,7 @@ class Users extends Service {
|
|
|
888
973
|
* @returns {Promise}
|
|
889
974
|
*/
|
|
890
975
|
async updateStatus(userId, status) {
|
|
891
|
-
|
|
976
|
+
const apiPath = '/users/{userId}/status'.replace('{userId}', userId);
|
|
892
977
|
let payload = {};
|
|
893
978
|
if (typeof userId === 'undefined') {
|
|
894
979
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -903,7 +988,7 @@ class Users extends Service {
|
|
|
903
988
|
payload['status'] = status;
|
|
904
989
|
}
|
|
905
990
|
|
|
906
|
-
return await this.client.call('patch',
|
|
991
|
+
return await this.client.call('patch', apiPath, {
|
|
907
992
|
'content-type': 'application/json',
|
|
908
993
|
}, payload);
|
|
909
994
|
}
|
|
@@ -919,7 +1004,7 @@ class Users extends Service {
|
|
|
919
1004
|
* @returns {Promise}
|
|
920
1005
|
*/
|
|
921
1006
|
async updateEmailVerification(userId, emailVerification) {
|
|
922
|
-
|
|
1007
|
+
const apiPath = '/users/{userId}/verification'.replace('{userId}', userId);
|
|
923
1008
|
let payload = {};
|
|
924
1009
|
if (typeof userId === 'undefined') {
|
|
925
1010
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -934,7 +1019,7 @@ class Users extends Service {
|
|
|
934
1019
|
payload['emailVerification'] = emailVerification;
|
|
935
1020
|
}
|
|
936
1021
|
|
|
937
|
-
return await this.client.call('patch',
|
|
1022
|
+
return await this.client.call('patch', apiPath, {
|
|
938
1023
|
'content-type': 'application/json',
|
|
939
1024
|
}, payload);
|
|
940
1025
|
}
|
|
@@ -950,7 +1035,7 @@ class Users extends Service {
|
|
|
950
1035
|
* @returns {Promise}
|
|
951
1036
|
*/
|
|
952
1037
|
async updatePhoneVerification(userId, phoneVerification) {
|
|
953
|
-
|
|
1038
|
+
const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId);
|
|
954
1039
|
let payload = {};
|
|
955
1040
|
if (typeof userId === 'undefined') {
|
|
956
1041
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
@@ -965,7 +1050,7 @@ class Users extends Service {
|
|
|
965
1050
|
payload['phoneVerification'] = phoneVerification;
|
|
966
1051
|
}
|
|
967
1052
|
|
|
968
|
-
return await this.client.call('patch',
|
|
1053
|
+
return await this.client.call('patch', apiPath, {
|
|
969
1054
|
'content-type': 'application/json',
|
|
970
1055
|
}, payload);
|
|
971
1056
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "node-appwrite",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"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",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "10.0.1",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@types/node": "^18.16.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"axios": "^1.
|
|
17
|
+
"axios": "^1.4.0",
|
|
18
18
|
"form-data": "^4.0.0"
|
|
19
19
|
}
|
|
20
20
|
}
|