@appwrite.io/console 0.2.0 → 0.3.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/dist/cjs/sdk.js +2332 -633
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +2329 -634
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +2332 -633
- package/docs/examples/account/create-anonymous-session.md +1 -1
- package/docs/examples/account/create-email-session.md +1 -1
- package/docs/examples/account/create-j-w-t.md +1 -1
- package/docs/examples/account/create-magic-u-r-l-session.md +1 -1
- package/docs/examples/account/create-o-auth2session.md +1 -1
- package/docs/examples/account/create-phone-session.md +1 -1
- 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/create-with-invite-code.md +1 -1
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/delete-identity.md +18 -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 +18 -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-magic-u-r-l-session.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-session.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/assistant/chat.md +18 -0
- 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/console/variables.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-usage.md +1 -1
- package/docs/examples/databases/get-collection.md +1 -1
- package/docs/examples/databases/get-database-usage.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-usage.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-collection-logs.md +1 -1
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.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-logs.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 +14 -0
- package/docs/examples/functions/get-deployment.md +1 -1
- package/docs/examples/functions/get-execution.md +1 -1
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/get-usage.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 +1 -1
- 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 +1 -1
- 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 +18 -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/migrations/create-appwrite-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-migration.md +18 -0
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +18 -0
- package/docs/examples/migrations/create-n-host-migration.md +18 -0
- package/docs/examples/migrations/create-supabase-migration.md +18 -0
- package/docs/examples/migrations/delete-firebase-auth.md +18 -0
- package/docs/examples/migrations/delete.md +18 -0
- package/docs/examples/migrations/get-appwrite-report.md +18 -0
- package/docs/examples/migrations/get-firebase-report-o-auth.md +18 -0
- package/docs/examples/migrations/get-firebase-report.md +18 -0
- package/docs/examples/migrations/get-n-host-report.md +18 -0
- package/docs/examples/migrations/get-supabase-report.md +18 -0
- package/docs/examples/migrations/get.md +18 -0
- package/docs/examples/migrations/list-firebase-projects.md +18 -0
- package/docs/examples/migrations/list.md +18 -0
- package/docs/examples/migrations/retry.md +18 -0
- package/docs/examples/project/create-variable.md +18 -0
- package/docs/examples/project/delete-variable.md +18 -0
- package/docs/examples/project/get-usage.md +1 -1
- package/docs/examples/project/get-variable.md +18 -0
- package/docs/examples/project/list-variables.md +18 -0
- package/docs/examples/project/update-variable.md +18 -0
- package/docs/examples/projects/create-key.md +1 -1
- package/docs/examples/projects/create-platform.md +1 -1
- package/docs/examples/projects/create-webhook.md +1 -1
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +18 -0
- package/docs/examples/projects/delete-key.md +1 -1
- package/docs/examples/projects/delete-platform.md +1 -1
- package/docs/examples/projects/delete-sms-template.md +18 -0
- package/docs/examples/projects/delete-webhook.md +1 -1
- package/docs/examples/projects/delete.md +2 -2
- package/docs/examples/projects/get-email-template.md +18 -0
- package/docs/examples/projects/get-key.md +1 -1
- package/docs/examples/projects/get-platform.md +1 -1
- package/docs/examples/projects/get-sms-template.md +18 -0
- package/docs/examples/projects/{list-domains.md → get-usage.md} +2 -2
- package/docs/examples/projects/get-webhook.md +1 -1
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-keys.md +1 -1
- package/docs/examples/projects/list-platforms.md +1 -1
- package/docs/examples/projects/list-webhooks.md +1 -1
- package/docs/examples/projects/list.md +1 -1
- package/docs/examples/projects/update-auth-duration.md +1 -1
- package/docs/examples/projects/update-auth-limit.md +1 -1
- package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
- package/docs/examples/projects/update-auth-password-history.md +1 -1
- package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
- package/docs/examples/projects/update-auth-status.md +1 -1
- package/docs/examples/projects/update-email-template.md +18 -0
- package/docs/examples/projects/update-key.md +1 -1
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/{get-domain.md → update-personal-data-check.md} +2 -2
- package/docs/examples/projects/update-platform.md +1 -1
- package/docs/examples/projects/{delete-domain.md → update-service-status-all.md} +2 -2
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-sms-template.md +18 -0
- package/docs/examples/projects/update-smtp-configuration.md +18 -0
- package/docs/examples/projects/{create-domain.md → update-team.md} +2 -2
- package/docs/examples/projects/update-webhook-signature.md +1 -1
- package/docs/examples/projects/update-webhook.md +1 -1
- package/docs/examples/projects/update.md +1 -1
- package/docs/examples/proxy/create-rule.md +18 -0
- package/docs/examples/proxy/delete-rule.md +18 -0
- package/docs/examples/proxy/get-rule.md +18 -0
- package/docs/examples/proxy/list-rules.md +18 -0
- package/docs/examples/proxy/update-rule-verification.md +18 -0
- 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-usage.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/get-usage.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-logs.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 +18 -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-usage.md +1 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +18 -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 +18 -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/docs/examples/vcs/create-repository-detection.md +18 -0
- package/docs/examples/vcs/create-repository.md +18 -0
- package/docs/examples/vcs/delete-installation.md +18 -0
- package/docs/examples/vcs/get-installation.md +18 -0
- package/docs/examples/vcs/get-repository.md +18 -0
- package/docs/examples/vcs/list-installations.md +18 -0
- package/docs/examples/vcs/list-repositories.md +18 -0
- package/docs/examples/vcs/list-repository-branches.md +18 -0
- package/docs/examples/vcs/update-external-deployments.md +18 -0
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/index.ts +4 -0
- package/src/models.ts +905 -114
- package/src/services/account.ts +1102 -1055
- package/src/services/assistant.ts +38 -0
- package/src/services/avatars.ts +337 -337
- package/src/services/console.ts +16 -16
- package/src/services/databases.ts +2170 -2140
- package/src/services/functions.ts +808 -652
- package/src/services/graphql.ts +47 -47
- package/src/services/health.ts +226 -226
- package/src/services/locale.ts +156 -137
- package/src/services/migrations.ts +707 -0
- package/src/services/project.ts +160 -20
- package/src/services/projects.ts +1538 -1256
- package/src/services/proxy.ts +150 -0
- package/src/services/storage.ts +576 -571
- package/src/services/teams.ts +502 -501
- package/src/services/users.ts +1094 -1001
- package/src/services/vcs.ts +272 -0
- package/types/index.d.ts +4 -0
- package/types/models.d.ts +905 -114
- package/types/services/account.d.ts +62 -41
- package/types/services/assistant.d.ts +14 -0
- package/types/services/avatars.d.ts +7 -7
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +60 -54
- package/types/services/functions.d.ts +66 -31
- package/types/services/graphql.d.ts +2 -2
- package/types/services/health.d.ts +12 -12
- package/types/services/locale.d.ts +17 -7
- package/types/services/migrations.d.ts +185 -0
- package/types/services/project.d.ts +56 -1
- package/types/services/projects.d.ts +159 -79
- package/types/services/proxy.d.ts +59 -0
- package/types/services/storage.d.ts +18 -17
- package/types/services/teams.d.ts +17 -16
- package/types/services/users.d.ts +65 -27
- package/types/services/vcs.d.ts +97 -0
- package/docs/examples/projects/update-domain-verification.md +0 -18
package/src/services/users.ts
CHANGED
|
@@ -10,1006 +10,1099 @@ export class Users extends Service {
|
|
|
10
10
|
super(client);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (typeof search !== 'undefined') {
|
|
33
|
-
payload['search'] = search;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
37
|
-
return await this.client.call('get', uri, {
|
|
38
|
-
'content-type': 'application/json',
|
|
39
|
-
}, payload);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Create User
|
|
44
|
-
*
|
|
45
|
-
* Create a new user.
|
|
46
|
-
*
|
|
47
|
-
* @param {string} userId
|
|
48
|
-
* @param {string} email
|
|
49
|
-
* @param {string} phone
|
|
50
|
-
* @param {string} password
|
|
51
|
-
* @param {string} name
|
|
52
|
-
* @throws {AppwriteException}
|
|
53
|
-
* @returns {Promise}
|
|
54
|
-
*/
|
|
55
|
-
async create<Preferences extends Models.Preferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>> {
|
|
56
|
-
if (typeof userId === 'undefined') {
|
|
57
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
let path = '/users';
|
|
61
|
-
let payload: Payload = {};
|
|
62
|
-
|
|
63
|
-
if (typeof userId !== 'undefined') {
|
|
64
|
-
payload['userId'] = userId;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (typeof email !== 'undefined') {
|
|
68
|
-
payload['email'] = email;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (typeof phone !== 'undefined') {
|
|
72
|
-
payload['phone'] = phone;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (typeof password !== 'undefined') {
|
|
76
|
-
payload['password'] = password;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (typeof name !== 'undefined') {
|
|
80
|
-
payload['name'] = name;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
84
|
-
return await this.client.call('post', uri, {
|
|
85
|
-
'content-type': 'application/json',
|
|
86
|
-
}, payload);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Create User with Argon2 Password
|
|
91
|
-
*
|
|
92
|
-
* Create a new user. Password provided must be hashed with the
|
|
93
|
-
* [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
|
|
94
|
-
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
95
|
-
* plain text password.
|
|
96
|
-
*
|
|
97
|
-
* @param {string} userId
|
|
98
|
-
* @param {string} email
|
|
99
|
-
* @param {string} password
|
|
100
|
-
* @param {string} name
|
|
101
|
-
* @throws {AppwriteException}
|
|
102
|
-
* @returns {Promise}
|
|
103
|
-
*/
|
|
104
|
-
async createArgon2User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
105
|
-
if (typeof userId === 'undefined') {
|
|
106
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (typeof email === 'undefined') {
|
|
110
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (typeof password === 'undefined') {
|
|
114
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
let path = '/users/argon2';
|
|
118
|
-
let payload: Payload = {};
|
|
119
|
-
|
|
120
|
-
if (typeof userId !== 'undefined') {
|
|
121
|
-
payload['userId'] = userId;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (typeof email !== 'undefined') {
|
|
125
|
-
payload['email'] = email;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (typeof password !== 'undefined') {
|
|
129
|
-
payload['password'] = password;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (typeof name !== 'undefined') {
|
|
133
|
-
payload['name'] = name;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
137
|
-
return await this.client.call('post', uri, {
|
|
138
|
-
'content-type': 'application/json',
|
|
139
|
-
}, payload);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Create User with Bcrypt Password
|
|
144
|
-
*
|
|
145
|
-
* Create a new user. Password provided must be hashed with the
|
|
146
|
-
* [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
|
|
147
|
-
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
148
|
-
* plain text password.
|
|
149
|
-
*
|
|
150
|
-
* @param {string} userId
|
|
151
|
-
* @param {string} email
|
|
152
|
-
* @param {string} password
|
|
153
|
-
* @param {string} name
|
|
154
|
-
* @throws {AppwriteException}
|
|
155
|
-
* @returns {Promise}
|
|
156
|
-
*/
|
|
157
|
-
async createBcryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
158
|
-
if (typeof userId === 'undefined') {
|
|
159
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (typeof email === 'undefined') {
|
|
163
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (typeof password === 'undefined') {
|
|
167
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let path = '/users/bcrypt';
|
|
171
|
-
let payload: Payload = {};
|
|
172
|
-
|
|
173
|
-
if (typeof userId !== 'undefined') {
|
|
174
|
-
payload['userId'] = userId;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (typeof email !== 'undefined') {
|
|
178
|
-
payload['email'] = email;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (typeof password !== 'undefined') {
|
|
182
|
-
payload['password'] = password;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (typeof name !== 'undefined') {
|
|
186
|
-
payload['name'] = name;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
190
|
-
return await this.client.call('post', uri, {
|
|
191
|
-
'content-type': 'application/json',
|
|
192
|
-
}, payload);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Create User with MD5 Password
|
|
197
|
-
*
|
|
198
|
-
* Create a new user. Password provided must be hashed with the
|
|
199
|
-
* [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
|
|
200
|
-
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
201
|
-
* plain text password.
|
|
202
|
-
*
|
|
203
|
-
* @param {string} userId
|
|
204
|
-
* @param {string} email
|
|
205
|
-
* @param {string} password
|
|
206
|
-
* @param {string} name
|
|
207
|
-
* @throws {AppwriteException}
|
|
208
|
-
* @returns {Promise}
|
|
209
|
-
*/
|
|
210
|
-
async createMD5User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
211
|
-
if (typeof userId === 'undefined') {
|
|
212
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (typeof email === 'undefined') {
|
|
216
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (typeof password === 'undefined') {
|
|
220
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
let path = '/users/md5';
|
|
224
|
-
let payload: Payload = {};
|
|
225
|
-
|
|
226
|
-
if (typeof userId !== 'undefined') {
|
|
227
|
-
payload['userId'] = userId;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (typeof email !== 'undefined') {
|
|
231
|
-
payload['email'] = email;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (typeof password !== 'undefined') {
|
|
235
|
-
payload['password'] = password;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (typeof name !== 'undefined') {
|
|
239
|
-
payload['name'] = name;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
243
|
-
return await this.client.call('post', uri, {
|
|
244
|
-
'content-type': 'application/json',
|
|
245
|
-
}, payload);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Create User with PHPass Password
|
|
250
|
-
*
|
|
251
|
-
* Create a new user. Password provided must be hashed with the
|
|
252
|
-
* [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
|
|
253
|
-
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
254
|
-
* plain text password.
|
|
255
|
-
*
|
|
256
|
-
* @param {string} userId
|
|
257
|
-
* @param {string} email
|
|
258
|
-
* @param {string} password
|
|
259
|
-
* @param {string} name
|
|
260
|
-
* @throws {AppwriteException}
|
|
261
|
-
* @returns {Promise}
|
|
262
|
-
*/
|
|
263
|
-
async createPHPassUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
264
|
-
if (typeof userId === 'undefined') {
|
|
265
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (typeof email === 'undefined') {
|
|
269
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (typeof password === 'undefined') {
|
|
273
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
let path = '/users/phpass';
|
|
277
|
-
let payload: Payload = {};
|
|
278
|
-
|
|
279
|
-
if (typeof userId !== 'undefined') {
|
|
280
|
-
payload['userId'] = userId;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (typeof email !== 'undefined') {
|
|
284
|
-
payload['email'] = email;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (typeof password !== 'undefined') {
|
|
288
|
-
payload['password'] = password;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (typeof name !== 'undefined') {
|
|
292
|
-
payload['name'] = name;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
296
|
-
return await this.client.call('post', uri, {
|
|
297
|
-
'content-type': 'application/json',
|
|
298
|
-
}, payload);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Create User with Scrypt Password
|
|
303
|
-
*
|
|
304
|
-
* Create a new user. Password provided must be hashed with the
|
|
305
|
-
* [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
|
|
306
|
-
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
307
|
-
* plain text password.
|
|
308
|
-
*
|
|
309
|
-
* @param {string} userId
|
|
310
|
-
* @param {string} email
|
|
311
|
-
* @param {string} password
|
|
312
|
-
* @param {string} passwordSalt
|
|
313
|
-
* @param {number} passwordCpu
|
|
314
|
-
* @param {number} passwordMemory
|
|
315
|
-
* @param {number} passwordParallel
|
|
316
|
-
* @param {number} passwordLength
|
|
317
|
-
* @param {string} name
|
|
318
|
-
* @throws {AppwriteException}
|
|
319
|
-
* @returns {Promise}
|
|
320
|
-
*/
|
|
321
|
-
async createScryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>> {
|
|
322
|
-
if (typeof userId === 'undefined') {
|
|
323
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (typeof email === 'undefined') {
|
|
327
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
if (typeof password === 'undefined') {
|
|
331
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (typeof passwordSalt === 'undefined') {
|
|
335
|
-
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
if (typeof passwordCpu === 'undefined') {
|
|
339
|
-
throw new AppwriteException('Missing required parameter: "passwordCpu"');
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (typeof passwordMemory === 'undefined') {
|
|
343
|
-
throw new AppwriteException('Missing required parameter: "passwordMemory"');
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (typeof passwordParallel === 'undefined') {
|
|
347
|
-
throw new AppwriteException('Missing required parameter: "passwordParallel"');
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (typeof passwordLength === 'undefined') {
|
|
351
|
-
throw new AppwriteException('Missing required parameter: "passwordLength"');
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
let path = '/users/scrypt';
|
|
355
|
-
let payload: Payload = {};
|
|
356
|
-
|
|
357
|
-
if (typeof userId !== 'undefined') {
|
|
358
|
-
payload['userId'] = userId;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (typeof email !== 'undefined') {
|
|
362
|
-
payload['email'] = email;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
if (typeof password !== 'undefined') {
|
|
366
|
-
payload['password'] = password;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (typeof passwordSalt !== 'undefined') {
|
|
370
|
-
payload['passwordSalt'] = passwordSalt;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (typeof passwordCpu !== 'undefined') {
|
|
374
|
-
payload['passwordCpu'] = passwordCpu;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (typeof passwordMemory !== 'undefined') {
|
|
378
|
-
payload['passwordMemory'] = passwordMemory;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (typeof passwordParallel !== 'undefined') {
|
|
382
|
-
payload['passwordParallel'] = passwordParallel;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (typeof passwordLength !== 'undefined') {
|
|
386
|
-
payload['passwordLength'] = passwordLength;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (typeof name !== 'undefined') {
|
|
390
|
-
payload['name'] = name;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
394
|
-
return await this.client.call('post', uri, {
|
|
395
|
-
'content-type': 'application/json',
|
|
396
|
-
}, payload);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Create User with Scrypt Modified Password
|
|
401
|
-
*
|
|
402
|
-
* Create a new user. Password provided must be hashed with the [Scrypt
|
|
403
|
-
* Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
|
|
404
|
-
* algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint
|
|
405
|
-
* to create users with a plain text password.
|
|
406
|
-
*
|
|
407
|
-
* @param {string} userId
|
|
408
|
-
* @param {string} email
|
|
409
|
-
* @param {string} password
|
|
410
|
-
* @param {string} passwordSalt
|
|
411
|
-
* @param {string} passwordSaltSeparator
|
|
412
|
-
* @param {string} passwordSignerKey
|
|
413
|
-
* @param {string} name
|
|
414
|
-
* @throws {AppwriteException}
|
|
415
|
-
* @returns {Promise}
|
|
416
|
-
*/
|
|
417
|
-
async createScryptModifiedUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>> {
|
|
418
|
-
if (typeof userId === 'undefined') {
|
|
419
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
if (typeof email === 'undefined') {
|
|
423
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
if (typeof password === 'undefined') {
|
|
427
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (typeof passwordSalt === 'undefined') {
|
|
431
|
-
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (typeof passwordSaltSeparator === 'undefined') {
|
|
435
|
-
throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"');
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (typeof passwordSignerKey === 'undefined') {
|
|
439
|
-
throw new AppwriteException('Missing required parameter: "passwordSignerKey"');
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
let path = '/users/scrypt-modified';
|
|
443
|
-
let payload: Payload = {};
|
|
444
|
-
|
|
445
|
-
if (typeof userId !== 'undefined') {
|
|
446
|
-
payload['userId'] = userId;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
if (typeof email !== 'undefined') {
|
|
450
|
-
payload['email'] = email;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
if (typeof password !== 'undefined') {
|
|
454
|
-
payload['password'] = password;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
if (typeof passwordSalt !== 'undefined') {
|
|
458
|
-
payload['passwordSalt'] = passwordSalt;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
if (typeof passwordSaltSeparator !== 'undefined') {
|
|
462
|
-
payload['passwordSaltSeparator'] = passwordSaltSeparator;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (typeof passwordSignerKey !== 'undefined') {
|
|
466
|
-
payload['passwordSignerKey'] = passwordSignerKey;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (typeof name !== 'undefined') {
|
|
470
|
-
payload['name'] = name;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
474
|
-
return await this.client.call('post', uri, {
|
|
475
|
-
'content-type': 'application/json',
|
|
476
|
-
}, payload);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Create User with SHA Password
|
|
481
|
-
*
|
|
482
|
-
* Create a new user. Password provided must be hashed with the
|
|
483
|
-
* [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
|
|
484
|
-
* the [POST /users](/docs/server/users#usersCreate) endpoint to create users
|
|
485
|
-
* with a plain text password.
|
|
486
|
-
*
|
|
487
|
-
* @param {string} userId
|
|
488
|
-
* @param {string} email
|
|
489
|
-
* @param {string} password
|
|
490
|
-
* @param {string} passwordVersion
|
|
491
|
-
* @param {string} name
|
|
492
|
-
* @throws {AppwriteException}
|
|
493
|
-
* @returns {Promise}
|
|
494
|
-
*/
|
|
495
|
-
async createSHAUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordVersion?: string, name?: string): Promise<Models.User<Preferences>> {
|
|
496
|
-
if (typeof userId === 'undefined') {
|
|
497
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
if (typeof email === 'undefined') {
|
|
501
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (typeof password === 'undefined') {
|
|
505
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
let path = '/users/sha';
|
|
509
|
-
let payload: Payload = {};
|
|
510
|
-
|
|
511
|
-
if (typeof userId !== 'undefined') {
|
|
512
|
-
payload['userId'] = userId;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (typeof email !== 'undefined') {
|
|
516
|
-
payload['email'] = email;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
if (typeof password !== 'undefined') {
|
|
520
|
-
payload['password'] = password;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
if (typeof passwordVersion !== 'undefined') {
|
|
524
|
-
payload['passwordVersion'] = passwordVersion;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
if (typeof name !== 'undefined') {
|
|
528
|
-
payload['name'] = name;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
532
|
-
return await this.client.call('post', uri, {
|
|
533
|
-
'content-type': 'application/json',
|
|
534
|
-
}, payload);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
/**
|
|
538
|
-
* Get usage stats for the users API
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
* @param {string} range
|
|
542
|
-
* @throws {AppwriteException}
|
|
543
|
-
* @returns {Promise}
|
|
544
|
-
*/
|
|
545
|
-
async getUsage(range?: string): Promise<Models.UsageUsers> {
|
|
546
|
-
let path = '/users/usage';
|
|
547
|
-
let payload: Payload = {};
|
|
548
|
-
|
|
549
|
-
if (typeof range !== 'undefined') {
|
|
550
|
-
payload['range'] = range;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
554
|
-
return await this.client.call('get', uri, {
|
|
555
|
-
'content-type': 'application/json',
|
|
556
|
-
}, payload);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* Get User
|
|
561
|
-
*
|
|
562
|
-
* Get a user by its unique ID.
|
|
563
|
-
*
|
|
564
|
-
* @param {string} userId
|
|
565
|
-
* @throws {AppwriteException}
|
|
566
|
-
* @returns {Promise}
|
|
567
|
-
*/
|
|
568
|
-
async get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>> {
|
|
569
|
-
if (typeof userId === 'undefined') {
|
|
570
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
let path = '/users/{userId}'.replace('{userId}', userId);
|
|
574
|
-
let payload: Payload = {};
|
|
575
|
-
|
|
576
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
577
|
-
return await this.client.call('get', uri, {
|
|
578
|
-
'content-type': 'application/json',
|
|
579
|
-
}, payload);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Delete User
|
|
584
|
-
*
|
|
585
|
-
* Delete a user by its unique ID, thereby releasing it's ID. Since ID is
|
|
586
|
-
* released and can be reused, all user-related resources like documents or
|
|
587
|
-
* storage files should be deleted before user deletion. If you want to keep
|
|
588
|
-
* ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
|
|
589
|
-
* endpoint instead.
|
|
590
|
-
*
|
|
591
|
-
* @param {string} userId
|
|
592
|
-
* @throws {AppwriteException}
|
|
593
|
-
* @returns {Promise}
|
|
594
|
-
*/
|
|
595
|
-
async delete(userId: string): Promise<{}> {
|
|
596
|
-
if (typeof userId === 'undefined') {
|
|
597
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
let path = '/users/{userId}'.replace('{userId}', userId);
|
|
601
|
-
let payload: Payload = {};
|
|
602
|
-
|
|
603
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
604
|
-
return await this.client.call('delete', uri, {
|
|
605
|
-
'content-type': 'application/json',
|
|
606
|
-
}, payload);
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Update Email
|
|
611
|
-
*
|
|
612
|
-
* Update the user email by its unique ID.
|
|
613
|
-
*
|
|
614
|
-
* @param {string} userId
|
|
615
|
-
* @param {string} email
|
|
616
|
-
* @throws {AppwriteException}
|
|
617
|
-
* @returns {Promise}
|
|
618
|
-
*/
|
|
619
|
-
async updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>> {
|
|
620
|
-
if (typeof userId === 'undefined') {
|
|
621
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
if (typeof email === 'undefined') {
|
|
625
|
-
throw new AppwriteException('Missing required parameter: "email"');
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
let path = '/users/{userId}/email'.replace('{userId}', userId);
|
|
629
|
-
let payload: Payload = {};
|
|
630
|
-
|
|
631
|
-
if (typeof email !== 'undefined') {
|
|
632
|
-
payload['email'] = email;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
636
|
-
return await this.client.call('patch', uri, {
|
|
637
|
-
'content-type': 'application/json',
|
|
638
|
-
}, payload);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* List User Logs
|
|
643
|
-
*
|
|
644
|
-
* Get the user activity logs list by its unique ID.
|
|
645
|
-
*
|
|
646
|
-
* @param {string} userId
|
|
647
|
-
* @param {string[]} queries
|
|
648
|
-
* @throws {AppwriteException}
|
|
649
|
-
* @returns {Promise}
|
|
650
|
-
*/
|
|
651
|
-
async listLogs(userId: string, queries?: string[]): Promise<Models.LogList> {
|
|
652
|
-
if (typeof userId === 'undefined') {
|
|
653
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
let path = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
657
|
-
let payload: Payload = {};
|
|
658
|
-
|
|
659
|
-
if (typeof queries !== 'undefined') {
|
|
660
|
-
payload['queries'] = queries;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
664
|
-
return await this.client.call('get', uri, {
|
|
665
|
-
'content-type': 'application/json',
|
|
666
|
-
}, payload);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* List User Memberships
|
|
671
|
-
*
|
|
672
|
-
* Get the user membership list by its unique ID.
|
|
673
|
-
*
|
|
674
|
-
* @param {string} userId
|
|
675
|
-
* @throws {AppwriteException}
|
|
676
|
-
* @returns {Promise}
|
|
677
|
-
*/
|
|
678
|
-
async listMemberships(userId: string): Promise<Models.MembershipList> {
|
|
679
|
-
if (typeof userId === 'undefined') {
|
|
680
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
let path = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
684
|
-
let payload: Payload = {};
|
|
685
|
-
|
|
686
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
687
|
-
return await this.client.call('get', uri, {
|
|
688
|
-
'content-type': 'application/json',
|
|
689
|
-
}, payload);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Update Name
|
|
694
|
-
*
|
|
695
|
-
* Update the user name by its unique ID.
|
|
696
|
-
*
|
|
697
|
-
* @param {string} userId
|
|
698
|
-
* @param {string} name
|
|
699
|
-
* @throws {AppwriteException}
|
|
700
|
-
* @returns {Promise}
|
|
701
|
-
*/
|
|
702
|
-
async updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>> {
|
|
703
|
-
if (typeof userId === 'undefined') {
|
|
704
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
if (typeof name === 'undefined') {
|
|
708
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
let path = '/users/{userId}/name'.replace('{userId}', userId);
|
|
712
|
-
let payload: Payload = {};
|
|
713
|
-
|
|
714
|
-
if (typeof name !== 'undefined') {
|
|
715
|
-
payload['name'] = name;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
719
|
-
return await this.client.call('patch', uri, {
|
|
720
|
-
'content-type': 'application/json',
|
|
721
|
-
}, payload);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Update Password
|
|
726
|
-
*
|
|
727
|
-
* Update the user password by its unique ID.
|
|
728
|
-
*
|
|
729
|
-
* @param {string} userId
|
|
730
|
-
* @param {string} password
|
|
731
|
-
* @throws {AppwriteException}
|
|
732
|
-
* @returns {Promise}
|
|
733
|
-
*/
|
|
734
|
-
async updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>> {
|
|
735
|
-
if (typeof userId === 'undefined') {
|
|
736
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
if (typeof password === 'undefined') {
|
|
740
|
-
throw new AppwriteException('Missing required parameter: "password"');
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
let path = '/users/{userId}/password'.replace('{userId}', userId);
|
|
744
|
-
let payload: Payload = {};
|
|
745
|
-
|
|
746
|
-
if (typeof password !== 'undefined') {
|
|
747
|
-
payload['password'] = password;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
751
|
-
return await this.client.call('patch', uri, {
|
|
752
|
-
'content-type': 'application/json',
|
|
753
|
-
}, payload);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* Update Phone
|
|
758
|
-
*
|
|
759
|
-
* Update the user phone by its unique ID.
|
|
760
|
-
*
|
|
761
|
-
* @param {string} userId
|
|
762
|
-
* @param {string} number
|
|
763
|
-
* @throws {AppwriteException}
|
|
764
|
-
* @returns {Promise}
|
|
765
|
-
*/
|
|
766
|
-
async updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>> {
|
|
767
|
-
if (typeof userId === 'undefined') {
|
|
768
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
if (typeof number === 'undefined') {
|
|
772
|
-
throw new AppwriteException('Missing required parameter: "number"');
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
let path = '/users/{userId}/phone'.replace('{userId}', userId);
|
|
776
|
-
let payload: Payload = {};
|
|
777
|
-
|
|
778
|
-
if (typeof number !== 'undefined') {
|
|
779
|
-
payload['number'] = number;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
783
|
-
return await this.client.call('patch', uri, {
|
|
784
|
-
'content-type': 'application/json',
|
|
785
|
-
}, payload);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
/**
|
|
789
|
-
* Get User Preferences
|
|
790
|
-
*
|
|
791
|
-
* Get the user preferences by its unique ID.
|
|
792
|
-
*
|
|
793
|
-
* @param {string} userId
|
|
794
|
-
* @throws {AppwriteException}
|
|
795
|
-
* @returns {Promise}
|
|
796
|
-
*/
|
|
797
|
-
async getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences> {
|
|
798
|
-
if (typeof userId === 'undefined') {
|
|
799
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
803
|
-
let payload: Payload = {};
|
|
804
|
-
|
|
805
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
806
|
-
return await this.client.call('get', uri, {
|
|
807
|
-
'content-type': 'application/json',
|
|
808
|
-
}, payload);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
/**
|
|
812
|
-
* Update User Preferences
|
|
813
|
-
*
|
|
814
|
-
* Update the user preferences by its unique ID. The object you pass is stored
|
|
815
|
-
* as is, and replaces any previous value. The maximum allowed prefs size is
|
|
816
|
-
* 64kB and throws error if exceeded.
|
|
817
|
-
*
|
|
818
|
-
* @param {string} userId
|
|
819
|
-
* @param {object} prefs
|
|
820
|
-
* @throws {AppwriteException}
|
|
821
|
-
* @returns {Promise}
|
|
822
|
-
*/
|
|
823
|
-
async updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences> {
|
|
824
|
-
if (typeof userId === 'undefined') {
|
|
825
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
if (typeof prefs === 'undefined') {
|
|
829
|
-
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
833
|
-
let payload: Payload = {};
|
|
834
|
-
|
|
835
|
-
if (typeof prefs !== 'undefined') {
|
|
836
|
-
payload['prefs'] = prefs;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
840
|
-
return await this.client.call('patch', uri, {
|
|
841
|
-
'content-type': 'application/json',
|
|
842
|
-
}, payload);
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* List User Sessions
|
|
847
|
-
*
|
|
848
|
-
* Get the user sessions list by its unique ID.
|
|
849
|
-
*
|
|
850
|
-
* @param {string} userId
|
|
851
|
-
* @throws {AppwriteException}
|
|
852
|
-
* @returns {Promise}
|
|
853
|
-
*/
|
|
854
|
-
async listSessions(userId: string): Promise<Models.SessionList> {
|
|
855
|
-
if (typeof userId === 'undefined') {
|
|
856
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
860
|
-
let payload: Payload = {};
|
|
861
|
-
|
|
862
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
863
|
-
return await this.client.call('get', uri, {
|
|
864
|
-
'content-type': 'application/json',
|
|
865
|
-
}, payload);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
/**
|
|
869
|
-
* Delete User Sessions
|
|
870
|
-
*
|
|
871
|
-
* Delete all user's sessions by using the user's unique ID.
|
|
872
|
-
*
|
|
873
|
-
* @param {string} userId
|
|
874
|
-
* @throws {AppwriteException}
|
|
875
|
-
* @returns {Promise}
|
|
876
|
-
*/
|
|
877
|
-
async deleteSessions(userId: string): Promise<{}> {
|
|
878
|
-
if (typeof userId === 'undefined') {
|
|
879
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
883
|
-
let payload: Payload = {};
|
|
884
|
-
|
|
885
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
886
|
-
return await this.client.call('delete', uri, {
|
|
887
|
-
'content-type': 'application/json',
|
|
888
|
-
}, payload);
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
* Delete User Session
|
|
893
|
-
*
|
|
894
|
-
* Delete a user sessions by its unique ID.
|
|
895
|
-
*
|
|
896
|
-
* @param {string} userId
|
|
897
|
-
* @param {string} sessionId
|
|
898
|
-
* @throws {AppwriteException}
|
|
899
|
-
* @returns {Promise}
|
|
900
|
-
*/
|
|
901
|
-
async deleteSession(userId: string, sessionId: string): Promise<{}> {
|
|
902
|
-
if (typeof userId === 'undefined') {
|
|
903
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
if (typeof sessionId === 'undefined') {
|
|
907
|
-
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
|
|
911
|
-
let payload: Payload = {};
|
|
912
|
-
|
|
913
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
914
|
-
return await this.client.call('delete', uri, {
|
|
915
|
-
'content-type': 'application/json',
|
|
916
|
-
}, payload);
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Update User Status
|
|
921
|
-
*
|
|
922
|
-
* Update the user status by its unique ID. Use this endpoint as an
|
|
923
|
-
* alternative to deleting a user if you want to keep user's ID reserved.
|
|
924
|
-
*
|
|
925
|
-
* @param {string} userId
|
|
926
|
-
* @param {boolean} status
|
|
927
|
-
* @throws {AppwriteException}
|
|
928
|
-
* @returns {Promise}
|
|
929
|
-
*/
|
|
930
|
-
async updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>> {
|
|
931
|
-
if (typeof userId === 'undefined') {
|
|
932
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
if (typeof status === 'undefined') {
|
|
936
|
-
throw new AppwriteException('Missing required parameter: "status"');
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
let path = '/users/{userId}/status'.replace('{userId}', userId);
|
|
940
|
-
let payload: Payload = {};
|
|
941
|
-
|
|
942
|
-
if (typeof status !== 'undefined') {
|
|
943
|
-
payload['status'] = status;
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
947
|
-
return await this.client.call('patch', uri, {
|
|
948
|
-
'content-type': 'application/json',
|
|
949
|
-
}, payload);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* Update Email Verification
|
|
954
|
-
*
|
|
955
|
-
* Update the user email verification status by its unique ID.
|
|
956
|
-
*
|
|
957
|
-
* @param {string} userId
|
|
958
|
-
* @param {boolean} emailVerification
|
|
959
|
-
* @throws {AppwriteException}
|
|
960
|
-
* @returns {Promise}
|
|
961
|
-
*/
|
|
962
|
-
async updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>> {
|
|
963
|
-
if (typeof userId === 'undefined') {
|
|
964
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
if (typeof emailVerification === 'undefined') {
|
|
968
|
-
throw new AppwriteException('Missing required parameter: "emailVerification"');
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
let path = '/users/{userId}/verification'.replace('{userId}', userId);
|
|
972
|
-
let payload: Payload = {};
|
|
973
|
-
|
|
974
|
-
if (typeof emailVerification !== 'undefined') {
|
|
975
|
-
payload['emailVerification'] = emailVerification;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
979
|
-
return await this.client.call('patch', uri, {
|
|
980
|
-
'content-type': 'application/json',
|
|
981
|
-
}, payload);
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
* Update Phone Verification
|
|
986
|
-
*
|
|
987
|
-
* Update the user phone verification status by its unique ID.
|
|
988
|
-
*
|
|
989
|
-
* @param {string} userId
|
|
990
|
-
* @param {boolean} phoneVerification
|
|
991
|
-
* @throws {AppwriteException}
|
|
992
|
-
* @returns {Promise}
|
|
993
|
-
*/
|
|
994
|
-
async updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>> {
|
|
995
|
-
if (typeof userId === 'undefined') {
|
|
996
|
-
throw new AppwriteException('Missing required parameter: "userId"');
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
if (typeof phoneVerification === 'undefined') {
|
|
1000
|
-
throw new AppwriteException('Missing required parameter: "phoneVerification"');
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
let path = '/users/{userId}/verification/phone'.replace('{userId}', userId);
|
|
1004
|
-
let payload: Payload = {};
|
|
1005
|
-
|
|
1006
|
-
if (typeof phoneVerification !== 'undefined') {
|
|
1007
|
-
payload['phoneVerification'] = phoneVerification;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
const uri = new URL(this.client.config.endpoint + path);
|
|
1011
|
-
return await this.client.call('patch', uri, {
|
|
1012
|
-
'content-type': 'application/json',
|
|
1013
|
-
}, payload);
|
|
13
|
+
/**
|
|
14
|
+
* List Users
|
|
15
|
+
*
|
|
16
|
+
* Get a list of all the project's users. You can use the query params to
|
|
17
|
+
* filter your results.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} queries
|
|
20
|
+
* @param {string} search
|
|
21
|
+
* @throws {AppwriteException}
|
|
22
|
+
* @returns {Promise}
|
|
23
|
+
*/
|
|
24
|
+
async list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.UserList<Preferences>> {
|
|
25
|
+
let path = '/users';
|
|
26
|
+
let payload: Payload = {};
|
|
27
|
+
|
|
28
|
+
if (typeof queries !== 'undefined') {
|
|
29
|
+
payload['queries'] = queries;
|
|
1014
30
|
}
|
|
31
|
+
|
|
32
|
+
if (typeof search !== 'undefined') {
|
|
33
|
+
payload['search'] = search;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
37
|
+
return await this.client.call('get', uri, {
|
|
38
|
+
'content-type': 'application/json',
|
|
39
|
+
}, payload);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create User
|
|
44
|
+
*
|
|
45
|
+
* Create a new user.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} userId
|
|
48
|
+
* @param {string} email
|
|
49
|
+
* @param {string} phone
|
|
50
|
+
* @param {string} password
|
|
51
|
+
* @param {string} name
|
|
52
|
+
* @throws {AppwriteException}
|
|
53
|
+
* @returns {Promise}
|
|
54
|
+
*/
|
|
55
|
+
async create<Preferences extends Models.Preferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>> {
|
|
56
|
+
if (typeof userId === 'undefined') {
|
|
57
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let path = '/users';
|
|
61
|
+
let payload: Payload = {};
|
|
62
|
+
|
|
63
|
+
if (typeof userId !== 'undefined') {
|
|
64
|
+
payload['userId'] = userId;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (typeof email !== 'undefined') {
|
|
68
|
+
payload['email'] = email;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (typeof phone !== 'undefined') {
|
|
72
|
+
payload['phone'] = phone;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (typeof password !== 'undefined') {
|
|
76
|
+
payload['password'] = password;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (typeof name !== 'undefined') {
|
|
80
|
+
payload['name'] = name;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
84
|
+
return await this.client.call('post', uri, {
|
|
85
|
+
'content-type': 'application/json',
|
|
86
|
+
}, payload);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Create User with Argon2 Password
|
|
91
|
+
*
|
|
92
|
+
* Create a new user. Password provided must be hashed with the
|
|
93
|
+
* [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
|
|
94
|
+
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
95
|
+
* plain text password.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} userId
|
|
98
|
+
* @param {string} email
|
|
99
|
+
* @param {string} password
|
|
100
|
+
* @param {string} name
|
|
101
|
+
* @throws {AppwriteException}
|
|
102
|
+
* @returns {Promise}
|
|
103
|
+
*/
|
|
104
|
+
async createArgon2User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
105
|
+
if (typeof userId === 'undefined') {
|
|
106
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (typeof email === 'undefined') {
|
|
110
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (typeof password === 'undefined') {
|
|
114
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let path = '/users/argon2';
|
|
118
|
+
let payload: Payload = {};
|
|
119
|
+
|
|
120
|
+
if (typeof userId !== 'undefined') {
|
|
121
|
+
payload['userId'] = userId;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (typeof email !== 'undefined') {
|
|
125
|
+
payload['email'] = email;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (typeof password !== 'undefined') {
|
|
129
|
+
payload['password'] = password;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (typeof name !== 'undefined') {
|
|
133
|
+
payload['name'] = name;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
137
|
+
return await this.client.call('post', uri, {
|
|
138
|
+
'content-type': 'application/json',
|
|
139
|
+
}, payload);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Create User with Bcrypt Password
|
|
144
|
+
*
|
|
145
|
+
* Create a new user. Password provided must be hashed with the
|
|
146
|
+
* [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
|
|
147
|
+
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
148
|
+
* plain text password.
|
|
149
|
+
*
|
|
150
|
+
* @param {string} userId
|
|
151
|
+
* @param {string} email
|
|
152
|
+
* @param {string} password
|
|
153
|
+
* @param {string} name
|
|
154
|
+
* @throws {AppwriteException}
|
|
155
|
+
* @returns {Promise}
|
|
156
|
+
*/
|
|
157
|
+
async createBcryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
158
|
+
if (typeof userId === 'undefined') {
|
|
159
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (typeof email === 'undefined') {
|
|
163
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (typeof password === 'undefined') {
|
|
167
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let path = '/users/bcrypt';
|
|
171
|
+
let payload: Payload = {};
|
|
172
|
+
|
|
173
|
+
if (typeof userId !== 'undefined') {
|
|
174
|
+
payload['userId'] = userId;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (typeof email !== 'undefined') {
|
|
178
|
+
payload['email'] = email;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (typeof password !== 'undefined') {
|
|
182
|
+
payload['password'] = password;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (typeof name !== 'undefined') {
|
|
186
|
+
payload['name'] = name;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
190
|
+
return await this.client.call('post', uri, {
|
|
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?: string, search?: string): Promise<Models.IdentityList> {
|
|
206
|
+
let path = '/users/identities';
|
|
207
|
+
let payload: 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
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
218
|
+
return await this.client.call('get', uri, {
|
|
219
|
+
'content-type': 'application/json',
|
|
220
|
+
}, payload);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Delete Identity
|
|
225
|
+
*
|
|
226
|
+
* Delete an identity by its unique ID.
|
|
227
|
+
*
|
|
228
|
+
* @param {string} identityId
|
|
229
|
+
* @throws {AppwriteException}
|
|
230
|
+
* @returns {Promise}
|
|
231
|
+
*/
|
|
232
|
+
async deleteIdentity(identityId: string): Promise<{}> {
|
|
233
|
+
if (typeof identityId === 'undefined') {
|
|
234
|
+
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
let path = '/users/identities/{identityId}'.replace('{identityId}', identityId);
|
|
238
|
+
let payload: Payload = {};
|
|
239
|
+
|
|
240
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
241
|
+
return await this.client.call('delete', uri, {
|
|
242
|
+
'content-type': 'application/json',
|
|
243
|
+
}, payload);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Create User with MD5 Password
|
|
248
|
+
*
|
|
249
|
+
* Create a new user. Password provided must be hashed with the
|
|
250
|
+
* [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
|
|
251
|
+
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
252
|
+
* plain text password.
|
|
253
|
+
*
|
|
254
|
+
* @param {string} userId
|
|
255
|
+
* @param {string} email
|
|
256
|
+
* @param {string} password
|
|
257
|
+
* @param {string} name
|
|
258
|
+
* @throws {AppwriteException}
|
|
259
|
+
* @returns {Promise}
|
|
260
|
+
*/
|
|
261
|
+
async createMD5User<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
262
|
+
if (typeof userId === 'undefined') {
|
|
263
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (typeof email === 'undefined') {
|
|
267
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (typeof password === 'undefined') {
|
|
271
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let path = '/users/md5';
|
|
275
|
+
let payload: Payload = {};
|
|
276
|
+
|
|
277
|
+
if (typeof userId !== 'undefined') {
|
|
278
|
+
payload['userId'] = userId;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (typeof email !== 'undefined') {
|
|
282
|
+
payload['email'] = email;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (typeof password !== 'undefined') {
|
|
286
|
+
payload['password'] = password;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (typeof name !== 'undefined') {
|
|
290
|
+
payload['name'] = name;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
294
|
+
return await this.client.call('post', uri, {
|
|
295
|
+
'content-type': 'application/json',
|
|
296
|
+
}, payload);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Create User with PHPass Password
|
|
301
|
+
*
|
|
302
|
+
* Create a new user. Password provided must be hashed with the
|
|
303
|
+
* [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
|
|
304
|
+
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
305
|
+
* plain text password.
|
|
306
|
+
*
|
|
307
|
+
* @param {string} userId
|
|
308
|
+
* @param {string} email
|
|
309
|
+
* @param {string} password
|
|
310
|
+
* @param {string} name
|
|
311
|
+
* @throws {AppwriteException}
|
|
312
|
+
* @returns {Promise}
|
|
313
|
+
*/
|
|
314
|
+
async createPHPassUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>> {
|
|
315
|
+
if (typeof userId === 'undefined') {
|
|
316
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (typeof email === 'undefined') {
|
|
320
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (typeof password === 'undefined') {
|
|
324
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let path = '/users/phpass';
|
|
328
|
+
let payload: Payload = {};
|
|
329
|
+
|
|
330
|
+
if (typeof userId !== 'undefined') {
|
|
331
|
+
payload['userId'] = userId;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (typeof email !== 'undefined') {
|
|
335
|
+
payload['email'] = email;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (typeof password !== 'undefined') {
|
|
339
|
+
payload['password'] = password;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (typeof name !== 'undefined') {
|
|
343
|
+
payload['name'] = name;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
347
|
+
return await this.client.call('post', uri, {
|
|
348
|
+
'content-type': 'application/json',
|
|
349
|
+
}, payload);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Create User with Scrypt Password
|
|
354
|
+
*
|
|
355
|
+
* Create a new user. Password provided must be hashed with the
|
|
356
|
+
* [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
|
|
357
|
+
* /users](/docs/server/users#usersCreate) endpoint to create users with a
|
|
358
|
+
* plain text password.
|
|
359
|
+
*
|
|
360
|
+
* @param {string} userId
|
|
361
|
+
* @param {string} email
|
|
362
|
+
* @param {string} password
|
|
363
|
+
* @param {string} passwordSalt
|
|
364
|
+
* @param {number} passwordCpu
|
|
365
|
+
* @param {number} passwordMemory
|
|
366
|
+
* @param {number} passwordParallel
|
|
367
|
+
* @param {number} passwordLength
|
|
368
|
+
* @param {string} name
|
|
369
|
+
* @throws {AppwriteException}
|
|
370
|
+
* @returns {Promise}
|
|
371
|
+
*/
|
|
372
|
+
async createScryptUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>> {
|
|
373
|
+
if (typeof userId === 'undefined') {
|
|
374
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (typeof email === 'undefined') {
|
|
378
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (typeof password === 'undefined') {
|
|
382
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (typeof passwordSalt === 'undefined') {
|
|
386
|
+
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (typeof passwordCpu === 'undefined') {
|
|
390
|
+
throw new AppwriteException('Missing required parameter: "passwordCpu"');
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (typeof passwordMemory === 'undefined') {
|
|
394
|
+
throw new AppwriteException('Missing required parameter: "passwordMemory"');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (typeof passwordParallel === 'undefined') {
|
|
398
|
+
throw new AppwriteException('Missing required parameter: "passwordParallel"');
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (typeof passwordLength === 'undefined') {
|
|
402
|
+
throw new AppwriteException('Missing required parameter: "passwordLength"');
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
let path = '/users/scrypt';
|
|
406
|
+
let payload: Payload = {};
|
|
407
|
+
|
|
408
|
+
if (typeof userId !== 'undefined') {
|
|
409
|
+
payload['userId'] = userId;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (typeof email !== 'undefined') {
|
|
413
|
+
payload['email'] = email;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (typeof password !== 'undefined') {
|
|
417
|
+
payload['password'] = password;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (typeof passwordSalt !== 'undefined') {
|
|
421
|
+
payload['passwordSalt'] = passwordSalt;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (typeof passwordCpu !== 'undefined') {
|
|
425
|
+
payload['passwordCpu'] = passwordCpu;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (typeof passwordMemory !== 'undefined') {
|
|
429
|
+
payload['passwordMemory'] = passwordMemory;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (typeof passwordParallel !== 'undefined') {
|
|
433
|
+
payload['passwordParallel'] = passwordParallel;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (typeof passwordLength !== 'undefined') {
|
|
437
|
+
payload['passwordLength'] = passwordLength;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (typeof name !== 'undefined') {
|
|
441
|
+
payload['name'] = name;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
445
|
+
return await this.client.call('post', uri, {
|
|
446
|
+
'content-type': 'application/json',
|
|
447
|
+
}, payload);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Create User with Scrypt Modified Password
|
|
452
|
+
*
|
|
453
|
+
* Create a new user. Password provided must be hashed with the [Scrypt
|
|
454
|
+
* Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
|
|
455
|
+
* algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint
|
|
456
|
+
* to create users with a plain text password.
|
|
457
|
+
*
|
|
458
|
+
* @param {string} userId
|
|
459
|
+
* @param {string} email
|
|
460
|
+
* @param {string} password
|
|
461
|
+
* @param {string} passwordSalt
|
|
462
|
+
* @param {string} passwordSaltSeparator
|
|
463
|
+
* @param {string} passwordSignerKey
|
|
464
|
+
* @param {string} name
|
|
465
|
+
* @throws {AppwriteException}
|
|
466
|
+
* @returns {Promise}
|
|
467
|
+
*/
|
|
468
|
+
async createScryptModifiedUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>> {
|
|
469
|
+
if (typeof userId === 'undefined') {
|
|
470
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (typeof email === 'undefined') {
|
|
474
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (typeof password === 'undefined') {
|
|
478
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (typeof passwordSalt === 'undefined') {
|
|
482
|
+
throw new AppwriteException('Missing required parameter: "passwordSalt"');
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (typeof passwordSaltSeparator === 'undefined') {
|
|
486
|
+
throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"');
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (typeof passwordSignerKey === 'undefined') {
|
|
490
|
+
throw new AppwriteException('Missing required parameter: "passwordSignerKey"');
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
let path = '/users/scrypt-modified';
|
|
494
|
+
let payload: Payload = {};
|
|
495
|
+
|
|
496
|
+
if (typeof userId !== 'undefined') {
|
|
497
|
+
payload['userId'] = userId;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (typeof email !== 'undefined') {
|
|
501
|
+
payload['email'] = email;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
if (typeof password !== 'undefined') {
|
|
505
|
+
payload['password'] = password;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (typeof passwordSalt !== 'undefined') {
|
|
509
|
+
payload['passwordSalt'] = passwordSalt;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (typeof passwordSaltSeparator !== 'undefined') {
|
|
513
|
+
payload['passwordSaltSeparator'] = passwordSaltSeparator;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (typeof passwordSignerKey !== 'undefined') {
|
|
517
|
+
payload['passwordSignerKey'] = passwordSignerKey;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (typeof name !== 'undefined') {
|
|
521
|
+
payload['name'] = name;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
525
|
+
return await this.client.call('post', uri, {
|
|
526
|
+
'content-type': 'application/json',
|
|
527
|
+
}, payload);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Create User with SHA Password
|
|
532
|
+
*
|
|
533
|
+
* Create a new user. Password provided must be hashed with the
|
|
534
|
+
* [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
|
|
535
|
+
* the [POST /users](/docs/server/users#usersCreate) endpoint to create users
|
|
536
|
+
* with a plain text password.
|
|
537
|
+
*
|
|
538
|
+
* @param {string} userId
|
|
539
|
+
* @param {string} email
|
|
540
|
+
* @param {string} password
|
|
541
|
+
* @param {string} passwordVersion
|
|
542
|
+
* @param {string} name
|
|
543
|
+
* @throws {AppwriteException}
|
|
544
|
+
* @returns {Promise}
|
|
545
|
+
*/
|
|
546
|
+
async createSHAUser<Preferences extends Models.Preferences>(userId: string, email: string, password: string, passwordVersion?: string, name?: string): Promise<Models.User<Preferences>> {
|
|
547
|
+
if (typeof userId === 'undefined') {
|
|
548
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (typeof email === 'undefined') {
|
|
552
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
if (typeof password === 'undefined') {
|
|
556
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
let path = '/users/sha';
|
|
560
|
+
let payload: Payload = {};
|
|
561
|
+
|
|
562
|
+
if (typeof userId !== 'undefined') {
|
|
563
|
+
payload['userId'] = userId;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
if (typeof email !== 'undefined') {
|
|
567
|
+
payload['email'] = email;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (typeof password !== 'undefined') {
|
|
571
|
+
payload['password'] = password;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (typeof passwordVersion !== 'undefined') {
|
|
575
|
+
payload['passwordVersion'] = passwordVersion;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (typeof name !== 'undefined') {
|
|
579
|
+
payload['name'] = name;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
583
|
+
return await this.client.call('post', uri, {
|
|
584
|
+
'content-type': 'application/json',
|
|
585
|
+
}, payload);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Get usage stats for the users API
|
|
590
|
+
*
|
|
591
|
+
*
|
|
592
|
+
* @param {string} range
|
|
593
|
+
* @param {string} provider
|
|
594
|
+
* @throws {AppwriteException}
|
|
595
|
+
* @returns {Promise}
|
|
596
|
+
*/
|
|
597
|
+
async getUsage(range?: string, provider?: string): Promise<Models.UsageUsers> {
|
|
598
|
+
let path = '/users/usage';
|
|
599
|
+
let payload: Payload = {};
|
|
600
|
+
|
|
601
|
+
if (typeof range !== 'undefined') {
|
|
602
|
+
payload['range'] = range;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if (typeof provider !== 'undefined') {
|
|
606
|
+
payload['provider'] = provider;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
610
|
+
return await this.client.call('get', uri, {
|
|
611
|
+
'content-type': 'application/json',
|
|
612
|
+
}, payload);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Get User
|
|
617
|
+
*
|
|
618
|
+
* Get a user by its unique ID.
|
|
619
|
+
*
|
|
620
|
+
* @param {string} userId
|
|
621
|
+
* @throws {AppwriteException}
|
|
622
|
+
* @returns {Promise}
|
|
623
|
+
*/
|
|
624
|
+
async get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>> {
|
|
625
|
+
if (typeof userId === 'undefined') {
|
|
626
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
let path = '/users/{userId}'.replace('{userId}', userId);
|
|
630
|
+
let payload: Payload = {};
|
|
631
|
+
|
|
632
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
633
|
+
return await this.client.call('get', uri, {
|
|
634
|
+
'content-type': 'application/json',
|
|
635
|
+
}, payload);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Delete User
|
|
640
|
+
*
|
|
641
|
+
* Delete a user by its unique ID, thereby releasing it's ID. Since ID is
|
|
642
|
+
* released and can be reused, all user-related resources like documents or
|
|
643
|
+
* storage files should be deleted before user deletion. If you want to keep
|
|
644
|
+
* ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
|
|
645
|
+
* endpoint instead.
|
|
646
|
+
*
|
|
647
|
+
* @param {string} userId
|
|
648
|
+
* @throws {AppwriteException}
|
|
649
|
+
* @returns {Promise}
|
|
650
|
+
*/
|
|
651
|
+
async delete(userId: string): Promise<{}> {
|
|
652
|
+
if (typeof userId === 'undefined') {
|
|
653
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
let path = '/users/{userId}'.replace('{userId}', userId);
|
|
657
|
+
let payload: Payload = {};
|
|
658
|
+
|
|
659
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
660
|
+
return await this.client.call('delete', uri, {
|
|
661
|
+
'content-type': 'application/json',
|
|
662
|
+
}, payload);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Update Email
|
|
667
|
+
*
|
|
668
|
+
* Update the user email by its unique ID.
|
|
669
|
+
*
|
|
670
|
+
* @param {string} userId
|
|
671
|
+
* @param {string} email
|
|
672
|
+
* @throws {AppwriteException}
|
|
673
|
+
* @returns {Promise}
|
|
674
|
+
*/
|
|
675
|
+
async updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>> {
|
|
676
|
+
if (typeof userId === 'undefined') {
|
|
677
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
if (typeof email === 'undefined') {
|
|
681
|
+
throw new AppwriteException('Missing required parameter: "email"');
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
let path = '/users/{userId}/email'.replace('{userId}', userId);
|
|
685
|
+
let payload: Payload = {};
|
|
686
|
+
|
|
687
|
+
if (typeof email !== 'undefined') {
|
|
688
|
+
payload['email'] = email;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
692
|
+
return await this.client.call('patch', uri, {
|
|
693
|
+
'content-type': 'application/json',
|
|
694
|
+
}, payload);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Update User Labels
|
|
699
|
+
*
|
|
700
|
+
* Update the user labels by its unique ID.
|
|
701
|
+
*
|
|
702
|
+
* Labels can be used to grant access to resources. While teams are a way for
|
|
703
|
+
* user's to share access to a resource, labels can be defined by the
|
|
704
|
+
* developer to grant access without an invitation. See the [Permissions
|
|
705
|
+
* docs](/docs/permissions) for more info.
|
|
706
|
+
*
|
|
707
|
+
* @param {string} userId
|
|
708
|
+
* @param {string[]} labels
|
|
709
|
+
* @throws {AppwriteException}
|
|
710
|
+
* @returns {Promise}
|
|
711
|
+
*/
|
|
712
|
+
async updateLabels<Preferences extends Models.Preferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>> {
|
|
713
|
+
if (typeof userId === 'undefined') {
|
|
714
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
if (typeof labels === 'undefined') {
|
|
718
|
+
throw new AppwriteException('Missing required parameter: "labels"');
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
let path = '/users/{userId}/labels'.replace('{userId}', userId);
|
|
722
|
+
let payload: Payload = {};
|
|
723
|
+
|
|
724
|
+
if (typeof labels !== 'undefined') {
|
|
725
|
+
payload['labels'] = labels;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
729
|
+
return await this.client.call('put', uri, {
|
|
730
|
+
'content-type': 'application/json',
|
|
731
|
+
}, payload);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* List User Logs
|
|
736
|
+
*
|
|
737
|
+
* Get the user activity logs list by its unique ID.
|
|
738
|
+
*
|
|
739
|
+
* @param {string} userId
|
|
740
|
+
* @param {string[]} queries
|
|
741
|
+
* @throws {AppwriteException}
|
|
742
|
+
* @returns {Promise}
|
|
743
|
+
*/
|
|
744
|
+
async listLogs(userId: string, queries?: string[]): Promise<Models.LogList> {
|
|
745
|
+
if (typeof userId === 'undefined') {
|
|
746
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
let path = '/users/{userId}/logs'.replace('{userId}', userId);
|
|
750
|
+
let payload: Payload = {};
|
|
751
|
+
|
|
752
|
+
if (typeof queries !== 'undefined') {
|
|
753
|
+
payload['queries'] = queries;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
757
|
+
return await this.client.call('get', uri, {
|
|
758
|
+
'content-type': 'application/json',
|
|
759
|
+
}, payload);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* List User Memberships
|
|
764
|
+
*
|
|
765
|
+
* Get the user membership list by its unique ID.
|
|
766
|
+
*
|
|
767
|
+
* @param {string} userId
|
|
768
|
+
* @throws {AppwriteException}
|
|
769
|
+
* @returns {Promise}
|
|
770
|
+
*/
|
|
771
|
+
async listMemberships(userId: string): Promise<Models.MembershipList> {
|
|
772
|
+
if (typeof userId === 'undefined') {
|
|
773
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
let path = '/users/{userId}/memberships'.replace('{userId}', userId);
|
|
777
|
+
let payload: Payload = {};
|
|
778
|
+
|
|
779
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
780
|
+
return await this.client.call('get', uri, {
|
|
781
|
+
'content-type': 'application/json',
|
|
782
|
+
}, payload);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Update Name
|
|
787
|
+
*
|
|
788
|
+
* Update the user name by its unique ID.
|
|
789
|
+
*
|
|
790
|
+
* @param {string} userId
|
|
791
|
+
* @param {string} name
|
|
792
|
+
* @throws {AppwriteException}
|
|
793
|
+
* @returns {Promise}
|
|
794
|
+
*/
|
|
795
|
+
async updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>> {
|
|
796
|
+
if (typeof userId === 'undefined') {
|
|
797
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
if (typeof name === 'undefined') {
|
|
801
|
+
throw new AppwriteException('Missing required parameter: "name"');
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
let path = '/users/{userId}/name'.replace('{userId}', userId);
|
|
805
|
+
let payload: Payload = {};
|
|
806
|
+
|
|
807
|
+
if (typeof name !== 'undefined') {
|
|
808
|
+
payload['name'] = name;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
812
|
+
return await this.client.call('patch', uri, {
|
|
813
|
+
'content-type': 'application/json',
|
|
814
|
+
}, payload);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Update Password
|
|
819
|
+
*
|
|
820
|
+
* Update the user password by its unique ID.
|
|
821
|
+
*
|
|
822
|
+
* @param {string} userId
|
|
823
|
+
* @param {string} password
|
|
824
|
+
* @throws {AppwriteException}
|
|
825
|
+
* @returns {Promise}
|
|
826
|
+
*/
|
|
827
|
+
async updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>> {
|
|
828
|
+
if (typeof userId === 'undefined') {
|
|
829
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
if (typeof password === 'undefined') {
|
|
833
|
+
throw new AppwriteException('Missing required parameter: "password"');
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
let path = '/users/{userId}/password'.replace('{userId}', userId);
|
|
837
|
+
let payload: Payload = {};
|
|
838
|
+
|
|
839
|
+
if (typeof password !== 'undefined') {
|
|
840
|
+
payload['password'] = password;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
844
|
+
return await this.client.call('patch', uri, {
|
|
845
|
+
'content-type': 'application/json',
|
|
846
|
+
}, payload);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Update Phone
|
|
851
|
+
*
|
|
852
|
+
* Update the user phone by its unique ID.
|
|
853
|
+
*
|
|
854
|
+
* @param {string} userId
|
|
855
|
+
* @param {string} number
|
|
856
|
+
* @throws {AppwriteException}
|
|
857
|
+
* @returns {Promise}
|
|
858
|
+
*/
|
|
859
|
+
async updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>> {
|
|
860
|
+
if (typeof userId === 'undefined') {
|
|
861
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (typeof number === 'undefined') {
|
|
865
|
+
throw new AppwriteException('Missing required parameter: "number"');
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
let path = '/users/{userId}/phone'.replace('{userId}', userId);
|
|
869
|
+
let payload: Payload = {};
|
|
870
|
+
|
|
871
|
+
if (typeof number !== 'undefined') {
|
|
872
|
+
payload['number'] = number;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
876
|
+
return await this.client.call('patch', uri, {
|
|
877
|
+
'content-type': 'application/json',
|
|
878
|
+
}, payload);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Get User Preferences
|
|
883
|
+
*
|
|
884
|
+
* Get the user preferences by its unique ID.
|
|
885
|
+
*
|
|
886
|
+
* @param {string} userId
|
|
887
|
+
* @throws {AppwriteException}
|
|
888
|
+
* @returns {Promise}
|
|
889
|
+
*/
|
|
890
|
+
async getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences> {
|
|
891
|
+
if (typeof userId === 'undefined') {
|
|
892
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
896
|
+
let payload: Payload = {};
|
|
897
|
+
|
|
898
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
899
|
+
return await this.client.call('get', uri, {
|
|
900
|
+
'content-type': 'application/json',
|
|
901
|
+
}, payload);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Update User Preferences
|
|
906
|
+
*
|
|
907
|
+
* Update the user preferences by its unique ID. The object you pass is stored
|
|
908
|
+
* as is, and replaces any previous value. The maximum allowed prefs size is
|
|
909
|
+
* 64kB and throws error if exceeded.
|
|
910
|
+
*
|
|
911
|
+
* @param {string} userId
|
|
912
|
+
* @param {object} prefs
|
|
913
|
+
* @throws {AppwriteException}
|
|
914
|
+
* @returns {Promise}
|
|
915
|
+
*/
|
|
916
|
+
async updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences> {
|
|
917
|
+
if (typeof userId === 'undefined') {
|
|
918
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
if (typeof prefs === 'undefined') {
|
|
922
|
+
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
let path = '/users/{userId}/prefs'.replace('{userId}', userId);
|
|
926
|
+
let payload: Payload = {};
|
|
927
|
+
|
|
928
|
+
if (typeof prefs !== 'undefined') {
|
|
929
|
+
payload['prefs'] = prefs;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
933
|
+
return await this.client.call('patch', uri, {
|
|
934
|
+
'content-type': 'application/json',
|
|
935
|
+
}, payload);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* List User Sessions
|
|
940
|
+
*
|
|
941
|
+
* Get the user sessions list by its unique ID.
|
|
942
|
+
*
|
|
943
|
+
* @param {string} userId
|
|
944
|
+
* @throws {AppwriteException}
|
|
945
|
+
* @returns {Promise}
|
|
946
|
+
*/
|
|
947
|
+
async listSessions(userId: string): Promise<Models.SessionList> {
|
|
948
|
+
if (typeof userId === 'undefined') {
|
|
949
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
953
|
+
let payload: Payload = {};
|
|
954
|
+
|
|
955
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
956
|
+
return await this.client.call('get', uri, {
|
|
957
|
+
'content-type': 'application/json',
|
|
958
|
+
}, payload);
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Delete User Sessions
|
|
963
|
+
*
|
|
964
|
+
* Delete all user's sessions by using the user's unique ID.
|
|
965
|
+
*
|
|
966
|
+
* @param {string} userId
|
|
967
|
+
* @throws {AppwriteException}
|
|
968
|
+
* @returns {Promise}
|
|
969
|
+
*/
|
|
970
|
+
async deleteSessions(userId: string): Promise<{}> {
|
|
971
|
+
if (typeof userId === 'undefined') {
|
|
972
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
let path = '/users/{userId}/sessions'.replace('{userId}', userId);
|
|
976
|
+
let payload: Payload = {};
|
|
977
|
+
|
|
978
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
979
|
+
return await this.client.call('delete', uri, {
|
|
980
|
+
'content-type': 'application/json',
|
|
981
|
+
}, payload);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Delete User Session
|
|
986
|
+
*
|
|
987
|
+
* Delete a user sessions by its unique ID.
|
|
988
|
+
*
|
|
989
|
+
* @param {string} userId
|
|
990
|
+
* @param {string} sessionId
|
|
991
|
+
* @throws {AppwriteException}
|
|
992
|
+
* @returns {Promise}
|
|
993
|
+
*/
|
|
994
|
+
async deleteSession(userId: string, sessionId: string): Promise<{}> {
|
|
995
|
+
if (typeof userId === 'undefined') {
|
|
996
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
if (typeof sessionId === 'undefined') {
|
|
1000
|
+
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
let path = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId);
|
|
1004
|
+
let payload: Payload = {};
|
|
1005
|
+
|
|
1006
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1007
|
+
return await this.client.call('delete', uri, {
|
|
1008
|
+
'content-type': 'application/json',
|
|
1009
|
+
}, payload);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Update User Status
|
|
1014
|
+
*
|
|
1015
|
+
* Update the user status by its unique ID. Use this endpoint as an
|
|
1016
|
+
* alternative to deleting a user if you want to keep user's ID reserved.
|
|
1017
|
+
*
|
|
1018
|
+
* @param {string} userId
|
|
1019
|
+
* @param {boolean} status
|
|
1020
|
+
* @throws {AppwriteException}
|
|
1021
|
+
* @returns {Promise}
|
|
1022
|
+
*/
|
|
1023
|
+
async updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>> {
|
|
1024
|
+
if (typeof userId === 'undefined') {
|
|
1025
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
if (typeof status === 'undefined') {
|
|
1029
|
+
throw new AppwriteException('Missing required parameter: "status"');
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
let path = '/users/{userId}/status'.replace('{userId}', userId);
|
|
1033
|
+
let payload: Payload = {};
|
|
1034
|
+
|
|
1035
|
+
if (typeof status !== 'undefined') {
|
|
1036
|
+
payload['status'] = status;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1040
|
+
return await this.client.call('patch', uri, {
|
|
1041
|
+
'content-type': 'application/json',
|
|
1042
|
+
}, payload);
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Update Email Verification
|
|
1047
|
+
*
|
|
1048
|
+
* Update the user email verification status by its unique ID.
|
|
1049
|
+
*
|
|
1050
|
+
* @param {string} userId
|
|
1051
|
+
* @param {boolean} emailVerification
|
|
1052
|
+
* @throws {AppwriteException}
|
|
1053
|
+
* @returns {Promise}
|
|
1054
|
+
*/
|
|
1055
|
+
async updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>> {
|
|
1056
|
+
if (typeof userId === 'undefined') {
|
|
1057
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
if (typeof emailVerification === 'undefined') {
|
|
1061
|
+
throw new AppwriteException('Missing required parameter: "emailVerification"');
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
let path = '/users/{userId}/verification'.replace('{userId}', userId);
|
|
1065
|
+
let payload: Payload = {};
|
|
1066
|
+
|
|
1067
|
+
if (typeof emailVerification !== 'undefined') {
|
|
1068
|
+
payload['emailVerification'] = emailVerification;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1072
|
+
return await this.client.call('patch', uri, {
|
|
1073
|
+
'content-type': 'application/json',
|
|
1074
|
+
}, payload);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Update Phone Verification
|
|
1079
|
+
*
|
|
1080
|
+
* Update the user phone verification status by its unique ID.
|
|
1081
|
+
*
|
|
1082
|
+
* @param {string} userId
|
|
1083
|
+
* @param {boolean} phoneVerification
|
|
1084
|
+
* @throws {AppwriteException}
|
|
1085
|
+
* @returns {Promise}
|
|
1086
|
+
*/
|
|
1087
|
+
async updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>> {
|
|
1088
|
+
if (typeof userId === 'undefined') {
|
|
1089
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (typeof phoneVerification === 'undefined') {
|
|
1093
|
+
throw new AppwriteException('Missing required parameter: "phoneVerification"');
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
let path = '/users/{userId}/verification/phone'.replace('{userId}', userId);
|
|
1097
|
+
let payload: Payload = {};
|
|
1098
|
+
|
|
1099
|
+
if (typeof phoneVerification !== 'undefined') {
|
|
1100
|
+
payload['phoneVerification'] = phoneVerification;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
const uri = new URL(this.client.config.endpoint + path);
|
|
1104
|
+
return await this.client.call('patch', uri, {
|
|
1105
|
+
'content-type': 'application/json',
|
|
1106
|
+
}, payload);
|
|
1107
|
+
}
|
|
1015
1108
|
};
|