react-native-appwrite 0.10.1 → 0.12.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/CHANGELOG.md +7 -1
- package/README.md +84 -3
- package/dist/cjs/sdk.js +1810 -1113
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +1810 -1114
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-password-session.md +4 -4
- package/docs/examples/account/create-email-token.md +5 -5
- package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
- package/docs/examples/account/create-mfa-authenticator.md +3 -3
- package/docs/examples/account/create-mfa-challenge.md +3 -3
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
- package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
- package/docs/examples/account/create-phone-token.md +4 -4
- package/docs/examples/account/create-push-target.md +5 -5
- package/docs/examples/account/create-recovery.md +4 -4
- package/docs/examples/account/create-session.md +4 -4
- package/docs/examples/account/create-verification.md +3 -3
- package/docs/examples/account/create.md +6 -6
- package/docs/examples/account/delete-identity.md +3 -3
- package/docs/examples/account/delete-mfa-authenticator.md +3 -3
- package/docs/examples/account/delete-push-target.md +3 -3
- package/docs/examples/account/delete-session.md +3 -3
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-session.md +3 -3
- package/docs/examples/account/list-identities.md +3 -3
- package/docs/examples/account/list-logs.md +3 -3
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/update-email.md +4 -4
- package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
- package/docs/examples/account/update-mfa-authenticator.md +4 -4
- package/docs/examples/account/update-mfa-challenge.md +4 -4
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
- package/docs/examples/account/update-name.md +3 -3
- package/docs/examples/account/update-password.md +4 -4
- package/docs/examples/account/update-phone-session.md +4 -4
- package/docs/examples/account/update-phone-verification.md +4 -4
- package/docs/examples/account/update-phone.md +4 -4
- package/docs/examples/account/update-prefs.md +3 -3
- package/docs/examples/account/update-push-target.md +4 -4
- package/docs/examples/account/update-recovery.md +5 -5
- package/docs/examples/account/update-session.md +3 -3
- package/docs/examples/account/update-verification.md +4 -4
- package/docs/examples/avatars/get-browser.md +6 -6
- package/docs/examples/avatars/get-credit-card.md +6 -6
- package/docs/examples/avatars/get-favicon.md +3 -3
- package/docs/examples/avatars/get-flag.md +6 -6
- package/docs/examples/avatars/get-image.md +5 -5
- package/docs/examples/avatars/get-initials.md +6 -6
- package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
- package/docs/examples/databases/create-document.md +8 -10
- package/docs/examples/databases/decrement-document-attribute.md +18 -0
- package/docs/examples/databases/delete-document.md +5 -5
- package/docs/examples/databases/get-document.md +6 -6
- package/docs/examples/databases/increment-document-attribute.md +18 -0
- package/docs/examples/databases/list-documents.md +5 -5
- package/docs/examples/databases/update-document.md +7 -7
- package/docs/examples/databases/upsert-document.md +7 -7
- package/docs/examples/functions/create-execution.md +9 -9
- package/docs/examples/functions/get-execution.md +4 -4
- package/docs/examples/functions/list-executions.md +4 -4
- package/docs/examples/graphql/mutation.md +3 -3
- package/docs/examples/graphql/query.md +3 -3
- package/docs/examples/messaging/create-subscriber.md +5 -5
- package/docs/examples/messaging/delete-subscriber.md +4 -4
- package/docs/examples/storage/create-file.md +6 -6
- package/docs/examples/storage/delete-file.md +4 -4
- package/docs/examples/storage/get-file-download.md +5 -5
- package/docs/examples/storage/get-file-preview.md +16 -16
- package/docs/examples/storage/get-file-view.md +5 -5
- package/docs/examples/storage/get-file.md +4 -4
- package/docs/examples/storage/list-files.md +5 -5
- package/docs/examples/storage/update-file.md +6 -6
- package/docs/examples/tablesdb/create-row.md +17 -0
- package/docs/examples/tablesdb/decrement-row-column.md +18 -0
- package/docs/examples/tablesdb/delete-row.md +15 -0
- package/docs/examples/tablesdb/get-row.md +16 -0
- package/docs/examples/tablesdb/increment-row-column.md +18 -0
- package/docs/examples/tablesdb/list-rows.md +15 -0
- package/docs/examples/tablesdb/update-row.md +17 -0
- package/docs/examples/tablesdb/upsert-row.md +17 -0
- package/docs/examples/teams/create-membership.md +9 -9
- package/docs/examples/teams/create.md +5 -5
- package/docs/examples/teams/delete-membership.md +4 -4
- package/docs/examples/teams/delete.md +3 -3
- package/docs/examples/teams/get-membership.md +4 -4
- package/docs/examples/teams/get-prefs.md +3 -3
- package/docs/examples/teams/get.md +3 -3
- package/docs/examples/teams/list-memberships.md +5 -5
- package/docs/examples/teams/list.md +4 -4
- package/docs/examples/teams/update-membership-status.md +6 -6
- package/docs/examples/teams/update-membership.md +5 -5
- package/docs/examples/teams/update-name.md +4 -4
- package/docs/examples/teams/update-prefs.md +4 -4
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/index.ts +1 -0
- package/src/models.ts +139 -21
- package/src/query.ts +95 -0
- package/src/services/account.ts +1518 -364
- package/src/services/avatars.ts +296 -87
- package/src/services/databases.ts +438 -55
- package/src/services/functions.ts +118 -23
- package/src/services/graphql.ts +54 -6
- package/src/services/locale.ts +16 -27
- package/src/services/messaging.ts +68 -9
- package/src/services/storage.ts +353 -84
- package/src/services/tables-db.ts +621 -0
- package/src/services/teams.ts +467 -106
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +127 -62
- package/types/query.d.ts +77 -0
- package/types/services/account.d.ts +791 -337
- package/types/services/avatars.d.ts +175 -80
- package/types/services/databases.d.ts +220 -53
- package/types/services/functions.d.ts +65 -20
- package/types/services/graphql.d.ts +26 -4
- package/types/services/locale.d.ts +16 -27
- package/types/services/messaging.d.ts +35 -7
- package/types/services/storage.d.ts +209 -76
- package/types/services/tables-db.d.ts +245 -0
- package/types/services/teams.d.ts +261 -99
- /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
- /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
package/src/services/account.ts
CHANGED
|
@@ -21,8 +21,8 @@ export class Account extends Service {
|
|
|
21
21
|
*
|
|
22
22
|
* @throws {AppwriteException}
|
|
23
23
|
* @returns {Promise}
|
|
24
|
-
|
|
25
|
-
get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
24
|
+
*/
|
|
25
|
+
get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
26
26
|
const apiPath = '/account';
|
|
27
27
|
const payload: Payload = {};
|
|
28
28
|
|
|
@@ -32,22 +32,50 @@ export class Account extends Service {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Use this endpoint to allow a new user to register a new account in your
|
|
36
|
-
* project. After the user registration completes successfully, you can use
|
|
37
|
-
* the
|
|
38
|
-
* [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
|
|
39
|
-
* route to start verifying the user email address. To allow the new user to
|
|
40
|
-
* login to their new account, you need to create a new [account
|
|
41
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
35
|
+
* 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).
|
|
42
36
|
*
|
|
43
|
-
* @param {string} userId
|
|
44
|
-
* @param {string} email
|
|
45
|
-
* @param {string} password
|
|
46
|
-
* @param {string} name
|
|
37
|
+
* @param {string} params.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.
|
|
38
|
+
* @param {string} params.email - User email.
|
|
39
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
40
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
47
41
|
* @throws {AppwriteException}
|
|
48
42
|
* @returns {Promise}
|
|
49
|
-
|
|
50
|
-
create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences
|
|
43
|
+
*/
|
|
44
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>;
|
|
45
|
+
/**
|
|
46
|
+
* 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).
|
|
47
|
+
*
|
|
48
|
+
* @param {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.
|
|
49
|
+
* @param {string} email - User email.
|
|
50
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
51
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
52
|
+
* @throws {AppwriteException}
|
|
53
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
54
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
55
|
+
*/
|
|
56
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
|
|
57
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
58
|
+
paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string,
|
|
59
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
60
|
+
): Promise<Models.User<Preferences>> {
|
|
61
|
+
let params: { userId: string, email: string, password: string, name?: string };
|
|
62
|
+
|
|
63
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
64
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string };
|
|
65
|
+
} else {
|
|
66
|
+
params = {
|
|
67
|
+
userId: paramsOrFirst as string,
|
|
68
|
+
email: rest[0] as string,
|
|
69
|
+
password: rest[1] as string,
|
|
70
|
+
name: rest[2] as string
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const userId = params.userId;
|
|
75
|
+
const email = params.email;
|
|
76
|
+
const password = params.password;
|
|
77
|
+
const name = params.name;
|
|
78
|
+
|
|
51
79
|
if (typeof userId === 'undefined') {
|
|
52
80
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
53
81
|
}
|
|
@@ -86,21 +114,46 @@ export class Account extends Service {
|
|
|
86
114
|
}
|
|
87
115
|
|
|
88
116
|
/**
|
|
89
|
-
* Update currently logged in user account email address. After changing user
|
|
90
|
-
*
|
|
91
|
-
* email is not sent automatically however you can use the send confirmation
|
|
92
|
-
* email endpoint again to send the confirmation email. For security measures,
|
|
93
|
-
* user password is required to complete this request.
|
|
94
|
-
* This endpoint can also be used to convert an anonymous account to a normal
|
|
95
|
-
* one, by passing an email address and a new password.
|
|
117
|
+
* 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.
|
|
118
|
+
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
96
119
|
*
|
|
97
120
|
*
|
|
98
|
-
* @param {string} email
|
|
99
|
-
* @param {string} password
|
|
121
|
+
* @param {string} params.email - User email.
|
|
122
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
100
123
|
* @throws {AppwriteException}
|
|
101
124
|
* @returns {Promise}
|
|
102
|
-
|
|
103
|
-
updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences
|
|
125
|
+
*/
|
|
126
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { email: string, password: string }): Promise<Models.User<Preferences>>;
|
|
127
|
+
/**
|
|
128
|
+
* 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.
|
|
129
|
+
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
130
|
+
*
|
|
131
|
+
*
|
|
132
|
+
* @param {string} email - User email.
|
|
133
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
134
|
+
* @throws {AppwriteException}
|
|
135
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
136
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
137
|
+
*/
|
|
138
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>;
|
|
139
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
140
|
+
paramsOrFirst: { email: string, password: string } | string,
|
|
141
|
+
...rest: [(string)?]
|
|
142
|
+
): Promise<Models.User<Preferences>> {
|
|
143
|
+
let params: { email: string, password: string };
|
|
144
|
+
|
|
145
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
146
|
+
params = (paramsOrFirst || {}) as { email: string, password: string };
|
|
147
|
+
} else {
|
|
148
|
+
params = {
|
|
149
|
+
email: paramsOrFirst as string,
|
|
150
|
+
password: rest[0] as string
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const email = params.email;
|
|
155
|
+
const password = params.password;
|
|
156
|
+
|
|
104
157
|
if (typeof email === 'undefined') {
|
|
105
158
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
106
159
|
}
|
|
@@ -129,11 +182,35 @@ export class Account extends Service {
|
|
|
129
182
|
/**
|
|
130
183
|
* Get the list of identities for the currently logged in user.
|
|
131
184
|
*
|
|
132
|
-
* @param {string[]} queries
|
|
185
|
+
* @param {string[]} params.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
|
|
133
186
|
* @throws {AppwriteException}
|
|
134
187
|
* @returns {Promise}
|
|
135
|
-
|
|
136
|
-
listIdentities(queries?: string[]): Promise<Models.IdentityList
|
|
188
|
+
*/
|
|
189
|
+
listIdentities(params?: { queries?: string[] }): Promise<Models.IdentityList>;
|
|
190
|
+
/**
|
|
191
|
+
* Get the list of identities for the currently logged in user.
|
|
192
|
+
*
|
|
193
|
+
* @param {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
|
|
194
|
+
* @throws {AppwriteException}
|
|
195
|
+
* @returns {Promise<Models.IdentityList>}
|
|
196
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
197
|
+
*/
|
|
198
|
+
listIdentities(queries?: string[]): Promise<Models.IdentityList>;
|
|
199
|
+
listIdentities(
|
|
200
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
201
|
+
): Promise<Models.IdentityList> {
|
|
202
|
+
let params: { queries?: string[] };
|
|
203
|
+
|
|
204
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
205
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
206
|
+
} else {
|
|
207
|
+
params = {
|
|
208
|
+
queries: paramsOrFirst as string[]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const queries = params.queries;
|
|
213
|
+
|
|
137
214
|
const apiPath = '/account/identities';
|
|
138
215
|
const payload: Payload = {};
|
|
139
216
|
|
|
@@ -149,11 +226,35 @@ export class Account extends Service {
|
|
|
149
226
|
/**
|
|
150
227
|
* Delete an identity by its unique ID.
|
|
151
228
|
*
|
|
152
|
-
* @param {string} identityId
|
|
229
|
+
* @param {string} params.identityId - Identity ID.
|
|
153
230
|
* @throws {AppwriteException}
|
|
154
231
|
* @returns {Promise}
|
|
155
|
-
|
|
156
|
-
deleteIdentity(identityId: string): Promise<{}
|
|
232
|
+
*/
|
|
233
|
+
deleteIdentity(params: { identityId: string }): Promise<{}>;
|
|
234
|
+
/**
|
|
235
|
+
* Delete an identity by its unique ID.
|
|
236
|
+
*
|
|
237
|
+
* @param {string} identityId - Identity ID.
|
|
238
|
+
* @throws {AppwriteException}
|
|
239
|
+
* @returns {Promise<{}>}
|
|
240
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
241
|
+
*/
|
|
242
|
+
deleteIdentity(identityId: string): Promise<{}>;
|
|
243
|
+
deleteIdentity(
|
|
244
|
+
paramsOrFirst: { identityId: string } | string
|
|
245
|
+
): Promise<{}> {
|
|
246
|
+
let params: { identityId: string };
|
|
247
|
+
|
|
248
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
249
|
+
params = (paramsOrFirst || {}) as { identityId: string };
|
|
250
|
+
} else {
|
|
251
|
+
params = {
|
|
252
|
+
identityId: paramsOrFirst as string
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const identityId = params.identityId;
|
|
257
|
+
|
|
157
258
|
if (typeof identityId === 'undefined') {
|
|
158
259
|
throw new AppwriteException('Missing required parameter: "identityId"');
|
|
159
260
|
}
|
|
@@ -168,15 +269,11 @@ export class Account extends Service {
|
|
|
168
269
|
}
|
|
169
270
|
|
|
170
271
|
/**
|
|
171
|
-
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT
|
|
172
|
-
* to authenticate on behalf of the current user when working with the
|
|
173
|
-
* Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
|
|
174
|
-
* from its creation and will be invalid if the user will logout in that time
|
|
175
|
-
* frame.
|
|
272
|
+
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
176
273
|
*
|
|
177
274
|
* @throws {AppwriteException}
|
|
178
275
|
* @returns {Promise}
|
|
179
|
-
|
|
276
|
+
*/
|
|
180
277
|
createJWT(): Promise<Models.Jwt> {
|
|
181
278
|
const apiPath = '/account/jwts';
|
|
182
279
|
const payload: Payload = {};
|
|
@@ -188,14 +285,37 @@ export class Account extends Service {
|
|
|
188
285
|
}
|
|
189
286
|
|
|
190
287
|
/**
|
|
191
|
-
* Get the list of latest security activity logs for the currently logged in
|
|
192
|
-
* user. Each log returns user IP address, location and date and time of log.
|
|
288
|
+
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
193
289
|
*
|
|
194
|
-
* @param {string[]} queries
|
|
290
|
+
* @param {string[]} params.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
|
|
195
291
|
* @throws {AppwriteException}
|
|
196
292
|
* @returns {Promise}
|
|
197
|
-
|
|
198
|
-
listLogs(queries?: string[]): Promise<Models.LogList
|
|
293
|
+
*/
|
|
294
|
+
listLogs(params?: { queries?: string[] }): Promise<Models.LogList>;
|
|
295
|
+
/**
|
|
296
|
+
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
297
|
+
*
|
|
298
|
+
* @param {string[]} 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
|
|
299
|
+
* @throws {AppwriteException}
|
|
300
|
+
* @returns {Promise<Models.LogList>}
|
|
301
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
302
|
+
*/
|
|
303
|
+
listLogs(queries?: string[]): Promise<Models.LogList>;
|
|
304
|
+
listLogs(
|
|
305
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
306
|
+
): Promise<Models.LogList> {
|
|
307
|
+
let params: { queries?: string[] };
|
|
308
|
+
|
|
309
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
310
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
311
|
+
} else {
|
|
312
|
+
params = {
|
|
313
|
+
queries: paramsOrFirst as string[]
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const queries = params.queries;
|
|
318
|
+
|
|
199
319
|
const apiPath = '/account/logs';
|
|
200
320
|
const payload: Payload = {};
|
|
201
321
|
|
|
@@ -211,11 +331,35 @@ export class Account extends Service {
|
|
|
211
331
|
/**
|
|
212
332
|
* Enable or disable MFA on an account.
|
|
213
333
|
*
|
|
214
|
-
* @param {boolean} mfa
|
|
334
|
+
* @param {boolean} params.mfa - Enable or disable MFA.
|
|
215
335
|
* @throws {AppwriteException}
|
|
216
336
|
* @returns {Promise}
|
|
217
|
-
|
|
218
|
-
updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences
|
|
337
|
+
*/
|
|
338
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { mfa: boolean }): Promise<Models.User<Preferences>>;
|
|
339
|
+
/**
|
|
340
|
+
* Enable or disable MFA on an account.
|
|
341
|
+
*
|
|
342
|
+
* @param {boolean} mfa - Enable or disable MFA.
|
|
343
|
+
* @throws {AppwriteException}
|
|
344
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
345
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
346
|
+
*/
|
|
347
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>;
|
|
348
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
349
|
+
paramsOrFirst: { mfa: boolean } | boolean
|
|
350
|
+
): Promise<Models.User<Preferences>> {
|
|
351
|
+
let params: { mfa: boolean };
|
|
352
|
+
|
|
353
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
354
|
+
params = (paramsOrFirst || {}) as { mfa: boolean };
|
|
355
|
+
} else {
|
|
356
|
+
params = {
|
|
357
|
+
mfa: paramsOrFirst as boolean
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const mfa = params.mfa;
|
|
362
|
+
|
|
219
363
|
if (typeof mfa === 'undefined') {
|
|
220
364
|
throw new AppwriteException('Missing required parameter: "mfa"');
|
|
221
365
|
}
|
|
@@ -234,16 +378,38 @@ export class Account extends Service {
|
|
|
234
378
|
}
|
|
235
379
|
|
|
236
380
|
/**
|
|
237
|
-
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
238
|
-
* authenticator using the [verify
|
|
239
|
-
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
|
240
|
-
* method.
|
|
381
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
241
382
|
*
|
|
242
|
-
* @param {AuthenticatorType} type
|
|
383
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
243
384
|
* @throws {AppwriteException}
|
|
244
385
|
* @returns {Promise}
|
|
245
|
-
|
|
246
|
-
|
|
386
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.
|
|
387
|
+
*/
|
|
388
|
+
createMfaAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
|
|
389
|
+
/**
|
|
390
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
391
|
+
*
|
|
392
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
393
|
+
* @throws {AppwriteException}
|
|
394
|
+
* @returns {Promise<Models.MfaType>}
|
|
395
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
396
|
+
*/
|
|
397
|
+
createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
398
|
+
createMfaAuthenticator(
|
|
399
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
400
|
+
): Promise<Models.MfaType> {
|
|
401
|
+
let params: { type: AuthenticatorType };
|
|
402
|
+
|
|
403
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
404
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
405
|
+
} else {
|
|
406
|
+
params = {
|
|
407
|
+
type: paramsOrFirst as AuthenticatorType
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const type = params.type;
|
|
412
|
+
|
|
247
413
|
if (typeof type === 'undefined') {
|
|
248
414
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
249
415
|
}
|
|
@@ -258,16 +424,146 @@ export class Account extends Service {
|
|
|
258
424
|
}
|
|
259
425
|
|
|
260
426
|
/**
|
|
261
|
-
*
|
|
262
|
-
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
263
|
-
* method.
|
|
427
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
264
428
|
*
|
|
265
|
-
* @param {AuthenticatorType} type
|
|
266
|
-
* @param {string} otp
|
|
429
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
267
430
|
* @throws {AppwriteException}
|
|
268
431
|
* @returns {Promise}
|
|
269
|
-
|
|
270
|
-
|
|
432
|
+
*/
|
|
433
|
+
createMFAAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>;
|
|
434
|
+
/**
|
|
435
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
436
|
+
*
|
|
437
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
438
|
+
* @throws {AppwriteException}
|
|
439
|
+
* @returns {Promise<Models.MfaType>}
|
|
440
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
441
|
+
*/
|
|
442
|
+
createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
443
|
+
createMFAAuthenticator(
|
|
444
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
445
|
+
): Promise<Models.MfaType> {
|
|
446
|
+
let params: { type: AuthenticatorType };
|
|
447
|
+
|
|
448
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
449
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
450
|
+
} else {
|
|
451
|
+
params = {
|
|
452
|
+
type: paramsOrFirst as AuthenticatorType
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
const type = params.type;
|
|
457
|
+
|
|
458
|
+
if (typeof type === 'undefined') {
|
|
459
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
463
|
+
const payload: Payload = {};
|
|
464
|
+
|
|
465
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
466
|
+
return this.client.call('post', uri, {
|
|
467
|
+
'content-type': 'application/json',
|
|
468
|
+
}, payload);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
473
|
+
*
|
|
474
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
475
|
+
* @param {string} params.otp - Valid verification token.
|
|
476
|
+
* @throws {AppwriteException}
|
|
477
|
+
* @returns {Promise}
|
|
478
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.
|
|
479
|
+
*/
|
|
480
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
|
|
481
|
+
/**
|
|
482
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
483
|
+
*
|
|
484
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
485
|
+
* @param {string} otp - Valid verification token.
|
|
486
|
+
* @throws {AppwriteException}
|
|
487
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
488
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
489
|
+
*/
|
|
490
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
491
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
492
|
+
paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
|
|
493
|
+
...rest: [(string)?]
|
|
494
|
+
): Promise<Models.User<Preferences>> {
|
|
495
|
+
let params: { type: AuthenticatorType, otp: string };
|
|
496
|
+
|
|
497
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
498
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
|
|
499
|
+
} else {
|
|
500
|
+
params = {
|
|
501
|
+
type: paramsOrFirst as AuthenticatorType,
|
|
502
|
+
otp: rest[0] as string
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
const type = params.type;
|
|
507
|
+
const otp = params.otp;
|
|
508
|
+
|
|
509
|
+
if (typeof type === 'undefined') {
|
|
510
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
if (typeof otp === 'undefined') {
|
|
514
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
518
|
+
const payload: Payload = {};
|
|
519
|
+
|
|
520
|
+
if (typeof otp !== 'undefined') {
|
|
521
|
+
payload['otp'] = otp;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
525
|
+
return this.client.call('put', uri, {
|
|
526
|
+
'content-type': 'application/json',
|
|
527
|
+
}, payload);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
532
|
+
*
|
|
533
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
534
|
+
* @param {string} params.otp - Valid verification token.
|
|
535
|
+
* @throws {AppwriteException}
|
|
536
|
+
* @returns {Promise}
|
|
537
|
+
*/
|
|
538
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>;
|
|
539
|
+
/**
|
|
540
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
541
|
+
*
|
|
542
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
543
|
+
* @param {string} otp - Valid verification token.
|
|
544
|
+
* @throws {AppwriteException}
|
|
545
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
546
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
547
|
+
*/
|
|
548
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
549
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
550
|
+
paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType,
|
|
551
|
+
...rest: [(string)?]
|
|
552
|
+
): Promise<Models.User<Preferences>> {
|
|
553
|
+
let params: { type: AuthenticatorType, otp: string };
|
|
554
|
+
|
|
555
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
556
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string };
|
|
557
|
+
} else {
|
|
558
|
+
params = {
|
|
559
|
+
type: paramsOrFirst as AuthenticatorType,
|
|
560
|
+
otp: rest[0] as string
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const type = params.type;
|
|
565
|
+
const otp = params.otp;
|
|
566
|
+
|
|
271
567
|
if (typeof type === 'undefined') {
|
|
272
568
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
273
569
|
}
|
|
@@ -292,11 +588,36 @@ export class Account extends Service {
|
|
|
292
588
|
/**
|
|
293
589
|
* Delete an authenticator for a user by ID.
|
|
294
590
|
*
|
|
295
|
-
* @param {AuthenticatorType} type
|
|
591
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
296
592
|
* @throws {AppwriteException}
|
|
297
593
|
* @returns {Promise}
|
|
298
|
-
|
|
299
|
-
|
|
594
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.
|
|
595
|
+
*/
|
|
596
|
+
deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
|
|
597
|
+
/**
|
|
598
|
+
* Delete an authenticator for a user by ID.
|
|
599
|
+
*
|
|
600
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
601
|
+
* @throws {AppwriteException}
|
|
602
|
+
* @returns {Promise<{}>}
|
|
603
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
604
|
+
*/
|
|
605
|
+
deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
606
|
+
deleteMfaAuthenticator(
|
|
607
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
608
|
+
): Promise<{}> {
|
|
609
|
+
let params: { type: AuthenticatorType };
|
|
610
|
+
|
|
611
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
612
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
613
|
+
} else {
|
|
614
|
+
params = {
|
|
615
|
+
type: paramsOrFirst as AuthenticatorType
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
const type = params.type;
|
|
620
|
+
|
|
300
621
|
if (typeof type === 'undefined') {
|
|
301
622
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
302
623
|
}
|
|
@@ -311,15 +632,132 @@ export class Account extends Service {
|
|
|
311
632
|
}
|
|
312
633
|
|
|
313
634
|
/**
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
635
|
+
* Delete an authenticator for a user by ID.
|
|
636
|
+
*
|
|
637
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
638
|
+
* @throws {AppwriteException}
|
|
639
|
+
* @returns {Promise}
|
|
640
|
+
*/
|
|
641
|
+
deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>;
|
|
642
|
+
/**
|
|
643
|
+
* Delete an authenticator for a user by ID.
|
|
644
|
+
*
|
|
645
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
646
|
+
* @throws {AppwriteException}
|
|
647
|
+
* @returns {Promise<{}>}
|
|
648
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
649
|
+
*/
|
|
650
|
+
deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
651
|
+
deleteMFAAuthenticator(
|
|
652
|
+
paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType
|
|
653
|
+
): Promise<{}> {
|
|
654
|
+
let params: { type: AuthenticatorType };
|
|
655
|
+
|
|
656
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
|
|
657
|
+
params = (paramsOrFirst || {}) as { type: AuthenticatorType };
|
|
658
|
+
} else {
|
|
659
|
+
params = {
|
|
660
|
+
type: paramsOrFirst as AuthenticatorType
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
const type = params.type;
|
|
665
|
+
|
|
666
|
+
if (typeof type === 'undefined') {
|
|
667
|
+
throw new AppwriteException('Missing required parameter: "type"');
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
|
|
671
|
+
const payload: Payload = {};
|
|
672
|
+
|
|
673
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
674
|
+
return this.client.call('delete', uri, {
|
|
675
|
+
'content-type': 'application/json',
|
|
676
|
+
}, payload);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
681
|
+
*
|
|
682
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
683
|
+
* @throws {AppwriteException}
|
|
684
|
+
* @returns {Promise}
|
|
685
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.
|
|
686
|
+
*/
|
|
687
|
+
createMfaChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
|
|
688
|
+
/**
|
|
689
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
690
|
+
*
|
|
691
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
692
|
+
* @throws {AppwriteException}
|
|
693
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
694
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
695
|
+
*/
|
|
696
|
+
createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
697
|
+
createMfaChallenge(
|
|
698
|
+
paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
|
|
699
|
+
): Promise<Models.MfaChallenge> {
|
|
700
|
+
let params: { factor: AuthenticationFactor };
|
|
701
|
+
|
|
702
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
703
|
+
params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
|
|
704
|
+
} else {
|
|
705
|
+
params = {
|
|
706
|
+
factor: paramsOrFirst as AuthenticationFactor
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
const factor = params.factor;
|
|
711
|
+
|
|
712
|
+
if (typeof factor === 'undefined') {
|
|
713
|
+
throw new AppwriteException('Missing required parameter: "factor"');
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const apiPath = '/account/mfa/challenge';
|
|
717
|
+
const payload: Payload = {};
|
|
718
|
+
|
|
719
|
+
if (typeof factor !== 'undefined') {
|
|
720
|
+
payload['factor'] = factor;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
724
|
+
return this.client.call('post', uri, {
|
|
725
|
+
'content-type': 'application/json',
|
|
726
|
+
}, payload);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
317
731
|
*
|
|
318
|
-
* @param {AuthenticationFactor} factor
|
|
732
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
319
733
|
* @throws {AppwriteException}
|
|
320
734
|
* @returns {Promise}
|
|
321
|
-
|
|
322
|
-
|
|
735
|
+
*/
|
|
736
|
+
createMFAChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>;
|
|
737
|
+
/**
|
|
738
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
739
|
+
*
|
|
740
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
741
|
+
* @throws {AppwriteException}
|
|
742
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
743
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
744
|
+
*/
|
|
745
|
+
createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
746
|
+
createMFAChallenge(
|
|
747
|
+
paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor
|
|
748
|
+
): Promise<Models.MfaChallenge> {
|
|
749
|
+
let params: { factor: AuthenticationFactor };
|
|
750
|
+
|
|
751
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
|
|
752
|
+
params = (paramsOrFirst || {}) as { factor: AuthenticationFactor };
|
|
753
|
+
} else {
|
|
754
|
+
params = {
|
|
755
|
+
factor: paramsOrFirst as AuthenticationFactor
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
const factor = params.factor;
|
|
760
|
+
|
|
323
761
|
if (typeof factor === 'undefined') {
|
|
324
762
|
throw new AppwriteException('Missing required parameter: "factor"');
|
|
325
763
|
}
|
|
@@ -338,18 +776,105 @@ export class Account extends Service {
|
|
|
338
776
|
}
|
|
339
777
|
|
|
340
778
|
/**
|
|
341
|
-
* Complete the MFA challenge by providing the one-time password. Finish the
|
|
342
|
-
*
|
|
343
|
-
* the
|
|
344
|
-
*
|
|
345
|
-
*
|
|
779
|
+
* 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.
|
|
780
|
+
*
|
|
781
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
782
|
+
* @param {string} params.otp - Valid verification token.
|
|
783
|
+
* @throws {AppwriteException}
|
|
784
|
+
* @returns {Promise}
|
|
785
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.
|
|
786
|
+
*/
|
|
787
|
+
updateMfaChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
|
|
788
|
+
/**
|
|
789
|
+
* 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.
|
|
790
|
+
*
|
|
791
|
+
* @param {string} challengeId - ID of the challenge.
|
|
792
|
+
* @param {string} otp - Valid verification token.
|
|
793
|
+
* @throws {AppwriteException}
|
|
794
|
+
* @returns {Promise<Models.Session>}
|
|
795
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
796
|
+
*/
|
|
797
|
+
updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
798
|
+
updateMfaChallenge(
|
|
799
|
+
paramsOrFirst: { challengeId: string, otp: string } | string,
|
|
800
|
+
...rest: [(string)?]
|
|
801
|
+
): Promise<Models.Session> {
|
|
802
|
+
let params: { challengeId: string, otp: string };
|
|
803
|
+
|
|
804
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
805
|
+
params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
|
|
806
|
+
} else {
|
|
807
|
+
params = {
|
|
808
|
+
challengeId: paramsOrFirst as string,
|
|
809
|
+
otp: rest[0] as string
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
const challengeId = params.challengeId;
|
|
814
|
+
const otp = params.otp;
|
|
815
|
+
|
|
816
|
+
if (typeof challengeId === 'undefined') {
|
|
817
|
+
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
if (typeof otp === 'undefined') {
|
|
821
|
+
throw new AppwriteException('Missing required parameter: "otp"');
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const apiPath = '/account/mfa/challenge';
|
|
825
|
+
const payload: Payload = {};
|
|
826
|
+
|
|
827
|
+
if (typeof challengeId !== 'undefined') {
|
|
828
|
+
payload['challengeId'] = challengeId;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (typeof otp !== 'undefined') {
|
|
832
|
+
payload['otp'] = otp;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
836
|
+
return this.client.call('put', uri, {
|
|
837
|
+
'content-type': 'application/json',
|
|
838
|
+
}, payload);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* 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.
|
|
346
843
|
*
|
|
347
|
-
* @param {string} challengeId
|
|
348
|
-
* @param {string} otp
|
|
844
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
845
|
+
* @param {string} params.otp - Valid verification token.
|
|
349
846
|
* @throws {AppwriteException}
|
|
350
847
|
* @returns {Promise}
|
|
351
|
-
|
|
352
|
-
|
|
848
|
+
*/
|
|
849
|
+
updateMFAChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>;
|
|
850
|
+
/**
|
|
851
|
+
* 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.
|
|
852
|
+
*
|
|
853
|
+
* @param {string} challengeId - ID of the challenge.
|
|
854
|
+
* @param {string} otp - Valid verification token.
|
|
855
|
+
* @throws {AppwriteException}
|
|
856
|
+
* @returns {Promise<Models.Session>}
|
|
857
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
858
|
+
*/
|
|
859
|
+
updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
860
|
+
updateMFAChallenge(
|
|
861
|
+
paramsOrFirst: { challengeId: string, otp: string } | string,
|
|
862
|
+
...rest: [(string)?]
|
|
863
|
+
): Promise<Models.Session> {
|
|
864
|
+
let params: { challengeId: string, otp: string };
|
|
865
|
+
|
|
866
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
867
|
+
params = (paramsOrFirst || {}) as { challengeId: string, otp: string };
|
|
868
|
+
} else {
|
|
869
|
+
params = {
|
|
870
|
+
challengeId: paramsOrFirst as string,
|
|
871
|
+
otp: rest[0] as string
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
const challengeId = params.challengeId;
|
|
876
|
+
const otp = params.otp;
|
|
877
|
+
|
|
353
878
|
if (typeof challengeId === 'undefined') {
|
|
354
879
|
throw new AppwriteException('Missing required parameter: "challengeId"');
|
|
355
880
|
}
|
|
@@ -380,7 +905,8 @@ export class Account extends Service {
|
|
|
380
905
|
*
|
|
381
906
|
* @throws {AppwriteException}
|
|
382
907
|
* @returns {Promise}
|
|
383
|
-
|
|
908
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
|
|
909
|
+
*/
|
|
384
910
|
listMfaFactors(): Promise<Models.MfaFactors> {
|
|
385
911
|
const apiPath = '/account/mfa/factors';
|
|
386
912
|
const payload: Payload = {};
|
|
@@ -391,14 +917,27 @@ export class Account extends Service {
|
|
|
391
917
|
}
|
|
392
918
|
|
|
393
919
|
/**
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
920
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
921
|
+
*
|
|
922
|
+
* @throws {AppwriteException}
|
|
923
|
+
* @returns {Promise}
|
|
924
|
+
*/
|
|
925
|
+
listMFAFactors(): Promise<Models.MfaFactors> {
|
|
926
|
+
const apiPath = '/account/mfa/factors';
|
|
927
|
+
const payload: Payload = {};
|
|
928
|
+
|
|
929
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
930
|
+
return this.client.call('get', uri, {
|
|
931
|
+
}, payload);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* 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.
|
|
398
936
|
*
|
|
399
937
|
* @throws {AppwriteException}
|
|
400
938
|
* @returns {Promise}
|
|
401
|
-
|
|
939
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
|
|
940
|
+
*/
|
|
402
941
|
getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
403
942
|
const apiPath = '/account/mfa/recovery-codes';
|
|
404
943
|
const payload: Payload = {};
|
|
@@ -409,15 +948,27 @@ export class Account extends Service {
|
|
|
409
948
|
}
|
|
410
949
|
|
|
411
950
|
/**
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
|
|
951
|
+
* 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.
|
|
952
|
+
*
|
|
953
|
+
* @throws {AppwriteException}
|
|
954
|
+
* @returns {Promise}
|
|
955
|
+
*/
|
|
956
|
+
getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
957
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
958
|
+
const payload: Payload = {};
|
|
959
|
+
|
|
960
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
961
|
+
return this.client.call('get', uri, {
|
|
962
|
+
}, payload);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* 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.
|
|
417
967
|
*
|
|
418
968
|
* @throws {AppwriteException}
|
|
419
969
|
* @returns {Promise}
|
|
420
|
-
|
|
970
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
971
|
+
*/
|
|
421
972
|
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
422
973
|
const apiPath = '/account/mfa/recovery-codes';
|
|
423
974
|
const payload: Payload = {};
|
|
@@ -429,14 +980,28 @@ export class Account extends Service {
|
|
|
429
980
|
}
|
|
430
981
|
|
|
431
982
|
/**
|
|
432
|
-
*
|
|
433
|
-
* regenerating codes, they must be first generated using
|
|
434
|
-
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
|
|
435
|
-
* method. An OTP challenge is required to regenreate recovery codes.
|
|
983
|
+
* 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.
|
|
436
984
|
*
|
|
437
985
|
* @throws {AppwriteException}
|
|
438
986
|
* @returns {Promise}
|
|
439
|
-
|
|
987
|
+
*/
|
|
988
|
+
createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
989
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
990
|
+
const payload: Payload = {};
|
|
991
|
+
|
|
992
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
993
|
+
return this.client.call('post', uri, {
|
|
994
|
+
'content-type': 'application/json',
|
|
995
|
+
}, payload);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* 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.
|
|
1000
|
+
*
|
|
1001
|
+
* @throws {AppwriteException}
|
|
1002
|
+
* @returns {Promise}
|
|
1003
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
1004
|
+
*/
|
|
440
1005
|
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
441
1006
|
const apiPath = '/account/mfa/recovery-codes';
|
|
442
1007
|
const payload: Payload = {};
|
|
@@ -447,14 +1012,54 @@ export class Account extends Service {
|
|
|
447
1012
|
}, payload);
|
|
448
1013
|
}
|
|
449
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* 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.
|
|
1017
|
+
*
|
|
1018
|
+
* @throws {AppwriteException}
|
|
1019
|
+
* @returns {Promise}
|
|
1020
|
+
*/
|
|
1021
|
+
updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
|
|
1022
|
+
const apiPath = '/account/mfa/recovery-codes';
|
|
1023
|
+
const payload: Payload = {};
|
|
1024
|
+
|
|
1025
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1026
|
+
return this.client.call('patch', uri, {
|
|
1027
|
+
'content-type': 'application/json',
|
|
1028
|
+
}, payload);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
450
1031
|
/**
|
|
451
1032
|
* Update currently logged in user account name.
|
|
452
1033
|
*
|
|
453
|
-
* @param {string} name
|
|
1034
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
454
1035
|
* @throws {AppwriteException}
|
|
455
1036
|
* @returns {Promise}
|
|
456
|
-
|
|
457
|
-
updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences
|
|
1037
|
+
*/
|
|
1038
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>;
|
|
1039
|
+
/**
|
|
1040
|
+
* Update currently logged in user account name.
|
|
1041
|
+
*
|
|
1042
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
1043
|
+
* @throws {AppwriteException}
|
|
1044
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1045
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1046
|
+
*/
|
|
1047
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>;
|
|
1048
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1049
|
+
paramsOrFirst: { name: string } | string
|
|
1050
|
+
): Promise<Models.User<Preferences>> {
|
|
1051
|
+
let params: { name: string };
|
|
1052
|
+
|
|
1053
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1054
|
+
params = (paramsOrFirst || {}) as { name: string };
|
|
1055
|
+
} else {
|
|
1056
|
+
params = {
|
|
1057
|
+
name: paramsOrFirst as string
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const name = params.name;
|
|
1062
|
+
|
|
458
1063
|
if (typeof name === 'undefined') {
|
|
459
1064
|
throw new AppwriteException('Missing required parameter: "name"');
|
|
460
1065
|
}
|
|
@@ -473,16 +1078,42 @@ export class Account extends Service {
|
|
|
473
1078
|
}
|
|
474
1079
|
|
|
475
1080
|
/**
|
|
476
|
-
* Update currently logged in user password. For validation, user is required
|
|
477
|
-
* to pass in the new password, and the old password. For users created with
|
|
478
|
-
* OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
1081
|
+
* Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
479
1082
|
*
|
|
480
|
-
* @param {string} password
|
|
481
|
-
* @param {string} oldPassword
|
|
1083
|
+
* @param {string} params.password - New user password. Must be at least 8 chars.
|
|
1084
|
+
* @param {string} params.oldPassword - Current user password. Must be at least 8 chars.
|
|
482
1085
|
* @throws {AppwriteException}
|
|
483
1086
|
* @returns {Promise}
|
|
484
|
-
|
|
485
|
-
updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences
|
|
1087
|
+
*/
|
|
1088
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { password: string, oldPassword?: string }): Promise<Models.User<Preferences>>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
1091
|
+
*
|
|
1092
|
+
* @param {string} password - New user password. Must be at least 8 chars.
|
|
1093
|
+
* @param {string} oldPassword - Current user password. Must be at least 8 chars.
|
|
1094
|
+
* @throws {AppwriteException}
|
|
1095
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1096
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1097
|
+
*/
|
|
1098
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
|
|
1099
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1100
|
+
paramsOrFirst: { password: string, oldPassword?: string } | string,
|
|
1101
|
+
...rest: [(string)?]
|
|
1102
|
+
): Promise<Models.User<Preferences>> {
|
|
1103
|
+
let params: { password: string, oldPassword?: string };
|
|
1104
|
+
|
|
1105
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1106
|
+
params = (paramsOrFirst || {}) as { password: string, oldPassword?: string };
|
|
1107
|
+
} else {
|
|
1108
|
+
params = {
|
|
1109
|
+
password: paramsOrFirst as string,
|
|
1110
|
+
oldPassword: rest[0] as string
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
const password = params.password;
|
|
1115
|
+
const oldPassword = params.oldPassword;
|
|
1116
|
+
|
|
486
1117
|
if (typeof password === 'undefined') {
|
|
487
1118
|
throw new AppwriteException('Missing required parameter: "password"');
|
|
488
1119
|
}
|
|
@@ -505,18 +1136,42 @@ export class Account extends Service {
|
|
|
505
1136
|
}
|
|
506
1137
|
|
|
507
1138
|
/**
|
|
508
|
-
* Update the currently logged in user's phone number. After updating the
|
|
509
|
-
* phone number, the phone verification status will be reset. A confirmation
|
|
510
|
-
* SMS is not sent automatically, however you can use the [POST
|
|
511
|
-
* /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
|
|
512
|
-
* endpoint to send a confirmation SMS.
|
|
1139
|
+
* Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
513
1140
|
*
|
|
514
|
-
* @param {string} phone
|
|
515
|
-
* @param {string} password
|
|
1141
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
1142
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
516
1143
|
* @throws {AppwriteException}
|
|
517
1144
|
* @returns {Promise}
|
|
518
|
-
|
|
519
|
-
updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences
|
|
1145
|
+
*/
|
|
1146
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { phone: string, password: string }): Promise<Models.User<Preferences>>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
1151
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
1152
|
+
* @throws {AppwriteException}
|
|
1153
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1154
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1155
|
+
*/
|
|
1156
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
|
|
1157
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1158
|
+
paramsOrFirst: { phone: string, password: string } | string,
|
|
1159
|
+
...rest: [(string)?]
|
|
1160
|
+
): Promise<Models.User<Preferences>> {
|
|
1161
|
+
let params: { phone: string, password: string };
|
|
1162
|
+
|
|
1163
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1164
|
+
params = (paramsOrFirst || {}) as { phone: string, password: string };
|
|
1165
|
+
} else {
|
|
1166
|
+
params = {
|
|
1167
|
+
phone: paramsOrFirst as string,
|
|
1168
|
+
password: rest[0] as string
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
const phone = params.phone;
|
|
1173
|
+
const password = params.password;
|
|
1174
|
+
|
|
520
1175
|
if (typeof phone === 'undefined') {
|
|
521
1176
|
throw new AppwriteException('Missing required parameter: "phone"');
|
|
522
1177
|
}
|
|
@@ -547,8 +1202,8 @@ export class Account extends Service {
|
|
|
547
1202
|
*
|
|
548
1203
|
* @throws {AppwriteException}
|
|
549
1204
|
* @returns {Promise}
|
|
550
|
-
|
|
551
|
-
getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences> {
|
|
1205
|
+
*/
|
|
1206
|
+
getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> {
|
|
552
1207
|
const apiPath = '/account/prefs';
|
|
553
1208
|
const payload: Payload = {};
|
|
554
1209
|
|
|
@@ -558,15 +1213,37 @@ export class Account extends Service {
|
|
|
558
1213
|
}
|
|
559
1214
|
|
|
560
1215
|
/**
|
|
561
|
-
* Update currently logged in user account preferences. The object you pass is
|
|
562
|
-
* stored as is, and replaces any previous value. The maximum allowed prefs
|
|
563
|
-
* size is 64kB and throws error if exceeded.
|
|
1216
|
+
* Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
|
564
1217
|
*
|
|
565
|
-
* @param {
|
|
1218
|
+
* @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object.
|
|
566
1219
|
* @throws {AppwriteException}
|
|
567
1220
|
* @returns {Promise}
|
|
568
|
-
|
|
569
|
-
updatePrefs<Preferences extends Models.Preferences>(prefs:
|
|
1221
|
+
*/
|
|
1222
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences> }): Promise<Models.User<Preferences>>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
|
|
1225
|
+
*
|
|
1226
|
+
* @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
|
|
1227
|
+
* @throws {AppwriteException}
|
|
1228
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
1229
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1230
|
+
*/
|
|
1231
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
|
|
1232
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(
|
|
1233
|
+
paramsOrFirst: { prefs: Partial<Preferences> } | Partial<Preferences>
|
|
1234
|
+
): Promise<Models.User<Preferences>> {
|
|
1235
|
+
let params: { prefs: Partial<Preferences> };
|
|
1236
|
+
|
|
1237
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
|
|
1238
|
+
params = (paramsOrFirst || {}) as { prefs: Partial<Preferences> };
|
|
1239
|
+
} else {
|
|
1240
|
+
params = {
|
|
1241
|
+
prefs: paramsOrFirst as Partial<Preferences>
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
const prefs = params.prefs;
|
|
1246
|
+
|
|
570
1247
|
if (typeof prefs === 'undefined') {
|
|
571
1248
|
throw new AppwriteException('Missing required parameter: "prefs"');
|
|
572
1249
|
}
|
|
@@ -585,21 +1262,42 @@ export class Account extends Service {
|
|
|
585
1262
|
}
|
|
586
1263
|
|
|
587
1264
|
/**
|
|
588
|
-
* Sends the user an email with a temporary secret key for password reset.
|
|
589
|
-
* When the user clicks the confirmation link he is redirected back to your
|
|
590
|
-
* app password reset URL with the secret key and email address values
|
|
591
|
-
* attached to the URL query string. Use the query string params to submit a
|
|
592
|
-
* request to the [PUT
|
|
593
|
-
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
|
|
594
|
-
* endpoint to complete the process. The verification link sent to the user's
|
|
595
|
-
* email address is valid for 1 hour.
|
|
1265
|
+
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
596
1266
|
*
|
|
597
|
-
* @param {string} email
|
|
598
|
-
* @param {string} url
|
|
1267
|
+
* @param {string} params.email - User email.
|
|
1268
|
+
* @param {string} params.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.
|
|
599
1269
|
* @throws {AppwriteException}
|
|
600
1270
|
* @returns {Promise}
|
|
601
|
-
|
|
602
|
-
createRecovery(email: string, url: string): Promise<Models.Token
|
|
1271
|
+
*/
|
|
1272
|
+
createRecovery(params: { email: string, url: string }): Promise<Models.Token>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
1275
|
+
*
|
|
1276
|
+
* @param {string} email - User email.
|
|
1277
|
+
* @param {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.
|
|
1278
|
+
* @throws {AppwriteException}
|
|
1279
|
+
* @returns {Promise<Models.Token>}
|
|
1280
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1281
|
+
*/
|
|
1282
|
+
createRecovery(email: string, url: string): Promise<Models.Token>;
|
|
1283
|
+
createRecovery(
|
|
1284
|
+
paramsOrFirst: { email: string, url: string } | string,
|
|
1285
|
+
...rest: [(string)?]
|
|
1286
|
+
): Promise<Models.Token> {
|
|
1287
|
+
let params: { email: string, url: string };
|
|
1288
|
+
|
|
1289
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1290
|
+
params = (paramsOrFirst || {}) as { email: string, url: string };
|
|
1291
|
+
} else {
|
|
1292
|
+
params = {
|
|
1293
|
+
email: paramsOrFirst as string,
|
|
1294
|
+
url: rest[0] as string
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
const email = params.email;
|
|
1299
|
+
const url = params.url;
|
|
1300
|
+
|
|
603
1301
|
if (typeof email === 'undefined') {
|
|
604
1302
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
605
1303
|
}
|
|
@@ -626,24 +1324,50 @@ export class Account extends Service {
|
|
|
626
1324
|
}
|
|
627
1325
|
|
|
628
1326
|
/**
|
|
629
|
-
* Use this endpoint to complete the user account password reset. Both the
|
|
630
|
-
* **userId** and **secret** arguments will be passed as query parameters to
|
|
631
|
-
* the redirect URL you have provided when sending your request to the [POST
|
|
632
|
-
* /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
|
|
633
|
-
* endpoint.
|
|
1327
|
+
* 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.
|
|
634
1328
|
*
|
|
635
|
-
* Please note that in order to avoid a [Redirect
|
|
636
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
|
637
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
638
|
-
* adding your platforms in the console interface.
|
|
1329
|
+
* 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.
|
|
639
1330
|
*
|
|
640
|
-
* @param {string} userId
|
|
641
|
-
* @param {string} secret
|
|
642
|
-
* @param {string} password
|
|
1331
|
+
* @param {string} params.userId - User ID.
|
|
1332
|
+
* @param {string} params.secret - Valid reset token.
|
|
1333
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
643
1334
|
* @throws {AppwriteException}
|
|
644
1335
|
* @returns {Promise}
|
|
645
|
-
|
|
646
|
-
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token
|
|
1336
|
+
*/
|
|
1337
|
+
updateRecovery(params: { userId: string, secret: string, password: string }): Promise<Models.Token>;
|
|
1338
|
+
/**
|
|
1339
|
+
* 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.
|
|
1340
|
+
*
|
|
1341
|
+
* 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.
|
|
1342
|
+
*
|
|
1343
|
+
* @param {string} userId - User ID.
|
|
1344
|
+
* @param {string} secret - Valid reset token.
|
|
1345
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
1346
|
+
* @throws {AppwriteException}
|
|
1347
|
+
* @returns {Promise<Models.Token>}
|
|
1348
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1349
|
+
*/
|
|
1350
|
+
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
|
|
1351
|
+
updateRecovery(
|
|
1352
|
+
paramsOrFirst: { userId: string, secret: string, password: string } | string,
|
|
1353
|
+
...rest: [(string)?, (string)?]
|
|
1354
|
+
): Promise<Models.Token> {
|
|
1355
|
+
let params: { userId: string, secret: string, password: string };
|
|
1356
|
+
|
|
1357
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1358
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string };
|
|
1359
|
+
} else {
|
|
1360
|
+
params = {
|
|
1361
|
+
userId: paramsOrFirst as string,
|
|
1362
|
+
secret: rest[0] as string,
|
|
1363
|
+
password: rest[1] as string
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
const userId = params.userId;
|
|
1368
|
+
const secret = params.secret;
|
|
1369
|
+
const password = params.password;
|
|
1370
|
+
|
|
647
1371
|
if (typeof userId === 'undefined') {
|
|
648
1372
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
649
1373
|
}
|
|
@@ -678,12 +1402,11 @@ export class Account extends Service {
|
|
|
678
1402
|
}
|
|
679
1403
|
|
|
680
1404
|
/**
|
|
681
|
-
* Get the list of active sessions across different devices for the currently
|
|
682
|
-
* logged in user.
|
|
1405
|
+
* Get the list of active sessions across different devices for the currently logged in user.
|
|
683
1406
|
*
|
|
684
1407
|
* @throws {AppwriteException}
|
|
685
1408
|
* @returns {Promise}
|
|
686
|
-
|
|
1409
|
+
*/
|
|
687
1410
|
listSessions(): Promise<Models.SessionList> {
|
|
688
1411
|
const apiPath = '/account/sessions';
|
|
689
1412
|
const payload: Payload = {};
|
|
@@ -694,12 +1417,11 @@ export class Account extends Service {
|
|
|
694
1417
|
}
|
|
695
1418
|
|
|
696
1419
|
/**
|
|
697
|
-
* Delete all sessions from the user account and remove any sessions cookies
|
|
698
|
-
* from the end client.
|
|
1420
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
|
699
1421
|
*
|
|
700
1422
|
* @throws {AppwriteException}
|
|
701
1423
|
* @returns {Promise}
|
|
702
|
-
|
|
1424
|
+
*/
|
|
703
1425
|
deleteSessions(): Promise<{}> {
|
|
704
1426
|
const apiPath = '/account/sessions';
|
|
705
1427
|
const payload: Payload = {};
|
|
@@ -711,17 +1433,11 @@ export class Account extends Service {
|
|
|
711
1433
|
}
|
|
712
1434
|
|
|
713
1435
|
/**
|
|
714
|
-
* Use this endpoint to allow a new user to register an anonymous account in
|
|
715
|
-
* your project. This route will also create a new session for the user. To
|
|
716
|
-
* allow the new user to convert an anonymous account to a normal account, you
|
|
717
|
-
* need to update its [email and
|
|
718
|
-
* password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
|
|
719
|
-
* or create an [OAuth2
|
|
720
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
1436
|
+
* Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
|
721
1437
|
*
|
|
722
1438
|
* @throws {AppwriteException}
|
|
723
1439
|
* @returns {Promise}
|
|
724
|
-
|
|
1440
|
+
*/
|
|
725
1441
|
createAnonymousSession(): Promise<Models.Session> {
|
|
726
1442
|
const apiPath = '/account/sessions/anonymous';
|
|
727
1443
|
const payload: Payload = {};
|
|
@@ -733,19 +1449,46 @@ export class Account extends Service {
|
|
|
733
1449
|
}
|
|
734
1450
|
|
|
735
1451
|
/**
|
|
736
|
-
* Allow the user to login into their account by providing a valid email and
|
|
737
|
-
* password combination. This route will create a new session for the user.
|
|
1452
|
+
* 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.
|
|
738
1453
|
*
|
|
739
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
740
|
-
* about session
|
|
741
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1454
|
+
* 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).
|
|
742
1455
|
*
|
|
743
|
-
* @param {string} email
|
|
744
|
-
* @param {string} password
|
|
1456
|
+
* @param {string} params.email - User email.
|
|
1457
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
745
1458
|
* @throws {AppwriteException}
|
|
746
1459
|
* @returns {Promise}
|
|
747
|
-
|
|
748
|
-
createEmailPasswordSession(email: string, password: string): Promise<Models.Session
|
|
1460
|
+
*/
|
|
1461
|
+
createEmailPasswordSession(params: { email: string, password: string }): Promise<Models.Session>;
|
|
1462
|
+
/**
|
|
1463
|
+
* 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.
|
|
1464
|
+
*
|
|
1465
|
+
* 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).
|
|
1466
|
+
*
|
|
1467
|
+
* @param {string} email - User email.
|
|
1468
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
1469
|
+
* @throws {AppwriteException}
|
|
1470
|
+
* @returns {Promise<Models.Session>}
|
|
1471
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1472
|
+
*/
|
|
1473
|
+
createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
|
|
1474
|
+
createEmailPasswordSession(
|
|
1475
|
+
paramsOrFirst: { email: string, password: string } | string,
|
|
1476
|
+
...rest: [(string)?]
|
|
1477
|
+
): Promise<Models.Session> {
|
|
1478
|
+
let params: { email: string, password: string };
|
|
1479
|
+
|
|
1480
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1481
|
+
params = (paramsOrFirst || {}) as { email: string, password: string };
|
|
1482
|
+
} else {
|
|
1483
|
+
params = {
|
|
1484
|
+
email: paramsOrFirst as string,
|
|
1485
|
+
password: rest[0] as string
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
const email = params.email;
|
|
1490
|
+
const password = params.password;
|
|
1491
|
+
|
|
749
1492
|
if (typeof email === 'undefined') {
|
|
750
1493
|
throw new AppwriteException('Missing required parameter: "email"');
|
|
751
1494
|
}
|
|
@@ -772,16 +1515,43 @@ export class Account extends Service {
|
|
|
772
1515
|
}
|
|
773
1516
|
|
|
774
1517
|
/**
|
|
775
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
776
|
-
* and **secret** parameters from the successful response of authentication
|
|
777
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1518
|
+
* 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.
|
|
778
1519
|
*
|
|
779
|
-
* @param {string} userId
|
|
780
|
-
* @param {string} secret
|
|
1520
|
+
* @param {string} params.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.
|
|
1521
|
+
* @param {string} params.secret - Valid verification token.
|
|
781
1522
|
* @throws {AppwriteException}
|
|
782
1523
|
* @returns {Promise}
|
|
783
|
-
|
|
784
|
-
|
|
1524
|
+
* @deprecated This API has been deprecated.
|
|
1525
|
+
*/
|
|
1526
|
+
updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
1527
|
+
/**
|
|
1528
|
+
* 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.
|
|
1529
|
+
*
|
|
1530
|
+
* @param {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.
|
|
1531
|
+
* @param {string} secret - Valid verification token.
|
|
1532
|
+
* @throws {AppwriteException}
|
|
1533
|
+
* @returns {Promise<Models.Session>}
|
|
1534
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1535
|
+
*/
|
|
1536
|
+
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
|
|
1537
|
+
updateMagicURLSession(
|
|
1538
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
1539
|
+
...rest: [(string)?]
|
|
1540
|
+
): Promise<Models.Session> {
|
|
1541
|
+
let params: { userId: string, secret: string };
|
|
1542
|
+
|
|
1543
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1544
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
1545
|
+
} else {
|
|
1546
|
+
params = {
|
|
1547
|
+
userId: paramsOrFirst as string,
|
|
1548
|
+
secret: rest[0] as string
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
const userId = params.userId;
|
|
1553
|
+
const secret = params.secret;
|
|
1554
|
+
|
|
785
1555
|
if (typeof userId === 'undefined') {
|
|
786
1556
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
787
1557
|
}
|
|
@@ -808,31 +1578,60 @@ export class Account extends Service {
|
|
|
808
1578
|
}
|
|
809
1579
|
|
|
810
1580
|
/**
|
|
811
|
-
* Allow the user to login to their account using the OAuth2 provider of their
|
|
812
|
-
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
813
|
-
* first. Use the success and failure arguments to provide a redirect URL's
|
|
814
|
-
* back to your app when login is completed.
|
|
1581
|
+
* 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.
|
|
815
1582
|
*
|
|
816
|
-
* If there is already an active session, the new session will be attached to
|
|
817
|
-
* the logged-in account. If there are no active sessions, the server will
|
|
818
|
-
* attempt to look for a user with the same email address as the email
|
|
819
|
-
* received from the OAuth2 provider and attach the new session to the
|
|
820
|
-
* existing user. If no matching user is found - the server will create a new
|
|
821
|
-
* user.
|
|
1583
|
+
* 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.
|
|
822
1584
|
*
|
|
823
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
824
|
-
* about session
|
|
825
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1585
|
+
* 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).
|
|
826
1586
|
*
|
|
827
1587
|
*
|
|
828
|
-
* @param {OAuthProvider} provider
|
|
829
|
-
* @param {string} success
|
|
830
|
-
* @param {string} failure
|
|
831
|
-
* @param {string[]} scopes
|
|
1588
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
1589
|
+
* @param {string} params.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.
|
|
1590
|
+
* @param {string} params.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.
|
|
1591
|
+
* @param {string[]} params.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.
|
|
832
1592
|
* @throws {AppwriteException}
|
|
833
1593
|
* @returns {void|string}
|
|
834
|
-
|
|
835
|
-
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL
|
|
1594
|
+
*/
|
|
1595
|
+
createOAuth2Session(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | URL;
|
|
1596
|
+
/**
|
|
1597
|
+
* 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.
|
|
1598
|
+
*
|
|
1599
|
+
* 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.
|
|
1600
|
+
*
|
|
1601
|
+
* 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).
|
|
1602
|
+
*
|
|
1603
|
+
*
|
|
1604
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
1605
|
+
* @param {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.
|
|
1606
|
+
* @param {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.
|
|
1607
|
+
* @param {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.
|
|
1608
|
+
* @throws {AppwriteException}
|
|
1609
|
+
* @returns {void | URL}
|
|
1610
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1611
|
+
*/
|
|
1612
|
+
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
|
|
1613
|
+
createOAuth2Session(
|
|
1614
|
+
paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
|
|
1615
|
+
...rest: [(string)?, (string)?, (string[])?]
|
|
1616
|
+
): void | URL {
|
|
1617
|
+
let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
1618
|
+
|
|
1619
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
1620
|
+
params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
1621
|
+
} else {
|
|
1622
|
+
params = {
|
|
1623
|
+
provider: paramsOrFirst as OAuthProvider,
|
|
1624
|
+
success: rest[0] as string,
|
|
1625
|
+
failure: rest[1] as string,
|
|
1626
|
+
scopes: rest[2] as string[]
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
const provider = params.provider;
|
|
1631
|
+
const success = params.success;
|
|
1632
|
+
const failure = params.failure;
|
|
1633
|
+
const scopes = params.scopes;
|
|
1634
|
+
|
|
836
1635
|
if (typeof provider === 'undefined') {
|
|
837
1636
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
838
1637
|
}
|
|
@@ -863,16 +1662,43 @@ export class Account extends Service {
|
|
|
863
1662
|
}
|
|
864
1663
|
|
|
865
1664
|
/**
|
|
866
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
867
|
-
* and **secret** parameters from the successful response of authentication
|
|
868
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1665
|
+
* 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.
|
|
869
1666
|
*
|
|
870
|
-
* @param {string} userId
|
|
871
|
-
* @param {string} secret
|
|
1667
|
+
* @param {string} params.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.
|
|
1668
|
+
* @param {string} params.secret - Valid verification token.
|
|
872
1669
|
* @throws {AppwriteException}
|
|
873
1670
|
* @returns {Promise}
|
|
874
|
-
|
|
875
|
-
|
|
1671
|
+
* @deprecated This API has been deprecated.
|
|
1672
|
+
*/
|
|
1673
|
+
updatePhoneSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
1674
|
+
/**
|
|
1675
|
+
* 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.
|
|
1676
|
+
*
|
|
1677
|
+
* @param {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.
|
|
1678
|
+
* @param {string} secret - Valid verification token.
|
|
1679
|
+
* @throws {AppwriteException}
|
|
1680
|
+
* @returns {Promise<Models.Session>}
|
|
1681
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1682
|
+
*/
|
|
1683
|
+
updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
|
|
1684
|
+
updatePhoneSession(
|
|
1685
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
1686
|
+
...rest: [(string)?]
|
|
1687
|
+
): Promise<Models.Session> {
|
|
1688
|
+
let params: { userId: string, secret: string };
|
|
1689
|
+
|
|
1690
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1691
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
1692
|
+
} else {
|
|
1693
|
+
params = {
|
|
1694
|
+
userId: paramsOrFirst as string,
|
|
1695
|
+
secret: rest[0] as string
|
|
1696
|
+
};
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
const userId = params.userId;
|
|
1700
|
+
const secret = params.secret;
|
|
1701
|
+
|
|
876
1702
|
if (typeof userId === 'undefined') {
|
|
877
1703
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
878
1704
|
}
|
|
@@ -899,16 +1725,42 @@ export class Account extends Service {
|
|
|
899
1725
|
}
|
|
900
1726
|
|
|
901
1727
|
/**
|
|
902
|
-
* Use this endpoint to create a session from token. Provide the **userId**
|
|
903
|
-
* and **secret** parameters from the successful response of authentication
|
|
904
|
-
* flows initiated by token creation. For example, magic URL and phone login.
|
|
1728
|
+
* 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.
|
|
905
1729
|
*
|
|
906
|
-
* @param {string} userId
|
|
907
|
-
* @param {string} secret
|
|
1730
|
+
* @param {string} params.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.
|
|
1731
|
+
* @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
908
1732
|
* @throws {AppwriteException}
|
|
909
1733
|
* @returns {Promise}
|
|
910
|
-
|
|
911
|
-
createSession(userId: string, secret: string): Promise<Models.Session
|
|
1734
|
+
*/
|
|
1735
|
+
createSession(params: { userId: string, secret: string }): Promise<Models.Session>;
|
|
1736
|
+
/**
|
|
1737
|
+
* 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.
|
|
1738
|
+
*
|
|
1739
|
+
* @param {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.
|
|
1740
|
+
* @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
1741
|
+
* @throws {AppwriteException}
|
|
1742
|
+
* @returns {Promise<Models.Session>}
|
|
1743
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1744
|
+
*/
|
|
1745
|
+
createSession(userId: string, secret: string): Promise<Models.Session>;
|
|
1746
|
+
createSession(
|
|
1747
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
1748
|
+
...rest: [(string)?]
|
|
1749
|
+
): Promise<Models.Session> {
|
|
1750
|
+
let params: { userId: string, secret: string };
|
|
1751
|
+
|
|
1752
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1753
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
1754
|
+
} else {
|
|
1755
|
+
params = {
|
|
1756
|
+
userId: paramsOrFirst as string,
|
|
1757
|
+
secret: rest[0] as string
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
const userId = params.userId;
|
|
1762
|
+
const secret = params.secret;
|
|
1763
|
+
|
|
912
1764
|
if (typeof userId === 'undefined') {
|
|
913
1765
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
914
1766
|
}
|
|
@@ -935,14 +1787,37 @@ export class Account extends Service {
|
|
|
935
1787
|
}
|
|
936
1788
|
|
|
937
1789
|
/**
|
|
938
|
-
* Use this endpoint to get a logged in user's session using a Session ID.
|
|
939
|
-
* Inputting 'current' will return the current session being used.
|
|
1790
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
940
1791
|
*
|
|
941
|
-
* @param {string} sessionId
|
|
1792
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
942
1793
|
* @throws {AppwriteException}
|
|
943
1794
|
* @returns {Promise}
|
|
944
|
-
|
|
945
|
-
getSession(sessionId: string): Promise<Models.Session
|
|
1795
|
+
*/
|
|
1796
|
+
getSession(params: { sessionId: string }): Promise<Models.Session>;
|
|
1797
|
+
/**
|
|
1798
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
1799
|
+
*
|
|
1800
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
1801
|
+
* @throws {AppwriteException}
|
|
1802
|
+
* @returns {Promise<Models.Session>}
|
|
1803
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1804
|
+
*/
|
|
1805
|
+
getSession(sessionId: string): Promise<Models.Session>;
|
|
1806
|
+
getSession(
|
|
1807
|
+
paramsOrFirst: { sessionId: string } | string
|
|
1808
|
+
): Promise<Models.Session> {
|
|
1809
|
+
let params: { sessionId: string };
|
|
1810
|
+
|
|
1811
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1812
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
1813
|
+
} else {
|
|
1814
|
+
params = {
|
|
1815
|
+
sessionId: paramsOrFirst as string
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
const sessionId = params.sessionId;
|
|
1820
|
+
|
|
946
1821
|
if (typeof sessionId === 'undefined') {
|
|
947
1822
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
948
1823
|
}
|
|
@@ -956,15 +1831,37 @@ export class Account extends Service {
|
|
|
956
1831
|
}
|
|
957
1832
|
|
|
958
1833
|
/**
|
|
959
|
-
* Use this endpoint to extend a session's length. Extending a session is
|
|
960
|
-
* useful when session expiry is short. If the session was created using an
|
|
961
|
-
* OAuth provider, this endpoint refreshes the access token from the provider.
|
|
1834
|
+
* 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.
|
|
962
1835
|
*
|
|
963
|
-
* @param {string} sessionId
|
|
1836
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
964
1837
|
* @throws {AppwriteException}
|
|
965
1838
|
* @returns {Promise}
|
|
966
|
-
|
|
967
|
-
updateSession(sessionId: string): Promise<Models.Session
|
|
1839
|
+
*/
|
|
1840
|
+
updateSession(params: { sessionId: string }): Promise<Models.Session>;
|
|
1841
|
+
/**
|
|
1842
|
+
* 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.
|
|
1843
|
+
*
|
|
1844
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
1845
|
+
* @throws {AppwriteException}
|
|
1846
|
+
* @returns {Promise<Models.Session>}
|
|
1847
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1848
|
+
*/
|
|
1849
|
+
updateSession(sessionId: string): Promise<Models.Session>;
|
|
1850
|
+
updateSession(
|
|
1851
|
+
paramsOrFirst: { sessionId: string } | string
|
|
1852
|
+
): Promise<Models.Session> {
|
|
1853
|
+
let params: { sessionId: string };
|
|
1854
|
+
|
|
1855
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1856
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
1857
|
+
} else {
|
|
1858
|
+
params = {
|
|
1859
|
+
sessionId: paramsOrFirst as string
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
const sessionId = params.sessionId;
|
|
1864
|
+
|
|
968
1865
|
if (typeof sessionId === 'undefined') {
|
|
969
1866
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
970
1867
|
}
|
|
@@ -979,17 +1876,37 @@ export class Account extends Service {
|
|
|
979
1876
|
}
|
|
980
1877
|
|
|
981
1878
|
/**
|
|
982
|
-
* Logout the user. Use 'current' as the session ID to logout on this device,
|
|
983
|
-
* use a session ID to logout on another device. If you're looking to logout
|
|
984
|
-
* the user on all devices, use [Delete
|
|
985
|
-
* Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
|
|
986
|
-
* instead.
|
|
1879
|
+
* Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
987
1880
|
*
|
|
988
|
-
* @param {string} sessionId
|
|
1881
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
989
1882
|
* @throws {AppwriteException}
|
|
990
1883
|
* @returns {Promise}
|
|
991
|
-
|
|
992
|
-
deleteSession(sessionId: string): Promise<{}
|
|
1884
|
+
*/
|
|
1885
|
+
deleteSession(params: { sessionId: string }): Promise<{}>;
|
|
1886
|
+
/**
|
|
1887
|
+
* Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
1888
|
+
*
|
|
1889
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
1890
|
+
* @throws {AppwriteException}
|
|
1891
|
+
* @returns {Promise<{}>}
|
|
1892
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1893
|
+
*/
|
|
1894
|
+
deleteSession(sessionId: string): Promise<{}>;
|
|
1895
|
+
deleteSession(
|
|
1896
|
+
paramsOrFirst: { sessionId: string } | string
|
|
1897
|
+
): Promise<{}> {
|
|
1898
|
+
let params: { sessionId: string };
|
|
1899
|
+
|
|
1900
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1901
|
+
params = (paramsOrFirst || {}) as { sessionId: string };
|
|
1902
|
+
} else {
|
|
1903
|
+
params = {
|
|
1904
|
+
sessionId: paramsOrFirst as string
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
const sessionId = params.sessionId;
|
|
1909
|
+
|
|
993
1910
|
if (typeof sessionId === 'undefined') {
|
|
994
1911
|
throw new AppwriteException('Missing required parameter: "sessionId"');
|
|
995
1912
|
}
|
|
@@ -1004,14 +1921,12 @@ export class Account extends Service {
|
|
|
1004
1921
|
}
|
|
1005
1922
|
|
|
1006
1923
|
/**
|
|
1007
|
-
* Block the currently logged in user account. Behind the scene, the user
|
|
1008
|
-
* record is not deleted but permanently blocked from any access. To
|
|
1009
|
-
* completely delete a user, use the Users API instead.
|
|
1924
|
+
* 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.
|
|
1010
1925
|
*
|
|
1011
1926
|
* @throws {AppwriteException}
|
|
1012
1927
|
* @returns {Promise}
|
|
1013
|
-
|
|
1014
|
-
updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>> {
|
|
1928
|
+
*/
|
|
1929
|
+
updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> {
|
|
1015
1930
|
const apiPath = '/account/status';
|
|
1016
1931
|
const payload: Payload = {};
|
|
1017
1932
|
|
|
@@ -1022,19 +1937,46 @@ export class Account extends Service {
|
|
|
1022
1937
|
}
|
|
1023
1938
|
|
|
1024
1939
|
/**
|
|
1025
|
-
* Use this endpoint to register a device for push notifications. Provide a
|
|
1026
|
-
* target ID (custom or generated using ID.unique()), a device identifier
|
|
1027
|
-
* (usually a device token), and optionally specify which provider should send
|
|
1028
|
-
* notifications to this target. The target is automatically linked to the
|
|
1029
|
-
* current session and includes device information like brand and model.
|
|
1940
|
+
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
|
|
1030
1941
|
*
|
|
1031
|
-
* @param {string} targetId
|
|
1032
|
-
* @param {string} identifier
|
|
1033
|
-
* @param {string} providerId
|
|
1942
|
+
* @param {string} params.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.
|
|
1943
|
+
* @param {string} params.identifier - The target identifier (token, email, phone etc.)
|
|
1944
|
+
* @param {string} params.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.
|
|
1034
1945
|
* @throws {AppwriteException}
|
|
1035
1946
|
* @returns {Promise}
|
|
1036
|
-
|
|
1037
|
-
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target
|
|
1947
|
+
*/
|
|
1948
|
+
createPushTarget(params: { targetId: string, identifier: string, providerId?: string }): Promise<Models.Target>;
|
|
1949
|
+
/**
|
|
1950
|
+
* Use this endpoint to register a device for push notifications. Provide a target ID (custom or generated using ID.unique()), a device identifier (usually a device token), and optionally specify which provider should send notifications to this target. The target is automatically linked to the current session and includes device information like brand and model.
|
|
1951
|
+
*
|
|
1952
|
+
* @param {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.
|
|
1953
|
+
* @param {string} identifier - The target identifier (token, email, phone etc.)
|
|
1954
|
+
* @param {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.
|
|
1955
|
+
* @throws {AppwriteException}
|
|
1956
|
+
* @returns {Promise<Models.Target>}
|
|
1957
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
1958
|
+
*/
|
|
1959
|
+
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
|
|
1960
|
+
createPushTarget(
|
|
1961
|
+
paramsOrFirst: { targetId: string, identifier: string, providerId?: string } | string,
|
|
1962
|
+
...rest: [(string)?, (string)?]
|
|
1963
|
+
): Promise<Models.Target> {
|
|
1964
|
+
let params: { targetId: string, identifier: string, providerId?: string };
|
|
1965
|
+
|
|
1966
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1967
|
+
params = (paramsOrFirst || {}) as { targetId: string, identifier: string, providerId?: string };
|
|
1968
|
+
} else {
|
|
1969
|
+
params = {
|
|
1970
|
+
targetId: paramsOrFirst as string,
|
|
1971
|
+
identifier: rest[0] as string,
|
|
1972
|
+
providerId: rest[1] as string
|
|
1973
|
+
};
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
const targetId = params.targetId;
|
|
1977
|
+
const identifier = params.identifier;
|
|
1978
|
+
const providerId = params.providerId;
|
|
1979
|
+
|
|
1038
1980
|
if (typeof targetId === 'undefined') {
|
|
1039
1981
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1040
1982
|
}
|
|
@@ -1065,18 +2007,42 @@ export class Account extends Service {
|
|
|
1065
2007
|
}
|
|
1066
2008
|
|
|
1067
2009
|
/**
|
|
1068
|
-
* Update the currently logged in user's push notification target. You can
|
|
1069
|
-
* modify the target's identifier (device token) and provider ID (token,
|
|
1070
|
-
* email, phone etc.). The target must exist and belong to the current user.
|
|
1071
|
-
* If you change the provider ID, notifications will be sent through the new
|
|
1072
|
-
* messaging provider instead.
|
|
2010
|
+
* Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
|
|
1073
2011
|
*
|
|
1074
|
-
* @param {string} targetId
|
|
1075
|
-
* @param {string} identifier
|
|
2012
|
+
* @param {string} params.targetId - Target ID.
|
|
2013
|
+
* @param {string} params.identifier - The target identifier (token, email, phone etc.)
|
|
1076
2014
|
* @throws {AppwriteException}
|
|
1077
2015
|
* @returns {Promise}
|
|
1078
|
-
|
|
1079
|
-
updatePushTarget(targetId: string, identifier: string): Promise<Models.Target
|
|
2016
|
+
*/
|
|
2017
|
+
updatePushTarget(params: { targetId: string, identifier: string }): Promise<Models.Target>;
|
|
2018
|
+
/**
|
|
2019
|
+
* Update the currently logged in user's push notification target. You can modify the target's identifier (device token) and provider ID (token, email, phone etc.). The target must exist and belong to the current user. If you change the provider ID, notifications will be sent through the new messaging provider instead.
|
|
2020
|
+
*
|
|
2021
|
+
* @param {string} targetId - Target ID.
|
|
2022
|
+
* @param {string} identifier - The target identifier (token, email, phone etc.)
|
|
2023
|
+
* @throws {AppwriteException}
|
|
2024
|
+
* @returns {Promise<Models.Target>}
|
|
2025
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2026
|
+
*/
|
|
2027
|
+
updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
|
|
2028
|
+
updatePushTarget(
|
|
2029
|
+
paramsOrFirst: { targetId: string, identifier: string } | string,
|
|
2030
|
+
...rest: [(string)?]
|
|
2031
|
+
): Promise<Models.Target> {
|
|
2032
|
+
let params: { targetId: string, identifier: string };
|
|
2033
|
+
|
|
2034
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2035
|
+
params = (paramsOrFirst || {}) as { targetId: string, identifier: string };
|
|
2036
|
+
} else {
|
|
2037
|
+
params = {
|
|
2038
|
+
targetId: paramsOrFirst as string,
|
|
2039
|
+
identifier: rest[0] as string
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
const targetId = params.targetId;
|
|
2044
|
+
const identifier = params.identifier;
|
|
2045
|
+
|
|
1080
2046
|
if (typeof targetId === 'undefined') {
|
|
1081
2047
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1082
2048
|
}
|
|
@@ -1099,15 +2065,37 @@ export class Account extends Service {
|
|
|
1099
2065
|
}
|
|
1100
2066
|
|
|
1101
2067
|
/**
|
|
1102
|
-
* Delete a push notification target for the currently logged in user. After
|
|
1103
|
-
* deletion, the device will no longer receive push notifications. The target
|
|
1104
|
-
* must exist and belong to the current user.
|
|
2068
|
+
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
|
|
1105
2069
|
*
|
|
1106
|
-
* @param {string} targetId
|
|
2070
|
+
* @param {string} params.targetId - Target ID.
|
|
1107
2071
|
* @throws {AppwriteException}
|
|
1108
2072
|
* @returns {Promise}
|
|
1109
|
-
|
|
1110
|
-
deletePushTarget(targetId: string): Promise<{}
|
|
2073
|
+
*/
|
|
2074
|
+
deletePushTarget(params: { targetId: string }): Promise<{}>;
|
|
2075
|
+
/**
|
|
2076
|
+
* Delete a push notification target for the currently logged in user. After deletion, the device will no longer receive push notifications. The target must exist and belong to the current user.
|
|
2077
|
+
*
|
|
2078
|
+
* @param {string} targetId - Target ID.
|
|
2079
|
+
* @throws {AppwriteException}
|
|
2080
|
+
* @returns {Promise<{}>}
|
|
2081
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2082
|
+
*/
|
|
2083
|
+
deletePushTarget(targetId: string): Promise<{}>;
|
|
2084
|
+
deletePushTarget(
|
|
2085
|
+
paramsOrFirst: { targetId: string } | string
|
|
2086
|
+
): Promise<{}> {
|
|
2087
|
+
let params: { targetId: string };
|
|
2088
|
+
|
|
2089
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2090
|
+
params = (paramsOrFirst || {}) as { targetId: string };
|
|
2091
|
+
} else {
|
|
2092
|
+
params = {
|
|
2093
|
+
targetId: paramsOrFirst as string
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
const targetId = params.targetId;
|
|
2098
|
+
|
|
1111
2099
|
if (typeof targetId === 'undefined') {
|
|
1112
2100
|
throw new AppwriteException('Missing required parameter: "targetId"');
|
|
1113
2101
|
}
|
|
@@ -1122,24 +2110,52 @@ export class Account extends Service {
|
|
|
1122
2110
|
}
|
|
1123
2111
|
|
|
1124
2112
|
/**
|
|
1125
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1129
|
-
* endpoint to complete the login process. The secret sent to the user's email
|
|
1130
|
-
* is valid for 15 minutes.
|
|
2113
|
+
* Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. 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.
|
|
2114
|
+
*
|
|
2115
|
+
* 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).
|
|
1131
2116
|
*
|
|
1132
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1133
|
-
* about session
|
|
1134
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
1135
2117
|
*
|
|
1136
|
-
* @param {string} userId
|
|
1137
|
-
* @param {string} email
|
|
1138
|
-
* @param {boolean} phrase
|
|
2118
|
+
* @param {string} params.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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
2119
|
+
* @param {string} params.email - User email.
|
|
2120
|
+
* @param {boolean} params.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.
|
|
1139
2121
|
* @throws {AppwriteException}
|
|
1140
2122
|
* @returns {Promise}
|
|
1141
|
-
|
|
1142
|
-
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token
|
|
2123
|
+
*/
|
|
2124
|
+
createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise<Models.Token>;
|
|
2125
|
+
/**
|
|
2126
|
+
* Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. 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.
|
|
2127
|
+
*
|
|
2128
|
+
* 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).
|
|
2129
|
+
*
|
|
2130
|
+
*
|
|
2131
|
+
* @param {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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
2132
|
+
* @param {string} email - User email.
|
|
2133
|
+
* @param {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.
|
|
2134
|
+
* @throws {AppwriteException}
|
|
2135
|
+
* @returns {Promise<Models.Token>}
|
|
2136
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2137
|
+
*/
|
|
2138
|
+
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
|
|
2139
|
+
createEmailToken(
|
|
2140
|
+
paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string,
|
|
2141
|
+
...rest: [(string)?, (boolean)?]
|
|
2142
|
+
): Promise<Models.Token> {
|
|
2143
|
+
let params: { userId: string, email: string, phrase?: boolean };
|
|
2144
|
+
|
|
2145
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2146
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean };
|
|
2147
|
+
} else {
|
|
2148
|
+
params = {
|
|
2149
|
+
userId: paramsOrFirst as string,
|
|
2150
|
+
email: rest[0] as string,
|
|
2151
|
+
phrase: rest[1] as boolean
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
const userId = params.userId;
|
|
2156
|
+
const email = params.email;
|
|
2157
|
+
const phrase = params.phrase;
|
|
2158
|
+
|
|
1143
2159
|
if (typeof userId === 'undefined') {
|
|
1144
2160
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1145
2161
|
}
|
|
@@ -1170,29 +2186,56 @@ export class Account extends Service {
|
|
|
1170
2186
|
}
|
|
1171
2187
|
|
|
1172
2188
|
/**
|
|
1173
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
1174
|
-
* provided user ID has not been registered, a new user will be created. When
|
|
1175
|
-
* the user clicks the link in the email, the user is redirected back to the
|
|
1176
|
-
* URL you provided with the secret key and userId values attached to the URL
|
|
1177
|
-
* query string. Use the query string parameters to submit a request to the
|
|
1178
|
-
* [POST
|
|
1179
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1180
|
-
* endpoint to complete the login process. The link sent to the user's email
|
|
1181
|
-
* address is valid for 1 hour.
|
|
2189
|
+
* 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.
|
|
1182
2190
|
*
|
|
1183
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1184
|
-
* about session
|
|
1185
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2191
|
+
* 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).
|
|
1186
2192
|
*
|
|
1187
2193
|
*
|
|
1188
|
-
* @param {string} userId
|
|
1189
|
-
* @param {string} email
|
|
1190
|
-
* @param {string} url
|
|
1191
|
-
* @param {boolean} phrase
|
|
2194
|
+
* @param {string} params.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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
2195
|
+
* @param {string} params.email - User email.
|
|
2196
|
+
* @param {string} params.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.
|
|
2197
|
+
* @param {boolean} params.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.
|
|
1192
2198
|
* @throws {AppwriteException}
|
|
1193
2199
|
* @returns {Promise}
|
|
1194
|
-
|
|
1195
|
-
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token
|
|
2200
|
+
*/
|
|
2201
|
+
createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise<Models.Token>;
|
|
2202
|
+
/**
|
|
2203
|
+
* 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.
|
|
2204
|
+
*
|
|
2205
|
+
* 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).
|
|
2206
|
+
*
|
|
2207
|
+
*
|
|
2208
|
+
* @param {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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored.
|
|
2209
|
+
* @param {string} email - User email.
|
|
2210
|
+
* @param {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.
|
|
2211
|
+
* @param {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.
|
|
2212
|
+
* @throws {AppwriteException}
|
|
2213
|
+
* @returns {Promise<Models.Token>}
|
|
2214
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2215
|
+
*/
|
|
2216
|
+
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
|
|
2217
|
+
createMagicURLToken(
|
|
2218
|
+
paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string,
|
|
2219
|
+
...rest: [(string)?, (string)?, (boolean)?]
|
|
2220
|
+
): Promise<Models.Token> {
|
|
2221
|
+
let params: { userId: string, email: string, url?: string, phrase?: boolean };
|
|
2222
|
+
|
|
2223
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2224
|
+
params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean };
|
|
2225
|
+
} else {
|
|
2226
|
+
params = {
|
|
2227
|
+
userId: paramsOrFirst as string,
|
|
2228
|
+
email: rest[0] as string,
|
|
2229
|
+
url: rest[1] as string,
|
|
2230
|
+
phrase: rest[2] as boolean
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
const userId = params.userId;
|
|
2235
|
+
const email = params.email;
|
|
2236
|
+
const url = params.url;
|
|
2237
|
+
const phrase = params.phrase;
|
|
2238
|
+
|
|
1196
2239
|
if (typeof userId === 'undefined') {
|
|
1197
2240
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1198
2241
|
}
|
|
@@ -1227,29 +2270,58 @@ export class Account extends Service {
|
|
|
1227
2270
|
}
|
|
1228
2271
|
|
|
1229
2272
|
/**
|
|
1230
|
-
* Allow the user to login to their account using the OAuth2 provider of their
|
|
1231
|
-
* choice. Each OAuth2 provider should be enabled from the Appwrite console
|
|
1232
|
-
* first. Use the success and failure arguments to provide a redirect URL's
|
|
1233
|
-
* back to your app when login is completed.
|
|
2273
|
+
* 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.
|
|
1234
2274
|
*
|
|
1235
|
-
* If authentication succeeds, `userId` and `secret` of a token will be
|
|
1236
|
-
* appended to the success URL as query parameters. These can be used to
|
|
1237
|
-
* create a new session using the [Create
|
|
1238
|
-
* session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1239
|
-
* endpoint.
|
|
2275
|
+
* 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.
|
|
1240
2276
|
*
|
|
1241
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1242
|
-
* about session
|
|
1243
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2277
|
+
* 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).
|
|
1244
2278
|
*
|
|
1245
|
-
* @param {OAuthProvider} provider
|
|
1246
|
-
* @param {string} success
|
|
1247
|
-
* @param {string} failure
|
|
1248
|
-
* @param {string[]} scopes
|
|
2279
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
2280
|
+
* @param {string} params.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.
|
|
2281
|
+
* @param {string} params.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.
|
|
2282
|
+
* @param {string[]} params.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.
|
|
1249
2283
|
* @throws {AppwriteException}
|
|
1250
2284
|
* @returns {void|string}
|
|
1251
|
-
|
|
1252
|
-
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL
|
|
2285
|
+
*/
|
|
2286
|
+
createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): void | URL;
|
|
2287
|
+
/**
|
|
2288
|
+
* 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.
|
|
2289
|
+
*
|
|
2290
|
+
* 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.
|
|
2291
|
+
*
|
|
2292
|
+
* 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).
|
|
2293
|
+
*
|
|
2294
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
2295
|
+
* @param {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.
|
|
2296
|
+
* @param {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.
|
|
2297
|
+
* @param {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.
|
|
2298
|
+
* @throws {AppwriteException}
|
|
2299
|
+
* @returns {void | URL}
|
|
2300
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2301
|
+
*/
|
|
2302
|
+
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
|
|
2303
|
+
createOAuth2Token(
|
|
2304
|
+
paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider,
|
|
2305
|
+
...rest: [(string)?, (string)?, (string[])?]
|
|
2306
|
+
): void | URL {
|
|
2307
|
+
let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
2308
|
+
|
|
2309
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
|
|
2310
|
+
params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] };
|
|
2311
|
+
} else {
|
|
2312
|
+
params = {
|
|
2313
|
+
provider: paramsOrFirst as OAuthProvider,
|
|
2314
|
+
success: rest[0] as string,
|
|
2315
|
+
failure: rest[1] as string,
|
|
2316
|
+
scopes: rest[2] as string[]
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
const provider = params.provider;
|
|
2321
|
+
const success = params.success;
|
|
2322
|
+
const failure = params.failure;
|
|
2323
|
+
const scopes = params.scopes;
|
|
2324
|
+
|
|
1253
2325
|
if (typeof provider === 'undefined') {
|
|
1254
2326
|
throw new AppwriteException('Missing required parameter: "provider"');
|
|
1255
2327
|
}
|
|
@@ -1280,23 +2352,46 @@ export class Account extends Service {
|
|
|
1280
2352
|
}
|
|
1281
2353
|
|
|
1282
2354
|
/**
|
|
1283
|
-
* Sends the user an SMS with a secret key for creating a session. If the
|
|
1284
|
-
* provided user ID has not be registered, a new user will be created. Use the
|
|
1285
|
-
* returned user ID and secret and submit a request to the [POST
|
|
1286
|
-
* /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
|
|
1287
|
-
* endpoint to complete the login process. The secret sent to the user's phone
|
|
1288
|
-
* is valid for 15 minutes.
|
|
2355
|
+
* 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.
|
|
1289
2356
|
*
|
|
1290
|
-
* A user is limited to 10 active sessions at a time by default. [Learn more
|
|
1291
|
-
* about session
|
|
1292
|
-
* limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2357
|
+
* 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).
|
|
1293
2358
|
*
|
|
1294
|
-
* @param {string} userId
|
|
1295
|
-
* @param {string} phone
|
|
2359
|
+
* @param {string} params.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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
2360
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
1296
2361
|
* @throws {AppwriteException}
|
|
1297
2362
|
* @returns {Promise}
|
|
1298
|
-
|
|
1299
|
-
createPhoneToken(userId: string, phone: string): Promise<Models.Token
|
|
2363
|
+
*/
|
|
2364
|
+
createPhoneToken(params: { userId: string, phone: string }): Promise<Models.Token>;
|
|
2365
|
+
/**
|
|
2366
|
+
* 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.
|
|
2367
|
+
*
|
|
2368
|
+
* 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).
|
|
2369
|
+
*
|
|
2370
|
+
* @param {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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
2371
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
2372
|
+
* @throws {AppwriteException}
|
|
2373
|
+
* @returns {Promise<Models.Token>}
|
|
2374
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2375
|
+
*/
|
|
2376
|
+
createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
|
|
2377
|
+
createPhoneToken(
|
|
2378
|
+
paramsOrFirst: { userId: string, phone: string } | string,
|
|
2379
|
+
...rest: [(string)?]
|
|
2380
|
+
): Promise<Models.Token> {
|
|
2381
|
+
let params: { userId: string, phone: string };
|
|
2382
|
+
|
|
2383
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2384
|
+
params = (paramsOrFirst || {}) as { userId: string, phone: string };
|
|
2385
|
+
} else {
|
|
2386
|
+
params = {
|
|
2387
|
+
userId: paramsOrFirst as string,
|
|
2388
|
+
phone: rest[0] as string
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
const userId = params.userId;
|
|
2393
|
+
const phone = params.phone;
|
|
2394
|
+
|
|
1300
2395
|
if (typeof userId === 'undefined') {
|
|
1301
2396
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1302
2397
|
}
|
|
@@ -1323,27 +2418,43 @@ export class Account extends Service {
|
|
|
1323
2418
|
}
|
|
1324
2419
|
|
|
1325
2420
|
/**
|
|
1326
|
-
* Use this endpoint to send a verification message to your user email address
|
|
1327
|
-
* to confirm they are the valid owners of that address. Both the **userId**
|
|
1328
|
-
* and **secret** arguments will be passed as query parameters to the URL you
|
|
1329
|
-
* have provided to be attached to the verification email. The provided URL
|
|
1330
|
-
* should redirect the user back to your app and allow you to complete the
|
|
1331
|
-
* verification process by verifying both the **userId** and **secret**
|
|
1332
|
-
* parameters. Learn more about how to [complete the verification
|
|
1333
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
|
|
1334
|
-
* The verification link sent to the user's email address is valid for 7 days.
|
|
2421
|
+
* 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.
|
|
1335
2422
|
*
|
|
1336
|
-
* Please note that in order to avoid a [Redirect
|
|
1337
|
-
* Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
|
|
1338
|
-
* the only valid redirect URLs are the ones from domains you have set when
|
|
1339
|
-
* adding your platforms in the console interface.
|
|
2423
|
+
* 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.
|
|
1340
2424
|
*
|
|
1341
2425
|
*
|
|
1342
|
-
* @param {string} url
|
|
2426
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification 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.
|
|
1343
2427
|
* @throws {AppwriteException}
|
|
1344
2428
|
* @returns {Promise}
|
|
1345
|
-
|
|
1346
|
-
createVerification(url: string): Promise<Models.Token
|
|
2429
|
+
*/
|
|
2430
|
+
createVerification(params: { url: string }): Promise<Models.Token>;
|
|
2431
|
+
/**
|
|
2432
|
+
* 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.
|
|
2433
|
+
*
|
|
2434
|
+
* 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.
|
|
2435
|
+
*
|
|
2436
|
+
*
|
|
2437
|
+
* @param {string} url - URL to redirect the user back to your app from the verification 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.
|
|
2438
|
+
* @throws {AppwriteException}
|
|
2439
|
+
* @returns {Promise<Models.Token>}
|
|
2440
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2441
|
+
*/
|
|
2442
|
+
createVerification(url: string): Promise<Models.Token>;
|
|
2443
|
+
createVerification(
|
|
2444
|
+
paramsOrFirst: { url: string } | string
|
|
2445
|
+
): Promise<Models.Token> {
|
|
2446
|
+
let params: { url: string };
|
|
2447
|
+
|
|
2448
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2449
|
+
params = (paramsOrFirst || {}) as { url: string };
|
|
2450
|
+
} else {
|
|
2451
|
+
params = {
|
|
2452
|
+
url: paramsOrFirst as string
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
const url = params.url;
|
|
2457
|
+
|
|
1347
2458
|
if (typeof url === 'undefined') {
|
|
1348
2459
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1349
2460
|
}
|
|
@@ -1362,17 +2473,42 @@ export class Account extends Service {
|
|
|
1362
2473
|
}
|
|
1363
2474
|
|
|
1364
2475
|
/**
|
|
1365
|
-
* Use this endpoint to complete the user email verification process. Use both
|
|
1366
|
-
* the **userId** and **secret** parameters that were attached to your app URL
|
|
1367
|
-
* to verify the user email ownership. If confirmed this route will return a
|
|
1368
|
-
* 200 status code.
|
|
2476
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1369
2477
|
*
|
|
1370
|
-
* @param {string} userId
|
|
1371
|
-
* @param {string} secret
|
|
2478
|
+
* @param {string} params.userId - User ID.
|
|
2479
|
+
* @param {string} params.secret - Valid verification token.
|
|
1372
2480
|
* @throws {AppwriteException}
|
|
1373
2481
|
* @returns {Promise}
|
|
1374
|
-
|
|
1375
|
-
updateVerification(userId: string, secret: string): Promise<Models.Token
|
|
2482
|
+
*/
|
|
2483
|
+
updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
2484
|
+
/**
|
|
2485
|
+
* Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
2486
|
+
*
|
|
2487
|
+
* @param {string} userId - User ID.
|
|
2488
|
+
* @param {string} secret - Valid verification token.
|
|
2489
|
+
* @throws {AppwriteException}
|
|
2490
|
+
* @returns {Promise<Models.Token>}
|
|
2491
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2492
|
+
*/
|
|
2493
|
+
updateVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
2494
|
+
updateVerification(
|
|
2495
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2496
|
+
...rest: [(string)?]
|
|
2497
|
+
): Promise<Models.Token> {
|
|
2498
|
+
let params: { userId: string, secret: string };
|
|
2499
|
+
|
|
2500
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2501
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2502
|
+
} else {
|
|
2503
|
+
params = {
|
|
2504
|
+
userId: paramsOrFirst as string,
|
|
2505
|
+
secret: rest[0] as string
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
const userId = params.userId;
|
|
2510
|
+
const secret = params.secret;
|
|
2511
|
+
|
|
1376
2512
|
if (typeof userId === 'undefined') {
|
|
1377
2513
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1378
2514
|
}
|
|
@@ -1399,18 +2535,11 @@ export class Account extends Service {
|
|
|
1399
2535
|
}
|
|
1400
2536
|
|
|
1401
2537
|
/**
|
|
1402
|
-
* Use this endpoint to send a verification SMS to the currently logged in
|
|
1403
|
-
* user. This endpoint is meant for use after updating a user's phone number
|
|
1404
|
-
* using the
|
|
1405
|
-
* [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
|
|
1406
|
-
* endpoint. Learn more about how to [complete the verification
|
|
1407
|
-
* process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
|
|
1408
|
-
* The verification code sent to the user's phone number is valid for 15
|
|
1409
|
-
* minutes.
|
|
2538
|
+
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
|
1410
2539
|
*
|
|
1411
2540
|
* @throws {AppwriteException}
|
|
1412
2541
|
* @returns {Promise}
|
|
1413
|
-
|
|
2542
|
+
*/
|
|
1414
2543
|
createPhoneVerification(): Promise<Models.Token> {
|
|
1415
2544
|
const apiPath = '/account/verification/phone';
|
|
1416
2545
|
const payload: Payload = {};
|
|
@@ -1422,17 +2551,42 @@ export class Account extends Service {
|
|
|
1422
2551
|
}
|
|
1423
2552
|
|
|
1424
2553
|
/**
|
|
1425
|
-
* Use this endpoint to complete the user phone verification process. Use the
|
|
1426
|
-
* **userId** and **secret** that were sent to your user's phone number to
|
|
1427
|
-
* verify the user email ownership. If confirmed this route will return a 200
|
|
1428
|
-
* status code.
|
|
2554
|
+
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
1429
2555
|
*
|
|
1430
|
-
* @param {string} userId
|
|
1431
|
-
* @param {string} secret
|
|
2556
|
+
* @param {string} params.userId - User ID.
|
|
2557
|
+
* @param {string} params.secret - Valid verification token.
|
|
1432
2558
|
* @throws {AppwriteException}
|
|
1433
2559
|
* @returns {Promise}
|
|
1434
|
-
|
|
1435
|
-
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token
|
|
2560
|
+
*/
|
|
2561
|
+
updatePhoneVerification(params: { userId: string, secret: string }): Promise<Models.Token>;
|
|
2562
|
+
/**
|
|
2563
|
+
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
|
|
2564
|
+
*
|
|
2565
|
+
* @param {string} userId - User ID.
|
|
2566
|
+
* @param {string} secret - Valid verification token.
|
|
2567
|
+
* @throws {AppwriteException}
|
|
2568
|
+
* @returns {Promise<Models.Token>}
|
|
2569
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
2570
|
+
*/
|
|
2571
|
+
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
2572
|
+
updatePhoneVerification(
|
|
2573
|
+
paramsOrFirst: { userId: string, secret: string } | string,
|
|
2574
|
+
...rest: [(string)?]
|
|
2575
|
+
): Promise<Models.Token> {
|
|
2576
|
+
let params: { userId: string, secret: string };
|
|
2577
|
+
|
|
2578
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2579
|
+
params = (paramsOrFirst || {}) as { userId: string, secret: string };
|
|
2580
|
+
} else {
|
|
2581
|
+
params = {
|
|
2582
|
+
userId: paramsOrFirst as string,
|
|
2583
|
+
secret: rest[0] as string
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
const userId = params.userId;
|
|
2588
|
+
const secret = params.secret;
|
|
2589
|
+
|
|
1436
2590
|
if (typeof userId === 'undefined') {
|
|
1437
2591
|
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1438
2592
|
}
|