appwrite-cli 4.2.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +1 -1
- package/README.md +6 -9
- package/docs/examples/account/{create-email-session.md → create-email-password-session.md} +1 -1
- package/docs/examples/account/create-email-token.md +4 -0
- package/docs/examples/account/create-magic-u-r-l-token.md +5 -0
- package/docs/examples/account/create-mfa-authenticator.md +2 -0
- package/docs/examples/account/create-mfa-challenge.md +2 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/create-o-auth2token.md +5 -0
- package/docs/examples/account/create-phone-token.md +3 -0
- package/docs/examples/account/create-push-target.md +4 -0
- package/docs/examples/account/create-session.md +3 -0
- package/docs/examples/account/create.md +1 -1
- package/docs/examples/account/delete-identity.md +1 -1
- package/docs/examples/account/delete-mfa-authenticator.md +3 -0
- package/docs/examples/account/delete-push-target.md +2 -0
- package/docs/examples/account/delete-session.md +1 -1
- package/docs/examples/account/delete.md +1 -0
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/get-session.md +1 -1
- package/docs/examples/account/list-mfa-factors.md +1 -0
- package/docs/examples/account/update-m-f-a.md +2 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
- package/docs/examples/account/update-mfa-authenticator.md +3 -0
- package/docs/examples/account/update-mfa-challenge.md +3 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -0
- package/docs/examples/account/update-name.md +1 -1
- package/docs/examples/account/update-phone-session.md +2 -2
- package/docs/examples/account/update-phone-verification.md +2 -2
- package/docs/examples/account/update-push-target.md +3 -0
- package/docs/examples/account/update-recovery.md +3 -4
- package/docs/examples/account/update-session.md +1 -1
- package/docs/examples/account/update-verification.md +2 -2
- package/docs/examples/assistant/chat.md +1 -1
- package/docs/examples/avatars/get-q-r.md +1 -1
- package/docs/examples/databases/create-boolean-attribute.md +2 -2
- package/docs/examples/databases/create-collection.md +3 -3
- package/docs/examples/databases/create-datetime-attribute.md +2 -2
- package/docs/examples/databases/create-document.md +3 -3
- package/docs/examples/databases/create-email-attribute.md +2 -2
- package/docs/examples/databases/create-enum-attribute.md +2 -2
- package/docs/examples/databases/create-float-attribute.md +2 -2
- package/docs/examples/databases/create-index.md +2 -2
- package/docs/examples/databases/create-integer-attribute.md +2 -2
- package/docs/examples/databases/create-ip-attribute.md +2 -2
- package/docs/examples/databases/create-relationship-attribute.md +3 -3
- package/docs/examples/databases/create-string-attribute.md +2 -2
- package/docs/examples/databases/create-url-attribute.md +2 -2
- package/docs/examples/databases/create.md +2 -2
- package/docs/examples/databases/delete-attribute.md +2 -2
- package/docs/examples/databases/delete-collection.md +2 -2
- package/docs/examples/databases/delete-document.md +3 -3
- package/docs/examples/databases/delete-index.md +2 -2
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +2 -2
- package/docs/examples/databases/get-collection-usage.md +2 -2
- package/docs/examples/databases/get-collection.md +2 -2
- package/docs/examples/databases/get-database-usage.md +1 -1
- package/docs/examples/databases/get-document.md +3 -3
- package/docs/examples/databases/get-index.md +2 -2
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/list-attributes.md +2 -2
- package/docs/examples/databases/list-collection-logs.md +2 -2
- package/docs/examples/databases/list-collections.md +1 -1
- package/docs/examples/databases/list-document-logs.md +3 -3
- package/docs/examples/databases/list-documents.md +2 -2
- package/docs/examples/databases/list-indexes.md +2 -2
- package/docs/examples/databases/list-logs.md +1 -1
- package/docs/examples/databases/update-boolean-attribute.md +2 -2
- package/docs/examples/databases/update-collection.md +3 -3
- package/docs/examples/databases/update-datetime-attribute.md +2 -2
- package/docs/examples/databases/update-document.md +3 -3
- package/docs/examples/databases/update-email-attribute.md +2 -2
- package/docs/examples/databases/update-enum-attribute.md +3 -3
- package/docs/examples/databases/update-float-attribute.md +2 -2
- package/docs/examples/databases/update-integer-attribute.md +2 -2
- package/docs/examples/databases/update-ip-attribute.md +2 -2
- package/docs/examples/databases/update-relationship-attribute.md +2 -2
- package/docs/examples/databases/update-string-attribute.md +3 -3
- package/docs/examples/databases/update-url-attribute.md +2 -2
- package/docs/examples/databases/update.md +2 -2
- package/docs/examples/functions/create-build.md +3 -3
- package/docs/examples/functions/create-deployment.md +1 -1
- package/docs/examples/functions/create-execution.md +1 -1
- package/docs/examples/functions/create-variable.md +3 -3
- package/docs/examples/functions/create.md +3 -3
- package/docs/examples/functions/delete-deployment.md +2 -2
- package/docs/examples/functions/delete-variable.md +2 -2
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/download-deployment.md +2 -2
- package/docs/examples/functions/get-deployment.md +2 -2
- package/docs/examples/functions/get-execution.md +2 -2
- package/docs/examples/functions/get-function-usage.md +1 -1
- package/docs/examples/functions/get-variable.md +2 -2
- 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-variables.md +1 -1
- package/docs/examples/functions/update-deployment.md +2 -2
- package/docs/examples/functions/update-variable.md +3 -3
- package/docs/examples/functions/update.md +2 -2
- package/docs/examples/health/get-certificate.md +2 -0
- package/docs/examples/health/get-failed-jobs.md +3 -0
- package/docs/examples/health/get-queue-usage-dump.md +2 -0
- package/docs/examples/health/get-queue-usage.md +2 -0
- package/docs/examples/health/get-storage.md +1 -0
- package/docs/examples/messaging/create-apns-provider.md +9 -0
- package/docs/examples/messaging/create-email.md +13 -0
- package/docs/examples/messaging/create-fcm-provider.md +5 -0
- package/docs/examples/messaging/create-mailgun-provider.md +11 -0
- package/docs/examples/messaging/create-msg91provider.md +7 -0
- package/docs/examples/messaging/create-push.md +17 -0
- package/docs/examples/messaging/create-sendgrid-provider.md +9 -0
- package/docs/examples/messaging/create-sms.md +8 -0
- package/docs/examples/messaging/create-smtp-provider.md +15 -0
- package/docs/examples/messaging/create-subscriber.md +4 -0
- package/docs/examples/messaging/create-telesign-provider.md +7 -0
- package/docs/examples/messaging/create-textmagic-provider.md +7 -0
- package/docs/examples/messaging/create-topic.md +4 -0
- package/docs/examples/messaging/create-twilio-provider.md +7 -0
- package/docs/examples/messaging/create-vonage-provider.md +7 -0
- package/docs/examples/messaging/delete-provider.md +2 -0
- package/docs/examples/messaging/delete-subscriber.md +3 -0
- package/docs/examples/messaging/delete-topic.md +2 -0
- package/docs/examples/messaging/delete.md +2 -0
- package/docs/examples/messaging/get-message.md +2 -0
- package/docs/examples/messaging/get-provider.md +2 -0
- package/docs/examples/messaging/get-subscriber.md +3 -0
- package/docs/examples/messaging/get-topic.md +2 -0
- package/docs/examples/messaging/list-message-logs.md +3 -0
- package/docs/examples/messaging/list-messages.md +3 -0
- package/docs/examples/messaging/list-provider-logs.md +3 -0
- package/docs/examples/messaging/list-providers.md +3 -0
- package/docs/examples/messaging/list-subscriber-logs.md +3 -0
- package/docs/examples/messaging/list-subscribers.md +4 -0
- package/docs/examples/messaging/list-targets.md +3 -0
- package/docs/examples/messaging/list-topic-logs.md +3 -0
- package/docs/examples/messaging/list-topics.md +3 -0
- package/docs/examples/messaging/update-apns-provider.md +9 -0
- package/docs/examples/messaging/update-email.md +12 -0
- package/docs/examples/messaging/update-fcm-provider.md +5 -0
- package/docs/examples/messaging/update-mailgun-provider.md +11 -0
- package/docs/examples/messaging/update-msg91provider.md +7 -0
- package/docs/examples/messaging/update-push.md +17 -0
- package/docs/examples/messaging/update-sendgrid-provider.md +9 -0
- package/docs/examples/messaging/update-sms.md +8 -0
- package/docs/examples/messaging/update-smtp-provider.md +15 -0
- package/docs/examples/messaging/update-telesign-provider.md +7 -0
- package/docs/examples/messaging/update-textmagic-provider.md +7 -0
- package/docs/examples/messaging/update-topic.md +4 -0
- package/docs/examples/messaging/update-twilio-provider.md +7 -0
- package/docs/examples/messaging/update-vonage-provider.md +7 -0
- package/docs/examples/migrations/create-appwrite-migration.md +2 -2
- package/docs/examples/migrations/create-firebase-migration.md +1 -1
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
- package/docs/examples/migrations/create-n-host-migration.md +6 -6
- package/docs/examples/migrations/create-supabase-migration.md +4 -4
- package/docs/examples/migrations/delete.md +1 -1
- package/docs/examples/migrations/get-appwrite-report.md +2 -2
- package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
- package/docs/examples/migrations/get-firebase-report.md +1 -1
- package/docs/examples/migrations/get-n-host-report.md +6 -6
- package/docs/examples/migrations/get-supabase-report.md +4 -4
- package/docs/examples/migrations/get.md +1 -1
- package/docs/examples/migrations/retry.md +1 -1
- package/docs/examples/project/create-variable.md +2 -2
- package/docs/examples/project/delete-variable.md +1 -1
- package/docs/examples/project/get-usage.md +2 -0
- package/docs/examples/project/get-variable.md +1 -1
- package/docs/examples/project/update-variable.md +2 -2
- package/docs/examples/projects/create-key.md +2 -2
- package/docs/examples/projects/create-platform.md +2 -2
- package/docs/examples/projects/create-smtp-test.md +11 -0
- package/docs/examples/projects/create-webhook.md +4 -3
- package/docs/examples/projects/create.md +2 -2
- package/docs/examples/projects/delete-email-template.md +1 -1
- package/docs/examples/projects/delete-key.md +2 -2
- package/docs/examples/projects/delete-platform.md +2 -2
- package/docs/examples/projects/delete-sms-template.md +1 -1
- package/docs/examples/projects/delete-webhook.md +2 -2
- package/docs/examples/projects/delete.md +1 -1
- package/docs/examples/projects/get-email-template.md +1 -1
- package/docs/examples/projects/get-key.md +2 -2
- package/docs/examples/projects/get-platform.md +2 -2
- package/docs/examples/projects/get-sms-template.md +1 -1
- package/docs/examples/projects/get-webhook.md +2 -2
- 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/update-api-status-all.md +3 -0
- package/docs/examples/projects/update-api-status.md +4 -0
- 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 +3 -3
- package/docs/examples/projects/update-key.md +3 -3
- package/docs/examples/projects/update-o-auth2.md +1 -1
- package/docs/examples/projects/update-personal-data-check.md +1 -1
- package/docs/examples/projects/update-platform.md +3 -3
- package/docs/examples/projects/update-service-status-all.md +1 -1
- package/docs/examples/projects/update-service-status.md +1 -1
- package/docs/examples/projects/update-sms-template.md +2 -2
- package/docs/examples/projects/update-smtp.md +11 -0
- package/docs/examples/projects/update-team.md +2 -2
- package/docs/examples/projects/update-webhook-signature.md +2 -2
- package/docs/examples/projects/update-webhook.md +5 -4
- package/docs/examples/projects/update.md +2 -2
- package/docs/examples/proxy/delete-rule.md +1 -1
- package/docs/examples/proxy/get-rule.md +1 -1
- package/docs/examples/proxy/update-rule-verification.md +1 -1
- package/docs/examples/storage/create-bucket.md +2 -2
- package/docs/examples/storage/create-file.md +2 -2
- package/docs/examples/storage/delete-bucket.md +1 -1
- package/docs/examples/storage/delete-file.md +2 -2
- 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 +2 -2
- package/docs/examples/storage/get-file-preview.md +2 -2
- package/docs/examples/storage/get-file-view.md +2 -2
- package/docs/examples/storage/get-file.md +2 -2
- package/docs/examples/storage/list-files.md +1 -1
- package/docs/examples/storage/update-bucket.md +2 -2
- package/docs/examples/storage/update-file.md +2 -2
- package/docs/examples/teams/create-membership.md +1 -1
- package/docs/examples/teams/create.md +2 -2
- package/docs/examples/teams/delete-membership.md +2 -2
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +2 -2
- 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/update-membership-status.md +4 -4
- package/docs/examples/teams/update-membership.md +2 -2
- package/docs/examples/teams/update-name.md +2 -2
- 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-mfa-recovery-codes.md +2 -0
- 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 +4 -4
- package/docs/examples/users/create-scrypt-user.md +2 -2
- package/docs/examples/users/create-session.md +2 -0
- package/docs/examples/users/create-target.md +7 -0
- package/docs/examples/users/create-token.md +4 -0
- package/docs/examples/users/create.md +1 -1
- package/docs/examples/users/delete-identity.md +1 -1
- package/docs/examples/users/delete-mfa-authenticator.md +3 -0
- package/docs/examples/users/delete-session.md +2 -2
- package/docs/examples/users/delete-sessions.md +1 -1
- package/docs/examples/users/delete-target.md +3 -0
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
- package/docs/examples/users/get-prefs.md +1 -1
- package/docs/examples/users/get-target.md +3 -0
- package/docs/examples/users/get-usage.md +0 -1
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-logs.md +1 -1
- package/docs/examples/users/list-memberships.md +1 -1
- package/docs/examples/users/list-mfa-factors.md +2 -0
- package/docs/examples/users/list-sessions.md +1 -1
- package/docs/examples/users/list-targets.md +3 -0
- 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 +1 -1
- package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
- package/docs/examples/users/update-mfa.md +3 -0
- package/docs/examples/users/update-name.md +2 -2
- 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/users/update-target.md +6 -0
- package/docs/examples/vcs/create-repository-detection.md +2 -2
- package/docs/examples/vcs/create-repository.md +2 -2
- package/docs/examples/vcs/delete-installation.md +1 -1
- package/docs/examples/vcs/get-installation.md +1 -1
- package/docs/examples/vcs/get-repository.md +2 -2
- package/docs/examples/vcs/list-repositories.md +1 -1
- package/docs/examples/vcs/list-repository-branches.md +2 -2
- package/docs/examples/vcs/update-external-deployments.md +3 -3
- package/index.js +2 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +9 -4
- package/lib/commands/account.js +966 -381
- package/lib/commands/assistant.js +3 -8
- package/lib/commands/avatars.js +32 -48
- package/lib/commands/console.js +3 -8
- package/lib/commands/databases.js +119 -265
- package/lib/commands/deploy.js +45 -6
- package/lib/commands/functions.js +59 -124
- package/lib/commands/generic.js +0 -1
- package/lib/commands/graphql.js +5 -13
- package/lib/commands/health.js +225 -89
- package/lib/commands/locale.js +17 -43
- package/lib/commands/messaging.js +2815 -0
- package/lib/commands/migrations.js +35 -85
- package/lib/commands/project.js +28 -38
- package/lib/commands/projects.js +286 -270
- package/lib/commands/proxy.js +12 -29
- package/lib/commands/storage.js +42 -87
- package/lib/commands/teams.js +31 -75
- package/lib/commands/users.js +677 -235
- package/lib/commands/vcs.js +19 -48
- package/lib/paginate.js +2 -2
- package/lib/parser.js +1 -0
- package/package.json +1 -1
- package/scoop/appwrite.json +3 -3
- package/docs/examples/account/create-magic-u-r-l-session.md +0 -4
- package/docs/examples/account/create-phone-session.md +0 -3
- package/docs/examples/projects/get-usage.md +0 -3
- package/docs/examples/projects/update-smtp-configuration.md +0 -11
package/lib/commands/account.js
CHANGED
|
@@ -37,7 +37,7 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
37
37
|
|
|
38
38
|
const account = new Command("account").description(commandDescriptions['account']).configureHelp({
|
|
39
39
|
helpWidth: process.stdout.columns || 80
|
|
40
|
-
|
|
40
|
+
})
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} AccountGetRequestParams
|
|
@@ -50,18 +50,15 @@ const account = new Command("account").description(commandDescriptions['account'
|
|
|
50
50
|
*/
|
|
51
51
|
const accountGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
52
52
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
53
|
-
|
|
54
53
|
let apiPath = '/account';
|
|
55
54
|
let payload = {};
|
|
56
55
|
|
|
57
|
-
|
|
58
56
|
let response = undefined;
|
|
59
|
-
|
|
57
|
+
|
|
60
58
|
response = await client.call('get', apiPath, {
|
|
61
59
|
'content-type': 'application/json',
|
|
62
60
|
}, payload);
|
|
63
61
|
|
|
64
|
-
|
|
65
62
|
if (parseOutput) {
|
|
66
63
|
parse(response)
|
|
67
64
|
success()
|
|
@@ -72,9 +69,9 @@ const accountGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
72
69
|
|
|
73
70
|
/**
|
|
74
71
|
* @typedef {Object} AccountCreateRequestParams
|
|
75
|
-
* @property {string} userId
|
|
72
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
76
73
|
* @property {string} email User email.
|
|
77
|
-
* @property {string} password New user password. Must be
|
|
74
|
+
* @property {string} password New user password. Must be between 8 and 256 chars.
|
|
78
75
|
* @property {string} name User name. Max length: 128 chars.
|
|
79
76
|
* @property {boolean} parseOutput
|
|
80
77
|
* @property {libClient | undefined} sdk
|
|
@@ -85,7 +82,6 @@ const accountGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
85
82
|
*/
|
|
86
83
|
const accountCreate = async ({ userId, email, password, name, parseOutput = true, sdk = undefined}) => {
|
|
87
84
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
88
|
-
|
|
89
85
|
let apiPath = '/account';
|
|
90
86
|
let payload = {};
|
|
91
87
|
if (typeof userId !== 'undefined') {
|
|
@@ -101,14 +97,40 @@ const accountCreate = async ({ userId, email, password, name, parseOutput = true
|
|
|
101
97
|
payload['name'] = name;
|
|
102
98
|
}
|
|
103
99
|
|
|
104
|
-
|
|
105
100
|
let response = undefined;
|
|
106
|
-
|
|
101
|
+
|
|
107
102
|
response = await client.call('post', apiPath, {
|
|
108
103
|
'content-type': 'application/json',
|
|
109
104
|
}, payload);
|
|
110
105
|
|
|
106
|
+
if (parseOutput) {
|
|
107
|
+
parse(response)
|
|
108
|
+
success()
|
|
109
|
+
}
|
|
111
110
|
|
|
111
|
+
return response;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @typedef {Object} AccountDeleteRequestParams
|
|
116
|
+
* @property {boolean} parseOutput
|
|
117
|
+
* @property {libClient | undefined} sdk
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {AccountDeleteRequestParams} params
|
|
122
|
+
*/
|
|
123
|
+
const accountDelete = async ({ parseOutput = true, sdk = undefined}) => {
|
|
124
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
125
|
+
let apiPath = '/account';
|
|
126
|
+
let payload = {};
|
|
127
|
+
|
|
128
|
+
let response = undefined;
|
|
129
|
+
|
|
130
|
+
response = await client.call('delete', apiPath, {
|
|
131
|
+
'content-type': 'application/json',
|
|
132
|
+
}, payload);
|
|
133
|
+
|
|
112
134
|
if (parseOutput) {
|
|
113
135
|
parse(response)
|
|
114
136
|
success()
|
|
@@ -130,7 +152,6 @@ const accountCreate = async ({ userId, email, password, name, parseOutput = true
|
|
|
130
152
|
*/
|
|
131
153
|
const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = undefined}) => {
|
|
132
154
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
133
|
-
|
|
134
155
|
let apiPath = '/account/email';
|
|
135
156
|
let payload = {};
|
|
136
157
|
if (typeof email !== 'undefined') {
|
|
@@ -140,14 +161,12 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
|
|
|
140
161
|
payload['password'] = password;
|
|
141
162
|
}
|
|
142
163
|
|
|
143
|
-
|
|
144
164
|
let response = undefined;
|
|
145
|
-
|
|
165
|
+
|
|
146
166
|
response = await client.call('patch', apiPath, {
|
|
147
167
|
'content-type': 'application/json',
|
|
148
168
|
}, payload);
|
|
149
169
|
|
|
150
|
-
|
|
151
170
|
if (parseOutput) {
|
|
152
171
|
parse(response)
|
|
153
172
|
success()
|
|
@@ -158,7 +177,7 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
|
|
|
158
177
|
|
|
159
178
|
/**
|
|
160
179
|
* @typedef {Object} AccountListIdentitiesRequestParams
|
|
161
|
-
* @property {string} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
180
|
+
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
162
181
|
* @property {boolean} parseOutput
|
|
163
182
|
* @property {libClient | undefined} sdk
|
|
164
183
|
*/
|
|
@@ -168,21 +187,18 @@ const accountUpdateEmail = async ({ email, password, parseOutput = true, sdk = u
|
|
|
168
187
|
*/
|
|
169
188
|
const accountListIdentities = async ({ queries, parseOutput = true, sdk = undefined}) => {
|
|
170
189
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
171
|
-
|
|
172
190
|
let apiPath = '/account/identities';
|
|
173
191
|
let payload = {};
|
|
174
192
|
if (typeof queries !== 'undefined') {
|
|
175
193
|
payload['queries'] = queries;
|
|
176
194
|
}
|
|
177
195
|
|
|
178
|
-
|
|
179
196
|
let response = undefined;
|
|
180
|
-
|
|
197
|
+
|
|
181
198
|
response = await client.call('get', apiPath, {
|
|
182
199
|
'content-type': 'application/json',
|
|
183
200
|
}, payload);
|
|
184
201
|
|
|
185
|
-
|
|
186
202
|
if (parseOutput) {
|
|
187
203
|
parse(response)
|
|
188
204
|
success()
|
|
@@ -203,18 +219,15 @@ const accountListIdentities = async ({ queries, parseOutput = true, sdk = undefi
|
|
|
203
219
|
*/
|
|
204
220
|
const accountDeleteIdentity = async ({ identityId, parseOutput = true, sdk = undefined}) => {
|
|
205
221
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
206
|
-
|
|
207
222
|
let apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId);
|
|
208
223
|
let payload = {};
|
|
209
224
|
|
|
210
|
-
|
|
211
225
|
let response = undefined;
|
|
212
|
-
|
|
226
|
+
|
|
213
227
|
response = await client.call('delete', apiPath, {
|
|
214
228
|
'content-type': 'application/json',
|
|
215
229
|
}, payload);
|
|
216
230
|
|
|
217
|
-
|
|
218
231
|
if (parseOutput) {
|
|
219
232
|
parse(response)
|
|
220
233
|
success()
|
|
@@ -234,18 +247,15 @@ const accountDeleteIdentity = async ({ identityId, parseOutput = true, sdk = und
|
|
|
234
247
|
*/
|
|
235
248
|
const accountCreateJWT = async ({ parseOutput = true, sdk = undefined}) => {
|
|
236
249
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
237
|
-
|
|
238
250
|
let apiPath = '/account/jwt';
|
|
239
251
|
let payload = {};
|
|
240
252
|
|
|
241
|
-
|
|
242
253
|
let response = undefined;
|
|
243
|
-
|
|
254
|
+
|
|
244
255
|
response = await client.call('post', apiPath, {
|
|
245
256
|
'content-type': 'application/json',
|
|
246
257
|
}, payload);
|
|
247
258
|
|
|
248
|
-
|
|
249
259
|
if (parseOutput) {
|
|
250
260
|
parse(response)
|
|
251
261
|
success()
|
|
@@ -266,21 +276,18 @@ const accountCreateJWT = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
266
276
|
*/
|
|
267
277
|
const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined}) => {
|
|
268
278
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
269
|
-
|
|
270
279
|
let apiPath = '/account/logs';
|
|
271
280
|
let payload = {};
|
|
272
281
|
if (typeof queries !== 'undefined') {
|
|
273
282
|
payload['queries'] = queries;
|
|
274
283
|
}
|
|
275
284
|
|
|
276
|
-
|
|
277
285
|
let response = undefined;
|
|
278
|
-
|
|
286
|
+
|
|
279
287
|
response = await client.call('get', apiPath, {
|
|
280
288
|
'content-type': 'application/json',
|
|
281
289
|
}, payload);
|
|
282
290
|
|
|
283
|
-
|
|
284
291
|
if (parseOutput) {
|
|
285
292
|
parse(response)
|
|
286
293
|
success()
|
|
@@ -290,32 +297,29 @@ const accountListLogs = async ({ queries, parseOutput = true, sdk = undefined})
|
|
|
290
297
|
}
|
|
291
298
|
|
|
292
299
|
/**
|
|
293
|
-
* @typedef {Object}
|
|
294
|
-
* @property {
|
|
300
|
+
* @typedef {Object} AccountUpdateMFARequestParams
|
|
301
|
+
* @property {boolean} mfa Enable or disable MFA.
|
|
295
302
|
* @property {boolean} parseOutput
|
|
296
303
|
* @property {libClient | undefined} sdk
|
|
297
304
|
*/
|
|
298
305
|
|
|
299
306
|
/**
|
|
300
|
-
* @param {
|
|
307
|
+
* @param {AccountUpdateMFARequestParams} params
|
|
301
308
|
*/
|
|
302
|
-
const
|
|
309
|
+
const accountUpdateMFA = async ({ mfa, parseOutput = true, sdk = undefined}) => {
|
|
303
310
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
304
|
-
|
|
305
|
-
let apiPath = '/account/name';
|
|
311
|
+
let apiPath = '/account/mfa';
|
|
306
312
|
let payload = {};
|
|
307
|
-
if (typeof
|
|
308
|
-
payload['
|
|
313
|
+
if (typeof mfa !== 'undefined') {
|
|
314
|
+
payload['mfa'] = mfa;
|
|
309
315
|
}
|
|
310
316
|
|
|
311
|
-
|
|
312
317
|
let response = undefined;
|
|
313
|
-
|
|
318
|
+
|
|
314
319
|
response = await client.call('patch', apiPath, {
|
|
315
320
|
'content-type': 'application/json',
|
|
316
321
|
}, payload);
|
|
317
322
|
|
|
318
|
-
|
|
319
323
|
if (parseOutput) {
|
|
320
324
|
parse(response)
|
|
321
325
|
success()
|
|
@@ -325,36 +329,26 @@ const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) =
|
|
|
325
329
|
}
|
|
326
330
|
|
|
327
331
|
/**
|
|
328
|
-
* @typedef {Object}
|
|
329
|
-
* @property {
|
|
330
|
-
* @property {string} oldPassword Current user password. Must be at least 8 chars.
|
|
332
|
+
* @typedef {Object} AccountCreateMfaAuthenticatorRequestParams
|
|
333
|
+
* @property {AuthenticatorType} type Type of authenticator. Must be 'totp'
|
|
331
334
|
* @property {boolean} parseOutput
|
|
332
335
|
* @property {libClient | undefined} sdk
|
|
333
336
|
*/
|
|
334
337
|
|
|
335
338
|
/**
|
|
336
|
-
* @param {
|
|
339
|
+
* @param {AccountCreateMfaAuthenticatorRequestParams} params
|
|
337
340
|
*/
|
|
338
|
-
const
|
|
341
|
+
const accountCreateMfaAuthenticator = async ({ type, parseOutput = true, sdk = undefined}) => {
|
|
339
342
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
340
|
-
|
|
341
|
-
let apiPath = '/account/password';
|
|
343
|
+
let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
342
344
|
let payload = {};
|
|
343
|
-
if (typeof password !== 'undefined') {
|
|
344
|
-
payload['password'] = password;
|
|
345
|
-
}
|
|
346
|
-
if (typeof oldPassword !== 'undefined') {
|
|
347
|
-
payload['oldPassword'] = oldPassword;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
345
|
|
|
351
346
|
let response = undefined;
|
|
352
|
-
|
|
353
|
-
response = await client.call('
|
|
347
|
+
|
|
348
|
+
response = await client.call('post', apiPath, {
|
|
354
349
|
'content-type': 'application/json',
|
|
355
350
|
}, payload);
|
|
356
351
|
|
|
357
|
-
|
|
358
352
|
if (parseOutput) {
|
|
359
353
|
parse(response)
|
|
360
354
|
success()
|
|
@@ -364,36 +358,30 @@ const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true
|
|
|
364
358
|
}
|
|
365
359
|
|
|
366
360
|
/**
|
|
367
|
-
* @typedef {Object}
|
|
368
|
-
* @property {
|
|
369
|
-
* @property {string}
|
|
361
|
+
* @typedef {Object} AccountUpdateMfaAuthenticatorRequestParams
|
|
362
|
+
* @property {AuthenticatorType} type Type of authenticator.
|
|
363
|
+
* @property {string} otp Valid verification token.
|
|
370
364
|
* @property {boolean} parseOutput
|
|
371
365
|
* @property {libClient | undefined} sdk
|
|
372
366
|
*/
|
|
373
367
|
|
|
374
368
|
/**
|
|
375
|
-
* @param {
|
|
369
|
+
* @param {AccountUpdateMfaAuthenticatorRequestParams} params
|
|
376
370
|
*/
|
|
377
|
-
const
|
|
371
|
+
const accountUpdateMfaAuthenticator = async ({ type, otp, parseOutput = true, sdk = undefined}) => {
|
|
378
372
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
379
|
-
|
|
380
|
-
let apiPath = '/account/phone';
|
|
373
|
+
let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
381
374
|
let payload = {};
|
|
382
|
-
if (typeof
|
|
383
|
-
payload['
|
|
375
|
+
if (typeof otp !== 'undefined') {
|
|
376
|
+
payload['otp'] = otp;
|
|
384
377
|
}
|
|
385
|
-
if (typeof password !== 'undefined') {
|
|
386
|
-
payload['password'] = password;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
378
|
|
|
390
379
|
let response = undefined;
|
|
391
|
-
|
|
392
|
-
response = await client.call('
|
|
380
|
+
|
|
381
|
+
response = await client.call('put', apiPath, {
|
|
393
382
|
'content-type': 'application/json',
|
|
394
383
|
}, payload);
|
|
395
384
|
|
|
396
|
-
|
|
397
385
|
if (parseOutput) {
|
|
398
386
|
parse(response)
|
|
399
387
|
success()
|
|
@@ -403,28 +391,30 @@ const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = u
|
|
|
403
391
|
}
|
|
404
392
|
|
|
405
393
|
/**
|
|
406
|
-
* @typedef {Object}
|
|
394
|
+
* @typedef {Object} AccountDeleteMfaAuthenticatorRequestParams
|
|
395
|
+
* @property {AuthenticatorType} type Type of authenticator.
|
|
396
|
+
* @property {string} otp Valid verification token.
|
|
407
397
|
* @property {boolean} parseOutput
|
|
408
398
|
* @property {libClient | undefined} sdk
|
|
409
399
|
*/
|
|
410
400
|
|
|
411
401
|
/**
|
|
412
|
-
* @param {
|
|
402
|
+
* @param {AccountDeleteMfaAuthenticatorRequestParams} params
|
|
413
403
|
*/
|
|
414
|
-
const
|
|
404
|
+
const accountDeleteMfaAuthenticator = async ({ type, otp, parseOutput = true, sdk = undefined}) => {
|
|
415
405
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
416
|
-
|
|
417
|
-
let apiPath = '/account/prefs';
|
|
406
|
+
let apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
418
407
|
let payload = {};
|
|
419
|
-
|
|
408
|
+
if (typeof otp !== 'undefined') {
|
|
409
|
+
payload['otp'] = otp;
|
|
410
|
+
}
|
|
420
411
|
|
|
421
412
|
let response = undefined;
|
|
422
|
-
|
|
423
|
-
response = await client.call('
|
|
413
|
+
|
|
414
|
+
response = await client.call('delete', apiPath, {
|
|
424
415
|
'content-type': 'application/json',
|
|
425
416
|
}, payload);
|
|
426
417
|
|
|
427
|
-
|
|
428
418
|
if (parseOutput) {
|
|
429
419
|
parse(response)
|
|
430
420
|
success()
|
|
@@ -434,32 +424,29 @@ const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
434
424
|
}
|
|
435
425
|
|
|
436
426
|
/**
|
|
437
|
-
* @typedef {Object}
|
|
438
|
-
* @property {
|
|
427
|
+
* @typedef {Object} AccountCreateMfaChallengeRequestParams
|
|
428
|
+
* @property {AuthenticationFactor} factor Factor used for verification. Must be one of following: 'email', 'phone', 'totp', 'recoveryCode'.
|
|
439
429
|
* @property {boolean} parseOutput
|
|
440
430
|
* @property {libClient | undefined} sdk
|
|
441
431
|
*/
|
|
442
432
|
|
|
443
433
|
/**
|
|
444
|
-
* @param {
|
|
434
|
+
* @param {AccountCreateMfaChallengeRequestParams} params
|
|
445
435
|
*/
|
|
446
|
-
const
|
|
436
|
+
const accountCreateMfaChallenge = async ({ factor, parseOutput = true, sdk = undefined}) => {
|
|
447
437
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
448
|
-
|
|
449
|
-
let apiPath = '/account/prefs';
|
|
438
|
+
let apiPath = '/account/mfa/challenge';
|
|
450
439
|
let payload = {};
|
|
451
|
-
if (typeof
|
|
452
|
-
payload['
|
|
440
|
+
if (typeof factor !== 'undefined') {
|
|
441
|
+
payload['factor'] = factor;
|
|
453
442
|
}
|
|
454
443
|
|
|
455
|
-
|
|
456
444
|
let response = undefined;
|
|
457
|
-
|
|
458
|
-
response = await client.call('
|
|
445
|
+
|
|
446
|
+
response = await client.call('post', apiPath, {
|
|
459
447
|
'content-type': 'application/json',
|
|
460
448
|
}, payload);
|
|
461
449
|
|
|
462
|
-
|
|
463
450
|
if (parseOutput) {
|
|
464
451
|
parse(response)
|
|
465
452
|
success()
|
|
@@ -469,36 +456,33 @@ const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined})
|
|
|
469
456
|
}
|
|
470
457
|
|
|
471
458
|
/**
|
|
472
|
-
* @typedef {Object}
|
|
473
|
-
* @property {string}
|
|
474
|
-
* @property {string}
|
|
459
|
+
* @typedef {Object} AccountUpdateMfaChallengeRequestParams
|
|
460
|
+
* @property {string} challengeId ID of the challenge.
|
|
461
|
+
* @property {string} otp Valid verification token.
|
|
475
462
|
* @property {boolean} parseOutput
|
|
476
463
|
* @property {libClient | undefined} sdk
|
|
477
464
|
*/
|
|
478
465
|
|
|
479
466
|
/**
|
|
480
|
-
* @param {
|
|
467
|
+
* @param {AccountUpdateMfaChallengeRequestParams} params
|
|
481
468
|
*/
|
|
482
|
-
const
|
|
469
|
+
const accountUpdateMfaChallenge = async ({ challengeId, otp, parseOutput = true, sdk = undefined}) => {
|
|
483
470
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
484
|
-
|
|
485
|
-
let apiPath = '/account/recovery';
|
|
471
|
+
let apiPath = '/account/mfa/challenge';
|
|
486
472
|
let payload = {};
|
|
487
|
-
if (typeof
|
|
488
|
-
payload['
|
|
473
|
+
if (typeof challengeId !== 'undefined') {
|
|
474
|
+
payload['challengeId'] = challengeId;
|
|
489
475
|
}
|
|
490
|
-
if (typeof
|
|
491
|
-
payload['
|
|
476
|
+
if (typeof otp !== 'undefined') {
|
|
477
|
+
payload['otp'] = otp;
|
|
492
478
|
}
|
|
493
479
|
|
|
494
|
-
|
|
495
480
|
let response = undefined;
|
|
496
|
-
|
|
497
|
-
response = await client.call('
|
|
481
|
+
|
|
482
|
+
response = await client.call('put', apiPath, {
|
|
498
483
|
'content-type': 'application/json',
|
|
499
484
|
}, payload);
|
|
500
485
|
|
|
501
|
-
|
|
502
486
|
if (parseOutput) {
|
|
503
487
|
parse(response)
|
|
504
488
|
success()
|
|
@@ -508,44 +492,25 @@ const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = und
|
|
|
508
492
|
}
|
|
509
493
|
|
|
510
494
|
/**
|
|
511
|
-
* @typedef {Object}
|
|
512
|
-
* @property {string} userId User ID.
|
|
513
|
-
* @property {string} secret Valid reset token.
|
|
514
|
-
* @property {string} password New user password. Must be at least 8 chars.
|
|
515
|
-
* @property {string} passwordAgain Repeat new user password. Must be at least 8 chars.
|
|
495
|
+
* @typedef {Object} AccountListMfaFactorsRequestParams
|
|
516
496
|
* @property {boolean} parseOutput
|
|
517
497
|
* @property {libClient | undefined} sdk
|
|
518
498
|
*/
|
|
519
499
|
|
|
520
500
|
/**
|
|
521
|
-
* @param {
|
|
501
|
+
* @param {AccountListMfaFactorsRequestParams} params
|
|
522
502
|
*/
|
|
523
|
-
const
|
|
503
|
+
const accountListMfaFactors = async ({ parseOutput = true, sdk = undefined}) => {
|
|
524
504
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
525
|
-
|
|
526
|
-
let apiPath = '/account/recovery';
|
|
505
|
+
let apiPath = '/account/mfa/factors';
|
|
527
506
|
let payload = {};
|
|
528
|
-
if (typeof userId !== 'undefined') {
|
|
529
|
-
payload['userId'] = userId;
|
|
530
|
-
}
|
|
531
|
-
if (typeof secret !== 'undefined') {
|
|
532
|
-
payload['secret'] = secret;
|
|
533
|
-
}
|
|
534
|
-
if (typeof password !== 'undefined') {
|
|
535
|
-
payload['password'] = password;
|
|
536
|
-
}
|
|
537
|
-
if (typeof passwordAgain !== 'undefined') {
|
|
538
|
-
payload['passwordAgain'] = passwordAgain;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
507
|
|
|
542
508
|
let response = undefined;
|
|
543
|
-
|
|
544
|
-
response = await client.call('
|
|
509
|
+
|
|
510
|
+
response = await client.call('get', apiPath, {
|
|
545
511
|
'content-type': 'application/json',
|
|
546
512
|
}, payload);
|
|
547
513
|
|
|
548
|
-
|
|
549
514
|
if (parseOutput) {
|
|
550
515
|
parse(response)
|
|
551
516
|
success()
|
|
@@ -555,28 +520,25 @@ const accountUpdateRecovery = async ({ userId, secret, password, passwordAgain,
|
|
|
555
520
|
}
|
|
556
521
|
|
|
557
522
|
/**
|
|
558
|
-
* @typedef {Object}
|
|
523
|
+
* @typedef {Object} AccountGetMfaRecoveryCodesRequestParams
|
|
559
524
|
* @property {boolean} parseOutput
|
|
560
525
|
* @property {libClient | undefined} sdk
|
|
561
526
|
*/
|
|
562
527
|
|
|
563
528
|
/**
|
|
564
|
-
* @param {
|
|
529
|
+
* @param {AccountGetMfaRecoveryCodesRequestParams} params
|
|
565
530
|
*/
|
|
566
|
-
const
|
|
531
|
+
const accountGetMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
567
532
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
568
|
-
|
|
569
|
-
let apiPath = '/account/sessions';
|
|
533
|
+
let apiPath = '/account/mfa/recovery-codes';
|
|
570
534
|
let payload = {};
|
|
571
535
|
|
|
572
|
-
|
|
573
536
|
let response = undefined;
|
|
574
|
-
|
|
537
|
+
|
|
575
538
|
response = await client.call('get', apiPath, {
|
|
576
539
|
'content-type': 'application/json',
|
|
577
540
|
}, payload);
|
|
578
541
|
|
|
579
|
-
|
|
580
542
|
if (parseOutput) {
|
|
581
543
|
parse(response)
|
|
582
544
|
success()
|
|
@@ -586,28 +548,25 @@ const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
586
548
|
}
|
|
587
549
|
|
|
588
550
|
/**
|
|
589
|
-
* @typedef {Object}
|
|
551
|
+
* @typedef {Object} AccountCreateMfaRecoveryCodesRequestParams
|
|
590
552
|
* @property {boolean} parseOutput
|
|
591
553
|
* @property {libClient | undefined} sdk
|
|
592
554
|
*/
|
|
593
555
|
|
|
594
556
|
/**
|
|
595
|
-
* @param {
|
|
557
|
+
* @param {AccountCreateMfaRecoveryCodesRequestParams} params
|
|
596
558
|
*/
|
|
597
|
-
const
|
|
559
|
+
const accountCreateMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
598
560
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
599
|
-
|
|
600
|
-
let apiPath = '/account/sessions';
|
|
561
|
+
let apiPath = '/account/mfa/recovery-codes';
|
|
601
562
|
let payload = {};
|
|
602
563
|
|
|
603
|
-
|
|
604
564
|
let response = undefined;
|
|
605
|
-
|
|
606
|
-
response = await client.call('
|
|
565
|
+
|
|
566
|
+
response = await client.call('post', apiPath, {
|
|
607
567
|
'content-type': 'application/json',
|
|
608
568
|
}, payload);
|
|
609
569
|
|
|
610
|
-
|
|
611
570
|
if (parseOutput) {
|
|
612
571
|
parse(response)
|
|
613
572
|
success()
|
|
@@ -617,28 +576,25 @@ const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) =>
|
|
|
617
576
|
}
|
|
618
577
|
|
|
619
578
|
/**
|
|
620
|
-
* @typedef {Object}
|
|
579
|
+
* @typedef {Object} AccountUpdateMfaRecoveryCodesRequestParams
|
|
621
580
|
* @property {boolean} parseOutput
|
|
622
581
|
* @property {libClient | undefined} sdk
|
|
623
582
|
*/
|
|
624
583
|
|
|
625
584
|
/**
|
|
626
|
-
* @param {
|
|
585
|
+
* @param {AccountUpdateMfaRecoveryCodesRequestParams} params
|
|
627
586
|
*/
|
|
628
|
-
const
|
|
587
|
+
const accountUpdateMfaRecoveryCodes = async ({ parseOutput = true, sdk = undefined}) => {
|
|
629
588
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
630
|
-
|
|
631
|
-
let apiPath = '/account/sessions/anonymous';
|
|
589
|
+
let apiPath = '/account/mfa/recovery-codes';
|
|
632
590
|
let payload = {};
|
|
633
591
|
|
|
634
|
-
|
|
635
592
|
let response = undefined;
|
|
636
|
-
|
|
637
|
-
response = await client.call('
|
|
593
|
+
|
|
594
|
+
response = await client.call('patch', apiPath, {
|
|
638
595
|
'content-type': 'application/json',
|
|
639
596
|
}, payload);
|
|
640
597
|
|
|
641
|
-
|
|
642
598
|
if (parseOutput) {
|
|
643
599
|
parse(response)
|
|
644
600
|
success()
|
|
@@ -648,36 +604,29 @@ const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefin
|
|
|
648
604
|
}
|
|
649
605
|
|
|
650
606
|
/**
|
|
651
|
-
* @typedef {Object}
|
|
652
|
-
* @property {string}
|
|
653
|
-
* @property {string} password User password. Must be at least 8 chars.
|
|
607
|
+
* @typedef {Object} AccountUpdateNameRequestParams
|
|
608
|
+
* @property {string} name User name. Max length: 128 chars.
|
|
654
609
|
* @property {boolean} parseOutput
|
|
655
610
|
* @property {libClient | undefined} sdk
|
|
656
611
|
*/
|
|
657
612
|
|
|
658
613
|
/**
|
|
659
|
-
* @param {
|
|
614
|
+
* @param {AccountUpdateNameRequestParams} params
|
|
660
615
|
*/
|
|
661
|
-
const
|
|
616
|
+
const accountUpdateName = async ({ name, parseOutput = true, sdk = undefined}) => {
|
|
662
617
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
663
|
-
|
|
664
|
-
let apiPath = '/account/sessions/email';
|
|
618
|
+
let apiPath = '/account/name';
|
|
665
619
|
let payload = {};
|
|
666
|
-
if (typeof
|
|
667
|
-
payload['
|
|
668
|
-
}
|
|
669
|
-
if (typeof password !== 'undefined') {
|
|
670
|
-
payload['password'] = password;
|
|
620
|
+
if (typeof name !== 'undefined') {
|
|
621
|
+
payload['name'] = name;
|
|
671
622
|
}
|
|
672
623
|
|
|
673
|
-
|
|
674
624
|
let response = undefined;
|
|
675
|
-
|
|
676
|
-
response = await client.call('
|
|
625
|
+
|
|
626
|
+
response = await client.call('patch', apiPath, {
|
|
677
627
|
'content-type': 'application/json',
|
|
678
628
|
}, payload);
|
|
679
629
|
|
|
680
|
-
|
|
681
630
|
if (parseOutput) {
|
|
682
631
|
parse(response)
|
|
683
632
|
success()
|
|
@@ -687,40 +636,561 @@ const accountCreateEmailSession = async ({ email, password, parseOutput = true,
|
|
|
687
636
|
}
|
|
688
637
|
|
|
689
638
|
/**
|
|
690
|
-
* @typedef {Object}
|
|
691
|
-
* @property {string}
|
|
692
|
-
* @property {string}
|
|
693
|
-
* @property {string} url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
639
|
+
* @typedef {Object} AccountUpdatePasswordRequestParams
|
|
640
|
+
* @property {string} password New user password. Must be at least 8 chars.
|
|
641
|
+
* @property {string} oldPassword Current user password. Must be at least 8 chars.
|
|
694
642
|
* @property {boolean} parseOutput
|
|
695
643
|
* @property {libClient | undefined} sdk
|
|
696
644
|
*/
|
|
697
645
|
|
|
698
646
|
/**
|
|
699
|
-
* @param {
|
|
647
|
+
* @param {AccountUpdatePasswordRequestParams} params
|
|
700
648
|
*/
|
|
701
|
-
const
|
|
649
|
+
const accountUpdatePassword = async ({ password, oldPassword, parseOutput = true, sdk = undefined}) => {
|
|
702
650
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
703
|
-
|
|
704
|
-
let apiPath = '/account/sessions/magic-url';
|
|
651
|
+
let apiPath = '/account/password';
|
|
705
652
|
let payload = {};
|
|
706
|
-
if (typeof
|
|
707
|
-
payload['
|
|
708
|
-
}
|
|
709
|
-
if (typeof email !== 'undefined') {
|
|
710
|
-
payload['email'] = email;
|
|
653
|
+
if (typeof password !== 'undefined') {
|
|
654
|
+
payload['password'] = password;
|
|
711
655
|
}
|
|
712
|
-
if (typeof
|
|
713
|
-
payload['
|
|
656
|
+
if (typeof oldPassword !== 'undefined') {
|
|
657
|
+
payload['oldPassword'] = oldPassword;
|
|
714
658
|
}
|
|
715
659
|
|
|
660
|
+
let response = undefined;
|
|
661
|
+
|
|
662
|
+
response = await client.call('patch', apiPath, {
|
|
663
|
+
'content-type': 'application/json',
|
|
664
|
+
}, payload);
|
|
665
|
+
|
|
666
|
+
if (parseOutput) {
|
|
667
|
+
parse(response)
|
|
668
|
+
success()
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return response;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @typedef {Object} AccountUpdatePhoneRequestParams
|
|
676
|
+
* @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
677
|
+
* @property {string} password User password. Must be at least 8 chars.
|
|
678
|
+
* @property {boolean} parseOutput
|
|
679
|
+
* @property {libClient | undefined} sdk
|
|
680
|
+
*/
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* @param {AccountUpdatePhoneRequestParams} params
|
|
684
|
+
*/
|
|
685
|
+
const accountUpdatePhone = async ({ phone, password, parseOutput = true, sdk = undefined}) => {
|
|
686
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
687
|
+
let apiPath = '/account/phone';
|
|
688
|
+
let payload = {};
|
|
689
|
+
if (typeof phone !== 'undefined') {
|
|
690
|
+
payload['phone'] = phone;
|
|
691
|
+
}
|
|
692
|
+
if (typeof password !== 'undefined') {
|
|
693
|
+
payload['password'] = password;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
let response = undefined;
|
|
697
|
+
|
|
698
|
+
response = await client.call('patch', apiPath, {
|
|
699
|
+
'content-type': 'application/json',
|
|
700
|
+
}, payload);
|
|
701
|
+
|
|
702
|
+
if (parseOutput) {
|
|
703
|
+
parse(response)
|
|
704
|
+
success()
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return response;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* @typedef {Object} AccountGetPrefsRequestParams
|
|
712
|
+
* @property {boolean} parseOutput
|
|
713
|
+
* @property {libClient | undefined} sdk
|
|
714
|
+
*/
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* @param {AccountGetPrefsRequestParams} params
|
|
718
|
+
*/
|
|
719
|
+
const accountGetPrefs = async ({ parseOutput = true, sdk = undefined}) => {
|
|
720
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
721
|
+
let apiPath = '/account/prefs';
|
|
722
|
+
let payload = {};
|
|
723
|
+
|
|
724
|
+
let response = undefined;
|
|
725
|
+
|
|
726
|
+
response = await client.call('get', apiPath, {
|
|
727
|
+
'content-type': 'application/json',
|
|
728
|
+
}, payload);
|
|
729
|
+
|
|
730
|
+
if (parseOutput) {
|
|
731
|
+
parse(response)
|
|
732
|
+
success()
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
return response;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* @typedef {Object} AccountUpdatePrefsRequestParams
|
|
740
|
+
* @property {object} prefs Prefs key-value JSON object.
|
|
741
|
+
* @property {boolean} parseOutput
|
|
742
|
+
* @property {libClient | undefined} sdk
|
|
743
|
+
*/
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* @param {AccountUpdatePrefsRequestParams} params
|
|
747
|
+
*/
|
|
748
|
+
const accountUpdatePrefs = async ({ prefs, parseOutput = true, sdk = undefined}) => {
|
|
749
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
750
|
+
let apiPath = '/account/prefs';
|
|
751
|
+
let payload = {};
|
|
752
|
+
if (typeof prefs !== 'undefined') {
|
|
753
|
+
payload['prefs'] = JSON.parse(prefs);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
let response = undefined;
|
|
757
|
+
|
|
758
|
+
response = await client.call('patch', apiPath, {
|
|
759
|
+
'content-type': 'application/json',
|
|
760
|
+
}, payload);
|
|
761
|
+
|
|
762
|
+
if (parseOutput) {
|
|
763
|
+
parse(response)
|
|
764
|
+
success()
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return response;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* @typedef {Object} AccountCreateRecoveryRequestParams
|
|
772
|
+
* @property {string} email User email.
|
|
773
|
+
* @property {string} url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
774
|
+
* @property {boolean} parseOutput
|
|
775
|
+
* @property {libClient | undefined} sdk
|
|
776
|
+
*/
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* @param {AccountCreateRecoveryRequestParams} params
|
|
780
|
+
*/
|
|
781
|
+
const accountCreateRecovery = async ({ email, url, parseOutput = true, sdk = undefined}) => {
|
|
782
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
783
|
+
let apiPath = '/account/recovery';
|
|
784
|
+
let payload = {};
|
|
785
|
+
if (typeof email !== 'undefined') {
|
|
786
|
+
payload['email'] = email;
|
|
787
|
+
}
|
|
788
|
+
if (typeof url !== 'undefined') {
|
|
789
|
+
payload['url'] = url;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
let response = undefined;
|
|
793
|
+
|
|
794
|
+
response = await client.call('post', apiPath, {
|
|
795
|
+
'content-type': 'application/json',
|
|
796
|
+
}, payload);
|
|
797
|
+
|
|
798
|
+
if (parseOutput) {
|
|
799
|
+
parse(response)
|
|
800
|
+
success()
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
return response;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* @typedef {Object} AccountUpdateRecoveryRequestParams
|
|
808
|
+
* @property {string} userId User ID.
|
|
809
|
+
* @property {string} secret Valid reset token.
|
|
810
|
+
* @property {string} password New user password. Must be between 8 and 256 chars.
|
|
811
|
+
* @property {boolean} parseOutput
|
|
812
|
+
* @property {libClient | undefined} sdk
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* @param {AccountUpdateRecoveryRequestParams} params
|
|
817
|
+
*/
|
|
818
|
+
const accountUpdateRecovery = async ({ userId, secret, password, parseOutput = true, sdk = undefined}) => {
|
|
819
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
820
|
+
let apiPath = '/account/recovery';
|
|
821
|
+
let payload = {};
|
|
822
|
+
if (typeof userId !== 'undefined') {
|
|
823
|
+
payload['userId'] = userId;
|
|
824
|
+
}
|
|
825
|
+
if (typeof secret !== 'undefined') {
|
|
826
|
+
payload['secret'] = secret;
|
|
827
|
+
}
|
|
828
|
+
if (typeof password !== 'undefined') {
|
|
829
|
+
payload['password'] = password;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
let response = undefined;
|
|
833
|
+
|
|
834
|
+
response = await client.call('put', apiPath, {
|
|
835
|
+
'content-type': 'application/json',
|
|
836
|
+
}, payload);
|
|
837
|
+
|
|
838
|
+
if (parseOutput) {
|
|
839
|
+
parse(response)
|
|
840
|
+
success()
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
return response;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* @typedef {Object} AccountListSessionsRequestParams
|
|
848
|
+
* @property {boolean} parseOutput
|
|
849
|
+
* @property {libClient | undefined} sdk
|
|
850
|
+
*/
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* @param {AccountListSessionsRequestParams} params
|
|
854
|
+
*/
|
|
855
|
+
const accountListSessions = async ({ parseOutput = true, sdk = undefined}) => {
|
|
856
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
857
|
+
let apiPath = '/account/sessions';
|
|
858
|
+
let payload = {};
|
|
859
|
+
|
|
860
|
+
let response = undefined;
|
|
861
|
+
|
|
862
|
+
response = await client.call('get', apiPath, {
|
|
863
|
+
'content-type': 'application/json',
|
|
864
|
+
}, payload);
|
|
865
|
+
|
|
866
|
+
if (parseOutput) {
|
|
867
|
+
parse(response)
|
|
868
|
+
success()
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return response;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* @typedef {Object} AccountDeleteSessionsRequestParams
|
|
876
|
+
* @property {boolean} parseOutput
|
|
877
|
+
* @property {libClient | undefined} sdk
|
|
878
|
+
*/
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* @param {AccountDeleteSessionsRequestParams} params
|
|
882
|
+
*/
|
|
883
|
+
const accountDeleteSessions = async ({ parseOutput = true, sdk = undefined}) => {
|
|
884
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
885
|
+
let apiPath = '/account/sessions';
|
|
886
|
+
let payload = {};
|
|
887
|
+
|
|
888
|
+
let response = undefined;
|
|
889
|
+
|
|
890
|
+
response = await client.call('delete', apiPath, {
|
|
891
|
+
'content-type': 'application/json',
|
|
892
|
+
}, payload);
|
|
893
|
+
|
|
894
|
+
if (parseOutput) {
|
|
895
|
+
parse(response)
|
|
896
|
+
success()
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return response;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* @typedef {Object} AccountCreateAnonymousSessionRequestParams
|
|
904
|
+
* @property {boolean} parseOutput
|
|
905
|
+
* @property {libClient | undefined} sdk
|
|
906
|
+
*/
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @param {AccountCreateAnonymousSessionRequestParams} params
|
|
910
|
+
*/
|
|
911
|
+
const accountCreateAnonymousSession = async ({ parseOutput = true, sdk = undefined}) => {
|
|
912
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
913
|
+
let apiPath = '/account/sessions/anonymous';
|
|
914
|
+
let payload = {};
|
|
915
|
+
|
|
916
|
+
let response = undefined;
|
|
917
|
+
|
|
918
|
+
response = await client.call('post', apiPath, {
|
|
919
|
+
'content-type': 'application/json',
|
|
920
|
+
}, payload);
|
|
921
|
+
|
|
922
|
+
if (parseOutput) {
|
|
923
|
+
parse(response)
|
|
924
|
+
success()
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
return response;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* @typedef {Object} AccountCreateEmailPasswordSessionRequestParams
|
|
932
|
+
* @property {string} email User email.
|
|
933
|
+
* @property {string} password User password. Must be at least 8 chars.
|
|
934
|
+
* @property {boolean} parseOutput
|
|
935
|
+
* @property {libClient | undefined} sdk
|
|
936
|
+
*/
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* @param {AccountCreateEmailPasswordSessionRequestParams} params
|
|
940
|
+
*/
|
|
941
|
+
const accountCreateEmailPasswordSession = async ({ email, password, parseOutput = true, sdk = undefined}) => {
|
|
942
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
943
|
+
let apiPath = '/account/sessions/email';
|
|
944
|
+
let payload = {};
|
|
945
|
+
if (typeof email !== 'undefined') {
|
|
946
|
+
payload['email'] = email;
|
|
947
|
+
}
|
|
948
|
+
if (typeof password !== 'undefined') {
|
|
949
|
+
payload['password'] = password;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
let response = undefined;
|
|
953
|
+
|
|
954
|
+
response = await client.call('post', apiPath, {
|
|
955
|
+
'content-type': 'application/json',
|
|
956
|
+
}, payload);
|
|
957
|
+
|
|
958
|
+
if (parseOutput) {
|
|
959
|
+
parse(response)
|
|
960
|
+
success()
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
return response;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* @typedef {Object} AccountUpdateMagicURLSessionRequestParams
|
|
968
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
969
|
+
* @property {string} secret Valid verification token.
|
|
970
|
+
* @property {boolean} parseOutput
|
|
971
|
+
* @property {libClient | undefined} sdk
|
|
972
|
+
*/
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* @param {AccountUpdateMagicURLSessionRequestParams} params
|
|
976
|
+
*/
|
|
977
|
+
const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
978
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
979
|
+
let apiPath = '/account/sessions/magic-url';
|
|
980
|
+
let payload = {};
|
|
981
|
+
if (typeof userId !== 'undefined') {
|
|
982
|
+
payload['userId'] = userId;
|
|
983
|
+
}
|
|
984
|
+
if (typeof secret !== 'undefined') {
|
|
985
|
+
payload['secret'] = secret;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
let response = undefined;
|
|
989
|
+
|
|
990
|
+
response = await client.call('put', apiPath, {
|
|
991
|
+
'content-type': 'application/json',
|
|
992
|
+
}, payload);
|
|
993
|
+
|
|
994
|
+
if (parseOutput) {
|
|
995
|
+
parse(response)
|
|
996
|
+
success()
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
return response;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* @typedef {Object} AccountCreateOAuth2SessionRequestParams
|
|
1004
|
+
* @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
1005
|
+
* @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1006
|
+
* @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1007
|
+
* @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
1008
|
+
* @property {boolean} parseOutput
|
|
1009
|
+
* @property {libClient | undefined} sdk
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* @param {AccountCreateOAuth2SessionRequestParams} params
|
|
1014
|
+
*/
|
|
1015
|
+
const accountCreateOAuth2Session = async ({ provider, success, failure, scopes, parseOutput = true, sdk = undefined}) => {
|
|
1016
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1017
|
+
let apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
1018
|
+
let payload = {};
|
|
1019
|
+
if (typeof success !== 'undefined') {
|
|
1020
|
+
payload['success'] = success;
|
|
1021
|
+
}
|
|
1022
|
+
if (typeof failure !== 'undefined') {
|
|
1023
|
+
payload['failure'] = failure;
|
|
1024
|
+
}
|
|
1025
|
+
if (typeof scopes !== 'undefined') {
|
|
1026
|
+
payload['scopes'] = scopes;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
let response = undefined;
|
|
1030
|
+
|
|
1031
|
+
response = await client.call('get', apiPath, {
|
|
1032
|
+
'content-type': 'application/json',
|
|
1033
|
+
}, payload);
|
|
1034
|
+
|
|
1035
|
+
if (parseOutput) {
|
|
1036
|
+
parse(response)
|
|
1037
|
+
success()
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
return response;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* @typedef {Object} AccountUpdatePhoneSessionRequestParams
|
|
1045
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1046
|
+
* @property {string} secret Valid verification token.
|
|
1047
|
+
* @property {boolean} parseOutput
|
|
1048
|
+
* @property {libClient | undefined} sdk
|
|
1049
|
+
*/
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* @param {AccountUpdatePhoneSessionRequestParams} params
|
|
1053
|
+
*/
|
|
1054
|
+
const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
1055
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1056
|
+
let apiPath = '/account/sessions/phone';
|
|
1057
|
+
let payload = {};
|
|
1058
|
+
if (typeof userId !== 'undefined') {
|
|
1059
|
+
payload['userId'] = userId;
|
|
1060
|
+
}
|
|
1061
|
+
if (typeof secret !== 'undefined') {
|
|
1062
|
+
payload['secret'] = secret;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
let response = undefined;
|
|
1066
|
+
|
|
1067
|
+
response = await client.call('put', apiPath, {
|
|
1068
|
+
'content-type': 'application/json',
|
|
1069
|
+
}, payload);
|
|
1070
|
+
|
|
1071
|
+
if (parseOutput) {
|
|
1072
|
+
parse(response)
|
|
1073
|
+
success()
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
return response;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* @typedef {Object} AccountCreateSessionRequestParams
|
|
1081
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1082
|
+
* @property {string} secret Secret of a token generated by login methods. For example, the 'createMagicURLToken' or 'createPhoneToken' methods.
|
|
1083
|
+
* @property {boolean} parseOutput
|
|
1084
|
+
* @property {libClient | undefined} sdk
|
|
1085
|
+
*/
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* @param {AccountCreateSessionRequestParams} params
|
|
1089
|
+
*/
|
|
1090
|
+
const accountCreateSession = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
1091
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1092
|
+
let apiPath = '/account/sessions/token';
|
|
1093
|
+
let payload = {};
|
|
1094
|
+
if (typeof userId !== 'undefined') {
|
|
1095
|
+
payload['userId'] = userId;
|
|
1096
|
+
}
|
|
1097
|
+
if (typeof secret !== 'undefined') {
|
|
1098
|
+
payload['secret'] = secret;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
let response = undefined;
|
|
1102
|
+
|
|
1103
|
+
response = await client.call('post', apiPath, {
|
|
1104
|
+
'content-type': 'application/json',
|
|
1105
|
+
}, payload);
|
|
1106
|
+
|
|
1107
|
+
if (parseOutput) {
|
|
1108
|
+
parse(response)
|
|
1109
|
+
success()
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
return response;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @typedef {Object} AccountGetSessionRequestParams
|
|
1117
|
+
* @property {string} sessionId Session ID. Use the string 'current' to get the current device session.
|
|
1118
|
+
* @property {boolean} parseOutput
|
|
1119
|
+
* @property {libClient | undefined} sdk
|
|
1120
|
+
*/
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* @param {AccountGetSessionRequestParams} params
|
|
1124
|
+
*/
|
|
1125
|
+
const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
|
|
1126
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1127
|
+
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1128
|
+
let payload = {};
|
|
1129
|
+
|
|
1130
|
+
let response = undefined;
|
|
1131
|
+
|
|
1132
|
+
response = await client.call('get', apiPath, {
|
|
1133
|
+
'content-type': 'application/json',
|
|
1134
|
+
}, payload);
|
|
1135
|
+
|
|
1136
|
+
if (parseOutput) {
|
|
1137
|
+
parse(response)
|
|
1138
|
+
success()
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
return response;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* @typedef {Object} AccountUpdateSessionRequestParams
|
|
1146
|
+
* @property {string} sessionId Session ID. Use the string 'current' to update the current device session.
|
|
1147
|
+
* @property {boolean} parseOutput
|
|
1148
|
+
* @property {libClient | undefined} sdk
|
|
1149
|
+
*/
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @param {AccountUpdateSessionRequestParams} params
|
|
1153
|
+
*/
|
|
1154
|
+
const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
|
|
1155
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1156
|
+
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1157
|
+
let payload = {};
|
|
1158
|
+
|
|
1159
|
+
let response = undefined;
|
|
1160
|
+
|
|
1161
|
+
response = await client.call('patch', apiPath, {
|
|
1162
|
+
'content-type': 'application/json',
|
|
1163
|
+
}, payload);
|
|
1164
|
+
|
|
1165
|
+
if (parseOutput) {
|
|
1166
|
+
parse(response)
|
|
1167
|
+
success()
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
return response;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* @typedef {Object} AccountDeleteSessionRequestParams
|
|
1175
|
+
* @property {string} sessionId Session ID. Use the string 'current' to delete the current device session.
|
|
1176
|
+
* @property {boolean} parseOutput
|
|
1177
|
+
* @property {libClient | undefined} sdk
|
|
1178
|
+
*/
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* @param {AccountDeleteSessionRequestParams} params
|
|
1182
|
+
*/
|
|
1183
|
+
const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undefined}) => {
|
|
1184
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
1185
|
+
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1186
|
+
let payload = {};
|
|
716
1187
|
|
|
717
1188
|
let response = undefined;
|
|
718
|
-
|
|
719
|
-
response = await client.call('
|
|
1189
|
+
|
|
1190
|
+
response = await client.call('delete', apiPath, {
|
|
720
1191
|
'content-type': 'application/json',
|
|
721
1192
|
}, payload);
|
|
722
1193
|
|
|
723
|
-
|
|
724
1194
|
if (parseOutput) {
|
|
725
1195
|
parse(response)
|
|
726
1196
|
success()
|
|
@@ -730,36 +1200,25 @@ const accountCreateMagicURLSession = async ({ userId, email, url, parseOutput =
|
|
|
730
1200
|
}
|
|
731
1201
|
|
|
732
1202
|
/**
|
|
733
|
-
* @typedef {Object}
|
|
734
|
-
* @property {string} userId User ID.
|
|
735
|
-
* @property {string} secret Valid verification token.
|
|
1203
|
+
* @typedef {Object} AccountUpdateStatusRequestParams
|
|
736
1204
|
* @property {boolean} parseOutput
|
|
737
1205
|
* @property {libClient | undefined} sdk
|
|
738
1206
|
*/
|
|
739
1207
|
|
|
740
1208
|
/**
|
|
741
|
-
* @param {
|
|
1209
|
+
* @param {AccountUpdateStatusRequestParams} params
|
|
742
1210
|
*/
|
|
743
|
-
const
|
|
1211
|
+
const accountUpdateStatus = async ({ parseOutput = true, sdk = undefined}) => {
|
|
744
1212
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
745
|
-
|
|
746
|
-
let apiPath = '/account/sessions/magic-url';
|
|
1213
|
+
let apiPath = '/account/status';
|
|
747
1214
|
let payload = {};
|
|
748
|
-
if (typeof userId !== 'undefined') {
|
|
749
|
-
payload['userId'] = userId;
|
|
750
|
-
}
|
|
751
|
-
if (typeof secret !== 'undefined') {
|
|
752
|
-
payload['secret'] = secret;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
1215
|
|
|
756
1216
|
let response = undefined;
|
|
757
|
-
|
|
758
|
-
response = await client.call('
|
|
1217
|
+
|
|
1218
|
+
response = await client.call('patch', apiPath, {
|
|
759
1219
|
'content-type': 'application/json',
|
|
760
1220
|
}, payload);
|
|
761
1221
|
|
|
762
|
-
|
|
763
1222
|
if (parseOutput) {
|
|
764
1223
|
parse(response)
|
|
765
1224
|
success()
|
|
@@ -769,41 +1228,37 @@ const accountUpdateMagicURLSession = async ({ userId, secret, parseOutput = true
|
|
|
769
1228
|
}
|
|
770
1229
|
|
|
771
1230
|
/**
|
|
772
|
-
* @typedef {Object}
|
|
773
|
-
* @property {string}
|
|
774
|
-
* @property {string}
|
|
775
|
-
* @property {string}
|
|
776
|
-
* @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
1231
|
+
* @typedef {Object} AccountCreatePushTargetRequestParams
|
|
1232
|
+
* @property {string} targetId Target ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1233
|
+
* @property {string} identifier The target identifier (token, email, phone etc.)
|
|
1234
|
+
* @property {string} providerId Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.
|
|
777
1235
|
* @property {boolean} parseOutput
|
|
778
1236
|
* @property {libClient | undefined} sdk
|
|
779
1237
|
*/
|
|
780
1238
|
|
|
781
1239
|
/**
|
|
782
|
-
* @param {
|
|
1240
|
+
* @param {AccountCreatePushTargetRequestParams} params
|
|
783
1241
|
*/
|
|
784
|
-
const
|
|
1242
|
+
const accountCreatePushTarget = async ({ targetId, identifier, providerId, parseOutput = true, sdk = undefined}) => {
|
|
785
1243
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
786
|
-
|
|
787
|
-
let apiPath = '/account/sessions/oauth2/{provider}'.replace('{provider}', provider);
|
|
1244
|
+
let apiPath = '/account/targets/push';
|
|
788
1245
|
let payload = {};
|
|
789
|
-
if (typeof
|
|
790
|
-
payload['
|
|
1246
|
+
if (typeof targetId !== 'undefined') {
|
|
1247
|
+
payload['targetId'] = targetId;
|
|
791
1248
|
}
|
|
792
|
-
if (typeof
|
|
793
|
-
payload['
|
|
1249
|
+
if (typeof identifier !== 'undefined') {
|
|
1250
|
+
payload['identifier'] = identifier;
|
|
794
1251
|
}
|
|
795
|
-
if (typeof
|
|
796
|
-
payload['
|
|
1252
|
+
if (typeof providerId !== 'undefined') {
|
|
1253
|
+
payload['providerId'] = providerId;
|
|
797
1254
|
}
|
|
798
1255
|
|
|
799
|
-
|
|
800
1256
|
let response = undefined;
|
|
801
|
-
|
|
802
|
-
response = await client.call('
|
|
1257
|
+
|
|
1258
|
+
response = await client.call('post', apiPath, {
|
|
803
1259
|
'content-type': 'application/json',
|
|
804
1260
|
}, payload);
|
|
805
1261
|
|
|
806
|
-
|
|
807
1262
|
if (parseOutput) {
|
|
808
1263
|
parse(response)
|
|
809
1264
|
success()
|
|
@@ -813,36 +1268,30 @@ const accountCreateOAuth2Session = async ({ provider, success, failure, scopes,
|
|
|
813
1268
|
}
|
|
814
1269
|
|
|
815
1270
|
/**
|
|
816
|
-
* @typedef {Object}
|
|
817
|
-
* @property {string}
|
|
818
|
-
* @property {string}
|
|
1271
|
+
* @typedef {Object} AccountUpdatePushTargetRequestParams
|
|
1272
|
+
* @property {string} targetId Target ID.
|
|
1273
|
+
* @property {string} identifier The target identifier (token, email, phone etc.)
|
|
819
1274
|
* @property {boolean} parseOutput
|
|
820
1275
|
* @property {libClient | undefined} sdk
|
|
821
1276
|
*/
|
|
822
1277
|
|
|
823
1278
|
/**
|
|
824
|
-
* @param {
|
|
1279
|
+
* @param {AccountUpdatePushTargetRequestParams} params
|
|
825
1280
|
*/
|
|
826
|
-
const
|
|
1281
|
+
const accountUpdatePushTarget = async ({ targetId, identifier, parseOutput = true, sdk = undefined}) => {
|
|
827
1282
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
828
|
-
|
|
829
|
-
let apiPath = '/account/sessions/phone';
|
|
1283
|
+
let apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
830
1284
|
let payload = {};
|
|
831
|
-
if (typeof
|
|
832
|
-
payload['
|
|
833
|
-
}
|
|
834
|
-
if (typeof phone !== 'undefined') {
|
|
835
|
-
payload['phone'] = phone;
|
|
1285
|
+
if (typeof identifier !== 'undefined') {
|
|
1286
|
+
payload['identifier'] = identifier;
|
|
836
1287
|
}
|
|
837
1288
|
|
|
838
|
-
|
|
839
1289
|
let response = undefined;
|
|
840
|
-
|
|
841
|
-
response = await client.call('
|
|
1290
|
+
|
|
1291
|
+
response = await client.call('put', apiPath, {
|
|
842
1292
|
'content-type': 'application/json',
|
|
843
1293
|
}, payload);
|
|
844
1294
|
|
|
845
|
-
|
|
846
1295
|
if (parseOutput) {
|
|
847
1296
|
parse(response)
|
|
848
1297
|
success()
|
|
@@ -852,36 +1301,26 @@ const accountCreatePhoneSession = async ({ userId, phone, parseOutput = true, sd
|
|
|
852
1301
|
}
|
|
853
1302
|
|
|
854
1303
|
/**
|
|
855
|
-
* @typedef {Object}
|
|
856
|
-
* @property {string}
|
|
857
|
-
* @property {string} secret Valid verification token.
|
|
1304
|
+
* @typedef {Object} AccountDeletePushTargetRequestParams
|
|
1305
|
+
* @property {string} targetId Target ID.
|
|
858
1306
|
* @property {boolean} parseOutput
|
|
859
1307
|
* @property {libClient | undefined} sdk
|
|
860
1308
|
*/
|
|
861
1309
|
|
|
862
1310
|
/**
|
|
863
|
-
* @param {
|
|
1311
|
+
* @param {AccountDeletePushTargetRequestParams} params
|
|
864
1312
|
*/
|
|
865
|
-
const
|
|
1313
|
+
const accountDeletePushTarget = async ({ targetId, parseOutput = true, sdk = undefined}) => {
|
|
866
1314
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
867
|
-
|
|
868
|
-
let apiPath = '/account/sessions/phone';
|
|
1315
|
+
let apiPath = '/account/targets/{targetId}/push'.replace('{targetId}', targetId);
|
|
869
1316
|
let payload = {};
|
|
870
|
-
if (typeof userId !== 'undefined') {
|
|
871
|
-
payload['userId'] = userId;
|
|
872
|
-
}
|
|
873
|
-
if (typeof secret !== 'undefined') {
|
|
874
|
-
payload['secret'] = secret;
|
|
875
|
-
}
|
|
876
|
-
|
|
877
1317
|
|
|
878
1318
|
let response = undefined;
|
|
879
|
-
|
|
880
|
-
response = await client.call('
|
|
1319
|
+
|
|
1320
|
+
response = await client.call('delete', apiPath, {
|
|
881
1321
|
'content-type': 'application/json',
|
|
882
1322
|
}, payload);
|
|
883
1323
|
|
|
884
|
-
|
|
885
1324
|
if (parseOutput) {
|
|
886
1325
|
parse(response)
|
|
887
1326
|
success()
|
|
@@ -891,29 +1330,37 @@ const accountUpdatePhoneSession = async ({ userId, secret, parseOutput = true, s
|
|
|
891
1330
|
}
|
|
892
1331
|
|
|
893
1332
|
/**
|
|
894
|
-
* @typedef {Object}
|
|
895
|
-
* @property {string}
|
|
1333
|
+
* @typedef {Object} AccountCreateEmailTokenRequestParams
|
|
1334
|
+
* @property {string} userId User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1335
|
+
* @property {string} email User email.
|
|
1336
|
+
* @property {boolean} phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
896
1337
|
* @property {boolean} parseOutput
|
|
897
1338
|
* @property {libClient | undefined} sdk
|
|
898
1339
|
*/
|
|
899
1340
|
|
|
900
1341
|
/**
|
|
901
|
-
* @param {
|
|
1342
|
+
* @param {AccountCreateEmailTokenRequestParams} params
|
|
902
1343
|
*/
|
|
903
|
-
const
|
|
1344
|
+
const accountCreateEmailToken = async ({ userId, email, phrase, parseOutput = true, sdk = undefined}) => {
|
|
904
1345
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
905
|
-
|
|
906
|
-
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1346
|
+
let apiPath = '/account/tokens/email';
|
|
907
1347
|
let payload = {};
|
|
908
|
-
|
|
1348
|
+
if (typeof userId !== 'undefined') {
|
|
1349
|
+
payload['userId'] = userId;
|
|
1350
|
+
}
|
|
1351
|
+
if (typeof email !== 'undefined') {
|
|
1352
|
+
payload['email'] = email;
|
|
1353
|
+
}
|
|
1354
|
+
if (typeof phrase !== 'undefined') {
|
|
1355
|
+
payload['phrase'] = phrase;
|
|
1356
|
+
}
|
|
909
1357
|
|
|
910
1358
|
let response = undefined;
|
|
911
|
-
|
|
912
|
-
response = await client.call('
|
|
1359
|
+
|
|
1360
|
+
response = await client.call('post', apiPath, {
|
|
913
1361
|
'content-type': 'application/json',
|
|
914
1362
|
}, payload);
|
|
915
1363
|
|
|
916
|
-
|
|
917
1364
|
if (parseOutput) {
|
|
918
1365
|
parse(response)
|
|
919
1366
|
success()
|
|
@@ -923,29 +1370,41 @@ const accountGetSession = async ({ sessionId, parseOutput = true, sdk = undefine
|
|
|
923
1370
|
}
|
|
924
1371
|
|
|
925
1372
|
/**
|
|
926
|
-
* @typedef {Object}
|
|
927
|
-
* @property {string}
|
|
1373
|
+
* @typedef {Object} AccountCreateMagicURLTokenRequestParams
|
|
1374
|
+
* @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1375
|
+
* @property {string} email User email.
|
|
1376
|
+
* @property {string} url URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1377
|
+
* @property {boolean} phrase Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
928
1378
|
* @property {boolean} parseOutput
|
|
929
1379
|
* @property {libClient | undefined} sdk
|
|
930
1380
|
*/
|
|
931
1381
|
|
|
932
1382
|
/**
|
|
933
|
-
* @param {
|
|
1383
|
+
* @param {AccountCreateMagicURLTokenRequestParams} params
|
|
934
1384
|
*/
|
|
935
|
-
const
|
|
1385
|
+
const accountCreateMagicURLToken = async ({ userId, email, url, phrase, parseOutput = true, sdk = undefined}) => {
|
|
936
1386
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
937
|
-
|
|
938
|
-
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1387
|
+
let apiPath = '/account/tokens/magic-url';
|
|
939
1388
|
let payload = {};
|
|
940
|
-
|
|
1389
|
+
if (typeof userId !== 'undefined') {
|
|
1390
|
+
payload['userId'] = userId;
|
|
1391
|
+
}
|
|
1392
|
+
if (typeof email !== 'undefined') {
|
|
1393
|
+
payload['email'] = email;
|
|
1394
|
+
}
|
|
1395
|
+
if (typeof url !== 'undefined') {
|
|
1396
|
+
payload['url'] = url;
|
|
1397
|
+
}
|
|
1398
|
+
if (typeof phrase !== 'undefined') {
|
|
1399
|
+
payload['phrase'] = phrase;
|
|
1400
|
+
}
|
|
941
1401
|
|
|
942
1402
|
let response = undefined;
|
|
943
|
-
|
|
944
|
-
response = await client.call('
|
|
1403
|
+
|
|
1404
|
+
response = await client.call('post', apiPath, {
|
|
945
1405
|
'content-type': 'application/json',
|
|
946
1406
|
}, payload);
|
|
947
1407
|
|
|
948
|
-
|
|
949
1408
|
if (parseOutput) {
|
|
950
1409
|
parse(response)
|
|
951
1410
|
success()
|
|
@@ -955,29 +1414,38 @@ const accountUpdateSession = async ({ sessionId, parseOutput = true, sdk = undef
|
|
|
955
1414
|
}
|
|
956
1415
|
|
|
957
1416
|
/**
|
|
958
|
-
* @typedef {Object}
|
|
959
|
-
* @property {
|
|
1417
|
+
* @typedef {Object} AccountCreateOAuth2TokenRequestParams
|
|
1418
|
+
* @property {OAuthProvider} provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
1419
|
+
* @property {string} success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1420
|
+
* @property {string} failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
1421
|
+
* @property {string[]} scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
960
1422
|
* @property {boolean} parseOutput
|
|
961
1423
|
* @property {libClient | undefined} sdk
|
|
962
1424
|
*/
|
|
963
1425
|
|
|
964
1426
|
/**
|
|
965
|
-
* @param {
|
|
1427
|
+
* @param {AccountCreateOAuth2TokenRequestParams} params
|
|
966
1428
|
*/
|
|
967
|
-
const
|
|
1429
|
+
const accountCreateOAuth2Token = async ({ provider, success, failure, scopes, parseOutput = true, sdk = undefined}) => {
|
|
968
1430
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
969
|
-
|
|
970
|
-
let apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId);
|
|
1431
|
+
let apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
|
|
971
1432
|
let payload = {};
|
|
972
|
-
|
|
1433
|
+
if (typeof success !== 'undefined') {
|
|
1434
|
+
payload['success'] = success;
|
|
1435
|
+
}
|
|
1436
|
+
if (typeof failure !== 'undefined') {
|
|
1437
|
+
payload['failure'] = failure;
|
|
1438
|
+
}
|
|
1439
|
+
if (typeof scopes !== 'undefined') {
|
|
1440
|
+
payload['scopes'] = scopes;
|
|
1441
|
+
}
|
|
973
1442
|
|
|
974
1443
|
let response = undefined;
|
|
975
|
-
|
|
976
|
-
response = await client.call('
|
|
1444
|
+
|
|
1445
|
+
response = await client.call('get', apiPath, {
|
|
977
1446
|
'content-type': 'application/json',
|
|
978
1447
|
}, payload);
|
|
979
1448
|
|
|
980
|
-
|
|
981
1449
|
if (parseOutput) {
|
|
982
1450
|
parse(response)
|
|
983
1451
|
success()
|
|
@@ -987,28 +1455,33 @@ const accountDeleteSession = async ({ sessionId, parseOutput = true, sdk = undef
|
|
|
987
1455
|
}
|
|
988
1456
|
|
|
989
1457
|
/**
|
|
990
|
-
* @typedef {Object}
|
|
1458
|
+
* @typedef {Object} AccountCreatePhoneTokenRequestParams
|
|
1459
|
+
* @property {string} userId Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
1460
|
+
* @property {string} phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
991
1461
|
* @property {boolean} parseOutput
|
|
992
1462
|
* @property {libClient | undefined} sdk
|
|
993
1463
|
*/
|
|
994
1464
|
|
|
995
1465
|
/**
|
|
996
|
-
* @param {
|
|
1466
|
+
* @param {AccountCreatePhoneTokenRequestParams} params
|
|
997
1467
|
*/
|
|
998
|
-
const
|
|
1468
|
+
const accountCreatePhoneToken = async ({ userId, phone, parseOutput = true, sdk = undefined}) => {
|
|
999
1469
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1000
|
-
|
|
1001
|
-
let apiPath = '/account/status';
|
|
1470
|
+
let apiPath = '/account/tokens/phone';
|
|
1002
1471
|
let payload = {};
|
|
1003
|
-
|
|
1472
|
+
if (typeof userId !== 'undefined') {
|
|
1473
|
+
payload['userId'] = userId;
|
|
1474
|
+
}
|
|
1475
|
+
if (typeof phone !== 'undefined') {
|
|
1476
|
+
payload['phone'] = phone;
|
|
1477
|
+
}
|
|
1004
1478
|
|
|
1005
1479
|
let response = undefined;
|
|
1006
|
-
|
|
1007
|
-
response = await client.call('
|
|
1480
|
+
|
|
1481
|
+
response = await client.call('post', apiPath, {
|
|
1008
1482
|
'content-type': 'application/json',
|
|
1009
1483
|
}, payload);
|
|
1010
1484
|
|
|
1011
|
-
|
|
1012
1485
|
if (parseOutput) {
|
|
1013
1486
|
parse(response)
|
|
1014
1487
|
success()
|
|
@@ -1029,21 +1502,18 @@ const accountUpdateStatus = async ({ parseOutput = true, sdk = undefined}) => {
|
|
|
1029
1502
|
*/
|
|
1030
1503
|
const accountCreateVerification = async ({ url, parseOutput = true, sdk = undefined}) => {
|
|
1031
1504
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1032
|
-
|
|
1033
1505
|
let apiPath = '/account/verification';
|
|
1034
1506
|
let payload = {};
|
|
1035
1507
|
if (typeof url !== 'undefined') {
|
|
1036
1508
|
payload['url'] = url;
|
|
1037
1509
|
}
|
|
1038
1510
|
|
|
1039
|
-
|
|
1040
1511
|
let response = undefined;
|
|
1041
|
-
|
|
1512
|
+
|
|
1042
1513
|
response = await client.call('post', apiPath, {
|
|
1043
1514
|
'content-type': 'application/json',
|
|
1044
1515
|
}, payload);
|
|
1045
1516
|
|
|
1046
|
-
|
|
1047
1517
|
if (parseOutput) {
|
|
1048
1518
|
parse(response)
|
|
1049
1519
|
success()
|
|
@@ -1065,7 +1535,6 @@ const accountCreateVerification = async ({ url, parseOutput = true, sdk = undefi
|
|
|
1065
1535
|
*/
|
|
1066
1536
|
const accountUpdateVerification = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
1067
1537
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1068
|
-
|
|
1069
1538
|
let apiPath = '/account/verification';
|
|
1070
1539
|
let payload = {};
|
|
1071
1540
|
if (typeof userId !== 'undefined') {
|
|
@@ -1075,14 +1544,12 @@ const accountUpdateVerification = async ({ userId, secret, parseOutput = true, s
|
|
|
1075
1544
|
payload['secret'] = secret;
|
|
1076
1545
|
}
|
|
1077
1546
|
|
|
1078
|
-
|
|
1079
1547
|
let response = undefined;
|
|
1080
|
-
|
|
1548
|
+
|
|
1081
1549
|
response = await client.call('put', apiPath, {
|
|
1082
1550
|
'content-type': 'application/json',
|
|
1083
1551
|
}, payload);
|
|
1084
1552
|
|
|
1085
|
-
|
|
1086
1553
|
if (parseOutput) {
|
|
1087
1554
|
parse(response)
|
|
1088
1555
|
success()
|
|
@@ -1102,18 +1569,15 @@ const accountUpdateVerification = async ({ userId, secret, parseOutput = true, s
|
|
|
1102
1569
|
*/
|
|
1103
1570
|
const accountCreatePhoneVerification = async ({ parseOutput = true, sdk = undefined}) => {
|
|
1104
1571
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1105
|
-
|
|
1106
1572
|
let apiPath = '/account/verification/phone';
|
|
1107
1573
|
let payload = {};
|
|
1108
1574
|
|
|
1109
|
-
|
|
1110
1575
|
let response = undefined;
|
|
1111
|
-
|
|
1576
|
+
|
|
1112
1577
|
response = await client.call('post', apiPath, {
|
|
1113
1578
|
'content-type': 'application/json',
|
|
1114
1579
|
}, payload);
|
|
1115
1580
|
|
|
1116
|
-
|
|
1117
1581
|
if (parseOutput) {
|
|
1118
1582
|
parse(response)
|
|
1119
1583
|
success()
|
|
@@ -1135,7 +1599,6 @@ const accountCreatePhoneVerification = async ({ parseOutput = true, sdk = undefi
|
|
|
1135
1599
|
*/
|
|
1136
1600
|
const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = true, sdk = undefined}) => {
|
|
1137
1601
|
let client = !sdk ? await sdkForProject() : sdk;
|
|
1138
|
-
|
|
1139
1602
|
let apiPath = '/account/verification/phone';
|
|
1140
1603
|
let payload = {};
|
|
1141
1604
|
if (typeof userId !== 'undefined') {
|
|
@@ -1145,14 +1608,12 @@ const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = tr
|
|
|
1145
1608
|
payload['secret'] = secret;
|
|
1146
1609
|
}
|
|
1147
1610
|
|
|
1148
|
-
|
|
1149
1611
|
let response = undefined;
|
|
1150
|
-
|
|
1612
|
+
|
|
1151
1613
|
response = await client.call('put', apiPath, {
|
|
1152
1614
|
'content-type': 'application/json',
|
|
1153
1615
|
}, payload);
|
|
1154
1616
|
|
|
1155
|
-
|
|
1156
1617
|
if (parseOutput) {
|
|
1157
1618
|
parse(response)
|
|
1158
1619
|
success()
|
|
@@ -1161,7 +1622,6 @@ const accountUpdatePhoneVerification = async ({ userId, secret, parseOutput = tr
|
|
|
1161
1622
|
return response;
|
|
1162
1623
|
}
|
|
1163
1624
|
|
|
1164
|
-
|
|
1165
1625
|
account
|
|
1166
1626
|
.command(`get`)
|
|
1167
1627
|
.description(`Get the currently logged in user.`)
|
|
@@ -1170,12 +1630,17 @@ account
|
|
|
1170
1630
|
account
|
|
1171
1631
|
.command(`create`)
|
|
1172
1632
|
.description(`Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).`)
|
|
1173
|
-
.requiredOption(`--userId <userId>`, `
|
|
1633
|
+
.requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1174
1634
|
.requiredOption(`--email <email>`, `User email.`)
|
|
1175
|
-
.requiredOption(`--password <password>`, `New user password. Must be
|
|
1635
|
+
.requiredOption(`--password <password>`, `New user password. Must be between 8 and 256 chars.`)
|
|
1176
1636
|
.option(`--name <name>`, `User name. Max length: 128 chars.`)
|
|
1177
1637
|
.action(actionRunner(accountCreate))
|
|
1178
1638
|
|
|
1639
|
+
account
|
|
1640
|
+
.command(`delete`)
|
|
1641
|
+
.description(`Delete the currently logged in user.`)
|
|
1642
|
+
.action(actionRunner(accountDelete))
|
|
1643
|
+
|
|
1179
1644
|
account
|
|
1180
1645
|
.command(`updateEmail`)
|
|
1181
1646
|
.description(`Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. `)
|
|
@@ -1186,7 +1651,7 @@ account
|
|
|
1186
1651
|
account
|
|
1187
1652
|
.command(`listIdentities`)
|
|
1188
1653
|
.description(`Get the list of identities for the currently logged in user.`)
|
|
1189
|
-
.option(`--queries
|
|
1654
|
+
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry`)
|
|
1190
1655
|
.action(actionRunner(accountListIdentities))
|
|
1191
1656
|
|
|
1192
1657
|
account
|
|
@@ -1206,6 +1671,65 @@ account
|
|
|
1206
1671
|
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
|
|
1207
1672
|
.action(actionRunner(accountListLogs))
|
|
1208
1673
|
|
|
1674
|
+
account
|
|
1675
|
+
.command(`updateMFA`)
|
|
1676
|
+
.description(`Enable or disable MFA on an account.`)
|
|
1677
|
+
.requiredOption(`--mfa <mfa>`, `Enable or disable MFA.`, parseBool)
|
|
1678
|
+
.action(actionRunner(accountUpdateMFA))
|
|
1679
|
+
|
|
1680
|
+
account
|
|
1681
|
+
.command(`createMfaAuthenticator`)
|
|
1682
|
+
.description(`Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator) method.`)
|
|
1683
|
+
.requiredOption(`--type <type>`, `Type of authenticator. Must be 'totp'`)
|
|
1684
|
+
.action(actionRunner(accountCreateMfaAuthenticator))
|
|
1685
|
+
|
|
1686
|
+
account
|
|
1687
|
+
.command(`updateMfaAuthenticator`)
|
|
1688
|
+
.description(`Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#addAuthenticator) method.`)
|
|
1689
|
+
.requiredOption(`--type <type>`, `Type of authenticator.`)
|
|
1690
|
+
.requiredOption(`--otp <otp>`, `Valid verification token.`)
|
|
1691
|
+
.action(actionRunner(accountUpdateMfaAuthenticator))
|
|
1692
|
+
|
|
1693
|
+
account
|
|
1694
|
+
.command(`deleteMfaAuthenticator`)
|
|
1695
|
+
.description(`Delete an authenticator for a user by ID.`)
|
|
1696
|
+
.requiredOption(`--type <type>`, `Type of authenticator.`)
|
|
1697
|
+
.requiredOption(`--otp <otp>`, `Valid verification token.`)
|
|
1698
|
+
.action(actionRunner(accountDeleteMfaAuthenticator))
|
|
1699
|
+
|
|
1700
|
+
account
|
|
1701
|
+
.command(`createMfaChallenge`)
|
|
1702
|
+
.description(`Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.`)
|
|
1703
|
+
.requiredOption(`--factor <factor>`, `Factor used for verification. Must be one of following: 'email', 'phone', 'totp', 'recoveryCode'.`)
|
|
1704
|
+
.action(actionRunner(accountCreateMfaChallenge))
|
|
1705
|
+
|
|
1706
|
+
account
|
|
1707
|
+
.command(`updateMfaChallenge`)
|
|
1708
|
+
.description(`Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`)
|
|
1709
|
+
.requiredOption(`--challengeId <challengeId>`, `ID of the challenge.`)
|
|
1710
|
+
.requiredOption(`--otp <otp>`, `Valid verification token.`)
|
|
1711
|
+
.action(actionRunner(accountUpdateMfaChallenge))
|
|
1712
|
+
|
|
1713
|
+
account
|
|
1714
|
+
.command(`listMfaFactors`)
|
|
1715
|
+
.description(`List the factors available on the account to be used as a MFA challange.`)
|
|
1716
|
+
.action(actionRunner(accountListMfaFactors))
|
|
1717
|
+
|
|
1718
|
+
account
|
|
1719
|
+
.command(`getMfaRecoveryCodes`)
|
|
1720
|
+
.description(`Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.`)
|
|
1721
|
+
.action(actionRunner(accountGetMfaRecoveryCodes))
|
|
1722
|
+
|
|
1723
|
+
account
|
|
1724
|
+
.command(`createMfaRecoveryCodes`)
|
|
1725
|
+
.description(`Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.`)
|
|
1726
|
+
.action(actionRunner(accountCreateMfaRecoveryCodes))
|
|
1727
|
+
|
|
1728
|
+
account
|
|
1729
|
+
.command(`updateMfaRecoveryCodes`)
|
|
1730
|
+
.description(`Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.`)
|
|
1731
|
+
.action(actionRunner(accountUpdateMfaRecoveryCodes))
|
|
1732
|
+
|
|
1209
1733
|
account
|
|
1210
1734
|
.command(`updateName`)
|
|
1211
1735
|
.description(`Update currently logged in user account name.`)
|
|
@@ -1249,8 +1773,7 @@ account
|
|
|
1249
1773
|
.description(`Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.`)
|
|
1250
1774
|
.requiredOption(`--userId <userId>`, `User ID.`)
|
|
1251
1775
|
.requiredOption(`--secret <secret>`, `Valid reset token.`)
|
|
1252
|
-
.requiredOption(`--password <password>`, `New user password. Must be
|
|
1253
|
-
.requiredOption(`--passwordAgain <passwordAgain>`, `Repeat new user password. Must be at least 8 chars.`)
|
|
1776
|
+
.requiredOption(`--password <password>`, `New user password. Must be between 8 and 256 chars.`)
|
|
1254
1777
|
.action(actionRunner(accountUpdateRecovery))
|
|
1255
1778
|
|
|
1256
1779
|
account
|
|
@@ -1269,50 +1792,42 @@ account
|
|
|
1269
1792
|
.action(actionRunner(accountCreateAnonymousSession))
|
|
1270
1793
|
|
|
1271
1794
|
account
|
|
1272
|
-
.command(`
|
|
1795
|
+
.command(`createEmailPasswordSession`)
|
|
1273
1796
|
.description(`Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
|
|
1274
1797
|
.requiredOption(`--email <email>`, `User email.`)
|
|
1275
1798
|
.requiredOption(`--password <password>`, `User password. Must be at least 8 chars.`)
|
|
1276
|
-
.action(actionRunner(
|
|
1277
|
-
|
|
1278
|
-
account
|
|
1279
|
-
.command(`createMagicURLSession`)
|
|
1280
|
-
.description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [PUT /account/sessions/magic-url](https://appwrite.io/docs/references/cloud/client-web/account#updateMagicURLSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
|
|
1281
|
-
.requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1282
|
-
.requiredOption(`--email <email>`, `User email.`)
|
|
1283
|
-
.option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1284
|
-
.action(actionRunner(accountCreateMagicURLSession))
|
|
1799
|
+
.action(actionRunner(accountCreateEmailPasswordSession))
|
|
1285
1800
|
|
|
1286
1801
|
account
|
|
1287
1802
|
.command(`updateMagicURLSession`)
|
|
1288
|
-
.description(`Use this endpoint to
|
|
1289
|
-
.requiredOption(`--userId <userId>`, `User ID.`)
|
|
1803
|
+
.description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1804
|
+
.requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1290
1805
|
.requiredOption(`--secret <secret>`, `Valid verification token.`)
|
|
1291
1806
|
.action(actionRunner(accountUpdateMagicURLSession))
|
|
1292
1807
|
|
|
1293
1808
|
account
|
|
1294
1809
|
.command(`createOAuth2Session`)
|
|
1295
1810
|
.description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
|
|
1296
|
-
.requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoom.`)
|
|
1811
|
+
.requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
|
|
1297
1812
|
.option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1298
1813
|
.option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1299
1814
|
.option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
|
|
1300
1815
|
.action(actionRunner(accountCreateOAuth2Session))
|
|
1301
1816
|
|
|
1302
|
-
account
|
|
1303
|
-
.command(`createPhoneSession`)
|
|
1304
|
-
.description(`Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [PUT /account/sessions/phone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
|
|
1305
|
-
.requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1306
|
-
.requiredOption(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
|
|
1307
|
-
.action(actionRunner(accountCreatePhoneSession))
|
|
1308
|
-
|
|
1309
1817
|
account
|
|
1310
1818
|
.command(`updatePhoneSession`)
|
|
1311
|
-
.description(`Use this endpoint to
|
|
1312
|
-
.requiredOption(`--userId <userId>`, `User ID.`)
|
|
1819
|
+
.description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1820
|
+
.requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1313
1821
|
.requiredOption(`--secret <secret>`, `Valid verification token.`)
|
|
1314
1822
|
.action(actionRunner(accountUpdatePhoneSession))
|
|
1315
1823
|
|
|
1824
|
+
account
|
|
1825
|
+
.command(`createSession`)
|
|
1826
|
+
.description(`Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1827
|
+
.requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1828
|
+
.requiredOption(`--secret <secret>`, `Secret of a token generated by login methods. For example, the 'createMagicURLToken' or 'createPhoneToken' methods.`)
|
|
1829
|
+
.action(actionRunner(accountCreateSession))
|
|
1830
|
+
|
|
1316
1831
|
account
|
|
1317
1832
|
.command(`getSession`)
|
|
1318
1833
|
.description(`Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.`)
|
|
@@ -1321,7 +1836,7 @@ account
|
|
|
1321
1836
|
|
|
1322
1837
|
account
|
|
1323
1838
|
.command(`updateSession`)
|
|
1324
|
-
.description(`
|
|
1839
|
+
.description(`Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.`)
|
|
1325
1840
|
.requiredOption(`--sessionId <sessionId>`, `Session ID. Use the string 'current' to update the current device session.`)
|
|
1326
1841
|
.action(actionRunner(accountUpdateSession))
|
|
1327
1842
|
|
|
@@ -1336,6 +1851,60 @@ account
|
|
|
1336
1851
|
.description(`Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.`)
|
|
1337
1852
|
.action(actionRunner(accountUpdateStatus))
|
|
1338
1853
|
|
|
1854
|
+
account
|
|
1855
|
+
.command(`createPushTarget`)
|
|
1856
|
+
.description(``)
|
|
1857
|
+
.requiredOption(`--targetId <targetId>`, `Target ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1858
|
+
.requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
|
|
1859
|
+
.option(`--providerId <providerId>`, `Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used.`)
|
|
1860
|
+
.action(actionRunner(accountCreatePushTarget))
|
|
1861
|
+
|
|
1862
|
+
account
|
|
1863
|
+
.command(`updatePushTarget`)
|
|
1864
|
+
.description(``)
|
|
1865
|
+
.requiredOption(`--targetId <targetId>`, `Target ID.`)
|
|
1866
|
+
.requiredOption(`--identifier <identifier>`, `The target identifier (token, email, phone etc.)`)
|
|
1867
|
+
.action(actionRunner(accountUpdatePushTarget))
|
|
1868
|
+
|
|
1869
|
+
account
|
|
1870
|
+
.command(`deletePushTarget`)
|
|
1871
|
+
.description(``)
|
|
1872
|
+
.requiredOption(`--targetId <targetId>`, `Target ID.`)
|
|
1873
|
+
.action(actionRunner(accountDeletePushTarget))
|
|
1874
|
+
|
|
1875
|
+
account
|
|
1876
|
+
.command(`createEmailToken`)
|
|
1877
|
+
.description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
|
|
1878
|
+
.requiredOption(`--userId <userId>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1879
|
+
.requiredOption(`--email <email>`, `User email.`)
|
|
1880
|
+
.option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
|
|
1881
|
+
.action(actionRunner(accountCreateEmailToken))
|
|
1882
|
+
|
|
1883
|
+
account
|
|
1884
|
+
.command(`createMagicURLToken`)
|
|
1885
|
+
.description(`Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). `)
|
|
1886
|
+
.requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1887
|
+
.requiredOption(`--email <email>`, `User email.`)
|
|
1888
|
+
.option(`--url <url>`, `URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1889
|
+
.option(`--phrase <phrase>`, `Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.`, parseBool)
|
|
1890
|
+
.action(actionRunner(accountCreateMagicURLToken))
|
|
1891
|
+
|
|
1892
|
+
account
|
|
1893
|
+
.command(`createOAuth2Token`)
|
|
1894
|
+
.description(`Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. If authentication succeeds, 'userId' and 'secret' of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
|
|
1895
|
+
.requiredOption(`--provider <provider>`, `OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.`)
|
|
1896
|
+
.option(`--success <success>`, `URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1897
|
+
.option(`--failure <failure>`, `URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.`)
|
|
1898
|
+
.option(`--scopes [scopes...]`, `A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.`)
|
|
1899
|
+
.action(actionRunner(accountCreateOAuth2Token))
|
|
1900
|
+
|
|
1901
|
+
account
|
|
1902
|
+
.command(`createPhoneToken`)
|
|
1903
|
+
.description(`Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).`)
|
|
1904
|
+
.requiredOption(`--userId <userId>`, `Unique Id. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1905
|
+
.requiredOption(`--phone <phone>`, `Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.`)
|
|
1906
|
+
.action(actionRunner(accountCreatePhoneToken))
|
|
1907
|
+
|
|
1339
1908
|
account
|
|
1340
1909
|
.command(`createVerification`)
|
|
1341
1910
|
.description(`Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. `)
|
|
@@ -1361,38 +1930,54 @@ account
|
|
|
1361
1930
|
.requiredOption(`--secret <secret>`, `Valid verification token.`)
|
|
1362
1931
|
.action(actionRunner(accountUpdatePhoneVerification))
|
|
1363
1932
|
|
|
1364
|
-
|
|
1365
1933
|
module.exports = {
|
|
1366
1934
|
account,
|
|
1367
|
-
accountGet,
|
|
1368
|
-
accountCreate,
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1935
|
+
accountGet,
|
|
1936
|
+
accountCreate,
|
|
1937
|
+
accountDelete,
|
|
1938
|
+
accountUpdateEmail,
|
|
1939
|
+
accountListIdentities,
|
|
1940
|
+
accountDeleteIdentity,
|
|
1941
|
+
accountCreateJWT,
|
|
1942
|
+
accountListLogs,
|
|
1943
|
+
accountUpdateMFA,
|
|
1944
|
+
accountCreateMfaAuthenticator,
|
|
1945
|
+
accountUpdateMfaAuthenticator,
|
|
1946
|
+
accountDeleteMfaAuthenticator,
|
|
1947
|
+
accountCreateMfaChallenge,
|
|
1948
|
+
accountUpdateMfaChallenge,
|
|
1949
|
+
accountListMfaFactors,
|
|
1950
|
+
accountGetMfaRecoveryCodes,
|
|
1951
|
+
accountCreateMfaRecoveryCodes,
|
|
1952
|
+
accountUpdateMfaRecoveryCodes,
|
|
1953
|
+
accountUpdateName,
|
|
1954
|
+
accountUpdatePassword,
|
|
1955
|
+
accountUpdatePhone,
|
|
1956
|
+
accountGetPrefs,
|
|
1957
|
+
accountUpdatePrefs,
|
|
1958
|
+
accountCreateRecovery,
|
|
1959
|
+
accountUpdateRecovery,
|
|
1960
|
+
accountListSessions,
|
|
1961
|
+
accountDeleteSessions,
|
|
1962
|
+
accountCreateAnonymousSession,
|
|
1963
|
+
accountCreateEmailPasswordSession,
|
|
1964
|
+
accountUpdateMagicURLSession,
|
|
1965
|
+
accountCreateOAuth2Session,
|
|
1966
|
+
accountUpdatePhoneSession,
|
|
1967
|
+
accountCreateSession,
|
|
1968
|
+
accountGetSession,
|
|
1969
|
+
accountUpdateSession,
|
|
1970
|
+
accountDeleteSession,
|
|
1971
|
+
accountUpdateStatus,
|
|
1972
|
+
accountCreatePushTarget,
|
|
1973
|
+
accountUpdatePushTarget,
|
|
1974
|
+
accountDeletePushTarget,
|
|
1975
|
+
accountCreateEmailToken,
|
|
1976
|
+
accountCreateMagicURLToken,
|
|
1977
|
+
accountCreateOAuth2Token,
|
|
1978
|
+
accountCreatePhoneToken,
|
|
1979
|
+
accountCreateVerification,
|
|
1980
|
+
accountUpdateVerification,
|
|
1981
|
+
accountCreatePhoneVerification,
|
|
1982
|
+
accountUpdatePhoneVerification
|
|
1398
1983
|
};
|