react-native-appwrite 0.11.0 → 0.13.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.
Files changed (129) hide show
  1. package/README.md +84 -3
  2. package/dist/cjs/sdk.js +1854 -1121
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +1854 -1122
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-password-session.md +4 -4
  7. package/docs/examples/account/create-email-token.md +5 -5
  8. package/docs/examples/account/{create-magic-u-r-l-token.md → create-magic-url-token.md} +6 -6
  9. package/docs/examples/account/create-mfa-authenticator.md +3 -3
  10. package/docs/examples/account/create-mfa-challenge.md +3 -3
  11. package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
  12. package/docs/examples/account/{create-o-auth2token.md → create-o-auth-2-session.md} +6 -6
  13. package/docs/examples/account/{create-o-auth2session.md → create-o-auth-2-token.md} +6 -6
  14. package/docs/examples/account/create-phone-token.md +4 -4
  15. package/docs/examples/account/create-push-target.md +5 -5
  16. package/docs/examples/account/create-recovery.md +4 -4
  17. package/docs/examples/account/create-session.md +4 -4
  18. package/docs/examples/account/create-verification.md +3 -3
  19. package/docs/examples/account/create.md +6 -6
  20. package/docs/examples/account/delete-identity.md +3 -3
  21. package/docs/examples/account/delete-mfa-authenticator.md +3 -3
  22. package/docs/examples/account/delete-push-target.md +3 -3
  23. package/docs/examples/account/delete-session.md +3 -3
  24. package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
  25. package/docs/examples/account/get-session.md +3 -3
  26. package/docs/examples/account/list-identities.md +3 -3
  27. package/docs/examples/account/list-logs.md +3 -3
  28. package/docs/examples/account/list-mfa-factors.md +1 -1
  29. package/docs/examples/account/update-email.md +4 -4
  30. package/docs/examples/account/{update-magic-u-r-l-session.md → update-magic-url-session.md} +4 -4
  31. package/docs/examples/account/update-mfa-authenticator.md +4 -4
  32. package/docs/examples/account/update-mfa-challenge.md +4 -4
  33. package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
  34. package/docs/examples/account/{update-m-f-a.md → update-mfa.md} +3 -3
  35. package/docs/examples/account/update-name.md +3 -3
  36. package/docs/examples/account/update-password.md +4 -4
  37. package/docs/examples/account/update-phone-session.md +4 -4
  38. package/docs/examples/account/update-phone-verification.md +4 -4
  39. package/docs/examples/account/update-phone.md +4 -4
  40. package/docs/examples/account/update-prefs.md +7 -3
  41. package/docs/examples/account/update-push-target.md +4 -4
  42. package/docs/examples/account/update-recovery.md +5 -5
  43. package/docs/examples/account/update-session.md +3 -3
  44. package/docs/examples/account/update-verification.md +4 -4
  45. package/docs/examples/avatars/get-browser.md +6 -6
  46. package/docs/examples/avatars/get-credit-card.md +6 -6
  47. package/docs/examples/avatars/get-favicon.md +3 -3
  48. package/docs/examples/avatars/get-flag.md +6 -6
  49. package/docs/examples/avatars/get-image.md +5 -5
  50. package/docs/examples/avatars/get-initials.md +6 -6
  51. package/docs/examples/avatars/{get-q-r.md → get-qr.md} +6 -6
  52. package/docs/examples/databases/create-document.md +13 -7
  53. package/docs/examples/databases/decrement-document-attribute.md +8 -8
  54. package/docs/examples/databases/delete-document.md +5 -5
  55. package/docs/examples/databases/get-document.md +6 -6
  56. package/docs/examples/databases/increment-document-attribute.md +8 -8
  57. package/docs/examples/databases/list-documents.md +5 -5
  58. package/docs/examples/databases/update-document.md +7 -7
  59. package/docs/examples/databases/upsert-document.md +7 -7
  60. package/docs/examples/functions/create-execution.md +9 -9
  61. package/docs/examples/functions/get-execution.md +4 -4
  62. package/docs/examples/functions/list-executions.md +4 -4
  63. package/docs/examples/graphql/mutation.md +3 -3
  64. package/docs/examples/graphql/query.md +3 -3
  65. package/docs/examples/messaging/create-subscriber.md +5 -5
  66. package/docs/examples/messaging/delete-subscriber.md +4 -4
  67. package/docs/examples/storage/create-file.md +6 -6
  68. package/docs/examples/storage/delete-file.md +4 -4
  69. package/docs/examples/storage/get-file-download.md +5 -5
  70. package/docs/examples/storage/get-file-preview.md +16 -16
  71. package/docs/examples/storage/get-file-view.md +5 -5
  72. package/docs/examples/storage/get-file.md +4 -4
  73. package/docs/examples/storage/list-files.md +5 -5
  74. package/docs/examples/storage/update-file.md +6 -6
  75. package/docs/examples/tablesdb/create-row.md +23 -0
  76. package/docs/examples/tablesdb/decrement-row-column.md +18 -0
  77. package/docs/examples/tablesdb/delete-row.md +15 -0
  78. package/docs/examples/tablesdb/get-row.md +16 -0
  79. package/docs/examples/tablesdb/increment-row-column.md +18 -0
  80. package/docs/examples/tablesdb/list-rows.md +15 -0
  81. package/docs/examples/tablesdb/update-row.md +17 -0
  82. package/docs/examples/tablesdb/upsert-row.md +17 -0
  83. package/docs/examples/teams/create-membership.md +9 -9
  84. package/docs/examples/teams/create.md +5 -5
  85. package/docs/examples/teams/delete-membership.md +4 -4
  86. package/docs/examples/teams/delete.md +3 -3
  87. package/docs/examples/teams/get-membership.md +4 -4
  88. package/docs/examples/teams/get-prefs.md +3 -3
  89. package/docs/examples/teams/get.md +3 -3
  90. package/docs/examples/teams/list-memberships.md +5 -5
  91. package/docs/examples/teams/list.md +4 -4
  92. package/docs/examples/teams/update-membership-status.md +6 -6
  93. package/docs/examples/teams/update-membership.md +5 -5
  94. package/docs/examples/teams/update-name.md +4 -4
  95. package/docs/examples/teams/update-prefs.md +4 -4
  96. package/package.json +1 -1
  97. package/src/client.ts +2 -2
  98. package/src/enums/credit-card.ts +1 -1
  99. package/src/enums/execution-method.ts +1 -0
  100. package/src/index.ts +1 -0
  101. package/src/models.ts +72 -27
  102. package/src/query.ts +247 -4
  103. package/src/services/account.ts +1469 -315
  104. package/src/services/avatars.ts +289 -80
  105. package/src/services/databases.ts +345 -63
  106. package/src/services/functions.ts +115 -20
  107. package/src/services/graphql.ts +52 -4
  108. package/src/services/locale.ts +8 -19
  109. package/src/services/messaging.ts +66 -7
  110. package/src/services/storage.ts +345 -76
  111. package/src/services/tables-db.ts +621 -0
  112. package/src/services/teams.ts +454 -93
  113. package/types/enums/credit-card.d.ts +1 -1
  114. package/types/enums/execution-method.d.ts +2 -1
  115. package/types/index.d.ts +1 -0
  116. package/types/models.d.ts +69 -25
  117. package/types/query.d.ts +201 -4
  118. package/types/services/account.d.ts +734 -280
  119. package/types/services/avatars.d.ts +168 -73
  120. package/types/services/databases.d.ts +199 -58
  121. package/types/services/functions.d.ts +62 -17
  122. package/types/services/graphql.d.ts +24 -2
  123. package/types/services/locale.d.ts +8 -19
  124. package/types/services/messaging.d.ts +33 -5
  125. package/types/services/storage.d.ts +201 -68
  126. package/types/services/tables-db.d.ts +245 -0
  127. package/types/services/teams.d.ts +242 -80
  128. /package/docs/examples/account/{create-j-w-t.md → create-jwt.md} +0 -0
  129. /package/docs/examples/locale/{list-countries-e-u.md → list-countries-eu.md} +0 -0
@@ -14,204 +14,471 @@ export declare class Account extends Service {
14
14
  */
15
15
  get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>>;
16
16
  /**
17
- * Use this endpoint to allow a new user to register a new account in your
18
- * project. After the user registration completes successfully, you can use
19
- * the
20
- * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
21
- * route to start verifying the user email address. To allow the new user to
22
- * login to their new account, you need to create a new [account
23
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
17
+ * 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).
24
18
  *
25
- * @param {string} userId
26
- * @param {string} email
27
- * @param {string} password
28
- * @param {string} name
19
+ * @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.
20
+ * @param {string} params.email - User email.
21
+ * @param {string} params.password - New user password. Must be between 8 and 256 chars.
22
+ * @param {string} params.name - User name. Max length: 128 chars.
29
23
  * @throws {AppwriteException}
30
24
  * @returns {Promise}
31
25
  */
26
+ create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
27
+ userId: string;
28
+ email: string;
29
+ password: string;
30
+ name?: string;
31
+ }): Promise<Models.User<Preferences>>;
32
+ /**
33
+ * 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).
34
+ *
35
+ * @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.
36
+ * @param {string} email - User email.
37
+ * @param {string} password - New user password. Must be between 8 and 256 chars.
38
+ * @param {string} name - User name. Max length: 128 chars.
39
+ * @throws {AppwriteException}
40
+ * @returns {Promise<Models.User<Preferences>>}
41
+ * @deprecated Use the object parameter style method for a better developer experience.
42
+ */
32
43
  create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
33
44
  /**
34
- * Update currently logged in user account email address. After changing user
35
- * address, the user confirmation status will get reset. A new confirmation
36
- * email is not sent automatically however you can use the send confirmation
37
- * email endpoint again to send the confirmation email. For security measures,
38
- * user password is required to complete this request.
39
- * This endpoint can also be used to convert an anonymous account to a normal
40
- * one, by passing an email address and a new password.
45
+ * 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.
46
+ * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
41
47
  *
42
48
  *
43
- * @param {string} email
44
- * @param {string} password
49
+ * @param {string} params.email - User email.
50
+ * @param {string} params.password - User password. Must be at least 8 chars.
45
51
  * @throws {AppwriteException}
46
52
  * @returns {Promise}
47
53
  */
54
+ updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
55
+ email: string;
56
+ password: string;
57
+ }): Promise<Models.User<Preferences>>;
58
+ /**
59
+ * 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.
60
+ * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
61
+ *
62
+ *
63
+ * @param {string} email - User email.
64
+ * @param {string} password - User password. Must be at least 8 chars.
65
+ * @throws {AppwriteException}
66
+ * @returns {Promise<Models.User<Preferences>>}
67
+ * @deprecated Use the object parameter style method for a better developer experience.
68
+ */
48
69
  updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>;
49
70
  /**
50
71
  * Get the list of identities for the currently logged in user.
51
72
  *
52
- * @param {string[]} queries
73
+ * @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
53
74
  * @throws {AppwriteException}
54
75
  * @returns {Promise}
55
76
  */
77
+ listIdentities(params?: {
78
+ queries?: string[];
79
+ }): Promise<Models.IdentityList>;
80
+ /**
81
+ * Get the list of identities for the currently logged in user.
82
+ *
83
+ * @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
84
+ * @throws {AppwriteException}
85
+ * @returns {Promise<Models.IdentityList>}
86
+ * @deprecated Use the object parameter style method for a better developer experience.
87
+ */
56
88
  listIdentities(queries?: string[]): Promise<Models.IdentityList>;
57
89
  /**
58
90
  * Delete an identity by its unique ID.
59
91
  *
60
- * @param {string} identityId
92
+ * @param {string} params.identityId - Identity ID.
61
93
  * @throws {AppwriteException}
62
94
  * @returns {Promise}
63
95
  */
96
+ deleteIdentity(params: {
97
+ identityId: string;
98
+ }): Promise<{}>;
99
+ /**
100
+ * Delete an identity by its unique ID.
101
+ *
102
+ * @param {string} identityId - Identity ID.
103
+ * @throws {AppwriteException}
104
+ * @returns {Promise<{}>}
105
+ * @deprecated Use the object parameter style method for a better developer experience.
106
+ */
64
107
  deleteIdentity(identityId: string): Promise<{}>;
65
108
  /**
66
- * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
67
- * to authenticate on behalf of the current user when working with the
68
- * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
69
- * from its creation and will be invalid if the user will logout in that time
70
- * frame.
109
+ * 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.
71
110
  *
72
111
  * @throws {AppwriteException}
73
112
  * @returns {Promise}
74
113
  */
75
114
  createJWT(): Promise<Models.Jwt>;
76
115
  /**
77
- * Get the list of latest security activity logs for the currently logged in
78
- * user. Each log returns user IP address, location and date and time of log.
116
+ * 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.
79
117
  *
80
- * @param {string[]} queries
118
+ * @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
81
119
  * @throws {AppwriteException}
82
120
  * @returns {Promise}
83
121
  */
122
+ listLogs(params?: {
123
+ queries?: string[];
124
+ }): Promise<Models.LogList>;
125
+ /**
126
+ * 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.
127
+ *
128
+ * @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
129
+ * @throws {AppwriteException}
130
+ * @returns {Promise<Models.LogList>}
131
+ * @deprecated Use the object parameter style method for a better developer experience.
132
+ */
84
133
  listLogs(queries?: string[]): Promise<Models.LogList>;
85
134
  /**
86
135
  * Enable or disable MFA on an account.
87
136
  *
88
- * @param {boolean} mfa
137
+ * @param {boolean} params.mfa - Enable or disable MFA.
89
138
  * @throws {AppwriteException}
90
139
  * @returns {Promise}
91
140
  */
141
+ updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
142
+ mfa: boolean;
143
+ }): Promise<Models.User<Preferences>>;
144
+ /**
145
+ * Enable or disable MFA on an account.
146
+ *
147
+ * @param {boolean} mfa - Enable or disable MFA.
148
+ * @throws {AppwriteException}
149
+ * @returns {Promise<Models.User<Preferences>>}
150
+ * @deprecated Use the object parameter style method for a better developer experience.
151
+ */
92
152
  updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>;
93
153
  /**
94
- * Add an authenticator app to be used as an MFA factor. Verify the
95
- * authenticator using the [verify
96
- * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
97
- * method.
154
+ * 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.
98
155
  *
99
- * @param {AuthenticatorType} type
156
+ * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
100
157
  * @throws {AppwriteException}
101
158
  * @returns {Promise}
159
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.
160
+ */
161
+ createMfaAuthenticator(params: {
162
+ type: AuthenticatorType;
163
+ }): Promise<Models.MfaType>;
164
+ /**
165
+ * 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.
166
+ *
167
+ * @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
168
+ * @throws {AppwriteException}
169
+ * @returns {Promise<Models.MfaType>}
170
+ * @deprecated Use the object parameter style method for a better developer experience.
102
171
  */
103
172
  createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
104
173
  /**
105
- * Verify an authenticator app after adding it using the [add
106
- * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
107
- * method.
174
+ * 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.
108
175
  *
109
- * @param {AuthenticatorType} type
110
- * @param {string} otp
176
+ * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
111
177
  * @throws {AppwriteException}
112
178
  * @returns {Promise}
113
179
  */
180
+ createMFAAuthenticator(params: {
181
+ type: AuthenticatorType;
182
+ }): Promise<Models.MfaType>;
183
+ /**
184
+ * 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.
185
+ *
186
+ * @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
187
+ * @throws {AppwriteException}
188
+ * @returns {Promise<Models.MfaType>}
189
+ * @deprecated Use the object parameter style method for a better developer experience.
190
+ */
191
+ createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
192
+ /**
193
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
194
+ *
195
+ * @param {AuthenticatorType} params.type - Type of authenticator.
196
+ * @param {string} params.otp - Valid verification token.
197
+ * @throws {AppwriteException}
198
+ * @returns {Promise}
199
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.
200
+ */
201
+ updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
202
+ type: AuthenticatorType;
203
+ otp: string;
204
+ }): Promise<Models.User<Preferences>>;
205
+ /**
206
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
207
+ *
208
+ * @param {AuthenticatorType} type - Type of authenticator.
209
+ * @param {string} otp - Valid verification token.
210
+ * @throws {AppwriteException}
211
+ * @returns {Promise<Models.User<Preferences>>}
212
+ * @deprecated Use the object parameter style method for a better developer experience.
213
+ */
114
214
  updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
215
+ /**
216
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
217
+ *
218
+ * @param {AuthenticatorType} params.type - Type of authenticator.
219
+ * @param {string} params.otp - Valid verification token.
220
+ * @throws {AppwriteException}
221
+ * @returns {Promise}
222
+ */
223
+ updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
224
+ type: AuthenticatorType;
225
+ otp: string;
226
+ }): Promise<Models.User<Preferences>>;
227
+ /**
228
+ * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
229
+ *
230
+ * @param {AuthenticatorType} type - Type of authenticator.
231
+ * @param {string} otp - Valid verification token.
232
+ * @throws {AppwriteException}
233
+ * @returns {Promise<Models.User<Preferences>>}
234
+ * @deprecated Use the object parameter style method for a better developer experience.
235
+ */
236
+ updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
115
237
  /**
116
238
  * Delete an authenticator for a user by ID.
117
239
  *
118
- * @param {AuthenticatorType} type
240
+ * @param {AuthenticatorType} params.type - Type of authenticator.
119
241
  * @throws {AppwriteException}
120
242
  * @returns {Promise}
243
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.
244
+ */
245
+ deleteMfaAuthenticator(params: {
246
+ type: AuthenticatorType;
247
+ }): Promise<{}>;
248
+ /**
249
+ * Delete an authenticator for a user by ID.
250
+ *
251
+ * @param {AuthenticatorType} type - Type of authenticator.
252
+ * @throws {AppwriteException}
253
+ * @returns {Promise<{}>}
254
+ * @deprecated Use the object parameter style method for a better developer experience.
121
255
  */
122
256
  deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
123
257
  /**
124
- * Begin the process of MFA verification after sign-in. Finish the flow with
125
- * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
126
- * method.
258
+ * Delete an authenticator for a user by ID.
127
259
  *
128
- * @param {AuthenticationFactor} factor
260
+ * @param {AuthenticatorType} params.type - Type of authenticator.
129
261
  * @throws {AppwriteException}
130
262
  * @returns {Promise}
131
263
  */
264
+ deleteMFAAuthenticator(params: {
265
+ type: AuthenticatorType;
266
+ }): Promise<{}>;
267
+ /**
268
+ * Delete an authenticator for a user by ID.
269
+ *
270
+ * @param {AuthenticatorType} type - Type of authenticator.
271
+ * @throws {AppwriteException}
272
+ * @returns {Promise<{}>}
273
+ * @deprecated Use the object parameter style method for a better developer experience.
274
+ */
275
+ deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>;
276
+ /**
277
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
278
+ *
279
+ * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
280
+ * @throws {AppwriteException}
281
+ * @returns {Promise}
282
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.
283
+ */
284
+ createMfaChallenge(params: {
285
+ factor: AuthenticationFactor;
286
+ }): Promise<Models.MfaChallenge>;
287
+ /**
288
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
289
+ *
290
+ * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
291
+ * @throws {AppwriteException}
292
+ * @returns {Promise<Models.MfaChallenge>}
293
+ * @deprecated Use the object parameter style method for a better developer experience.
294
+ */
132
295
  createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
133
296
  /**
134
- * Complete the MFA challenge by providing the one-time password. Finish the
135
- * process of MFA verification by providing the one-time password. To begin
136
- * the flow, use
137
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
138
- * method.
297
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
298
+ *
299
+ * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
300
+ * @throws {AppwriteException}
301
+ * @returns {Promise}
302
+ */
303
+ createMFAChallenge(params: {
304
+ factor: AuthenticationFactor;
305
+ }): Promise<Models.MfaChallenge>;
306
+ /**
307
+ * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
308
+ *
309
+ * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
310
+ * @throws {AppwriteException}
311
+ * @returns {Promise<Models.MfaChallenge>}
312
+ * @deprecated Use the object parameter style method for a better developer experience.
313
+ */
314
+ createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
315
+ /**
316
+ * 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.
139
317
  *
140
- * @param {string} challengeId
141
- * @param {string} otp
318
+ * @param {string} params.challengeId - ID of the challenge.
319
+ * @param {string} params.otp - Valid verification token.
142
320
  * @throws {AppwriteException}
143
321
  * @returns {Promise}
322
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.
323
+ */
324
+ updateMfaChallenge(params: {
325
+ challengeId: string;
326
+ otp: string;
327
+ }): Promise<Models.Session>;
328
+ /**
329
+ * 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.
330
+ *
331
+ * @param {string} challengeId - ID of the challenge.
332
+ * @param {string} otp - Valid verification token.
333
+ * @throws {AppwriteException}
334
+ * @returns {Promise<Models.Session>}
335
+ * @deprecated Use the object parameter style method for a better developer experience.
144
336
  */
145
337
  updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
338
+ /**
339
+ * 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.
340
+ *
341
+ * @param {string} params.challengeId - ID of the challenge.
342
+ * @param {string} params.otp - Valid verification token.
343
+ * @throws {AppwriteException}
344
+ * @returns {Promise}
345
+ */
346
+ updateMFAChallenge(params: {
347
+ challengeId: string;
348
+ otp: string;
349
+ }): Promise<Models.Session>;
350
+ /**
351
+ * 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.
352
+ *
353
+ * @param {string} challengeId - ID of the challenge.
354
+ * @param {string} otp - Valid verification token.
355
+ * @throws {AppwriteException}
356
+ * @returns {Promise<Models.Session>}
357
+ * @deprecated Use the object parameter style method for a better developer experience.
358
+ */
359
+ updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>;
146
360
  /**
147
361
  * List the factors available on the account to be used as a MFA challange.
148
362
  *
149
363
  * @throws {AppwriteException}
150
364
  * @returns {Promise}
365
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
151
366
  */
152
367
  listMfaFactors(): Promise<Models.MfaFactors>;
153
368
  /**
154
- * Get recovery codes that can be used as backup for MFA flow. Before getting
155
- * codes, they must be generated using
156
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
157
- * method. An OTP challenge is required to read recovery codes.
369
+ * List the factors available on the account to be used as a MFA challange.
370
+ *
371
+ * @throws {AppwriteException}
372
+ * @returns {Promise}
373
+ */
374
+ listMFAFactors(): Promise<Models.MfaFactors>;
375
+ /**
376
+ * 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.
158
377
  *
159
378
  * @throws {AppwriteException}
160
379
  * @returns {Promise}
380
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
161
381
  */
162
382
  getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
163
383
  /**
164
- * Generate recovery codes as backup for MFA flow. It's recommended to
165
- * generate and show then immediately after user successfully adds their
166
- * authehticator. Recovery codes can be used as a MFA verification type in
167
- * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
168
- * method.
384
+ * 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.
169
385
  *
170
386
  * @throws {AppwriteException}
171
387
  * @returns {Promise}
172
388
  */
389
+ getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
390
+ /**
391
+ * 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.
392
+ *
393
+ * @throws {AppwriteException}
394
+ * @returns {Promise}
395
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
396
+ */
173
397
  createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
174
398
  /**
175
- * Regenerate recovery codes that can be used as backup for MFA flow. Before
176
- * regenerating codes, they must be first generated using
177
- * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
178
- * method. An OTP challenge is required to regenreate recovery codes.
399
+ * 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.
400
+ *
401
+ * @throws {AppwriteException}
402
+ * @returns {Promise}
403
+ */
404
+ createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
405
+ /**
406
+ * 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.
179
407
  *
180
408
  * @throws {AppwriteException}
181
409
  * @returns {Promise}
410
+ * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
182
411
  */
183
412
  updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
413
+ /**
414
+ * 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.
415
+ *
416
+ * @throws {AppwriteException}
417
+ * @returns {Promise}
418
+ */
419
+ updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
184
420
  /**
185
421
  * Update currently logged in user account name.
186
422
  *
187
- * @param {string} name
423
+ * @param {string} params.name - User name. Max length: 128 chars.
188
424
  * @throws {AppwriteException}
189
425
  * @returns {Promise}
190
426
  */
427
+ updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
428
+ name: string;
429
+ }): Promise<Models.User<Preferences>>;
430
+ /**
431
+ * Update currently logged in user account name.
432
+ *
433
+ * @param {string} name - User name. Max length: 128 chars.
434
+ * @throws {AppwriteException}
435
+ * @returns {Promise<Models.User<Preferences>>}
436
+ * @deprecated Use the object parameter style method for a better developer experience.
437
+ */
191
438
  updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>;
192
439
  /**
193
- * Update currently logged in user password. For validation, user is required
194
- * to pass in the new password, and the old password. For users created with
195
- * OAuth, Team Invites and Magic URL, oldPassword is optional.
440
+ * 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.
196
441
  *
197
- * @param {string} password
198
- * @param {string} oldPassword
442
+ * @param {string} params.password - New user password. Must be at least 8 chars.
443
+ * @param {string} params.oldPassword - Current user password. Must be at least 8 chars.
199
444
  * @throws {AppwriteException}
200
445
  * @returns {Promise}
201
446
  */
447
+ updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
448
+ password: string;
449
+ oldPassword?: string;
450
+ }): Promise<Models.User<Preferences>>;
451
+ /**
452
+ * 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.
453
+ *
454
+ * @param {string} password - New user password. Must be at least 8 chars.
455
+ * @param {string} oldPassword - Current user password. Must be at least 8 chars.
456
+ * @throws {AppwriteException}
457
+ * @returns {Promise<Models.User<Preferences>>}
458
+ * @deprecated Use the object parameter style method for a better developer experience.
459
+ */
202
460
  updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
203
461
  /**
204
- * Update the currently logged in user's phone number. After updating the
205
- * phone number, the phone verification status will be reset. A confirmation
206
- * SMS is not sent automatically, however you can use the [POST
207
- * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
208
- * endpoint to send a confirmation SMS.
462
+ * 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.
209
463
  *
210
- * @param {string} phone
211
- * @param {string} password
464
+ * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
465
+ * @param {string} params.password - User password. Must be at least 8 chars.
212
466
  * @throws {AppwriteException}
213
467
  * @returns {Promise}
214
468
  */
469
+ updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
470
+ phone: string;
471
+ password: string;
472
+ }): Promise<Models.User<Preferences>>;
473
+ /**
474
+ * 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.
475
+ *
476
+ * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
477
+ * @param {string} password - User password. Must be at least 8 chars.
478
+ * @throws {AppwriteException}
479
+ * @returns {Promise<Models.User<Preferences>>}
480
+ * @deprecated Use the object parameter style method for a better developer experience.
481
+ */
215
482
  updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
216
483
  /**
217
484
  * Get the preferences as a key-value object for the currently logged in user.
@@ -221,372 +488,559 @@ export declare class Account extends Service {
221
488
  */
222
489
  getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences>;
223
490
  /**
224
- * Update currently logged in user account preferences. The object you pass is
225
- * stored as is, and replaces any previous value. The maximum allowed prefs
226
- * size is 64kB and throws error if exceeded.
491
+ * 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.
227
492
  *
228
- * @param {object} prefs
493
+ * @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object.
229
494
  * @throws {AppwriteException}
230
495
  * @returns {Promise}
231
496
  */
232
- updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: object): Promise<Models.User<Preferences>>;
497
+ updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
498
+ prefs: Partial<Preferences>;
499
+ }): Promise<Models.User<Preferences>>;
233
500
  /**
234
- * Sends the user an email with a temporary secret key for password reset.
235
- * When the user clicks the confirmation link he is redirected back to your
236
- * app password reset URL with the secret key and email address values
237
- * attached to the URL query string. Use the query string params to submit a
238
- * request to the [PUT
239
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
240
- * endpoint to complete the process. The verification link sent to the user's
241
- * email address is valid for 1 hour.
501
+ * 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.
242
502
  *
243
- * @param {string} email
244
- * @param {string} url
503
+ * @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
504
+ * @throws {AppwriteException}
505
+ * @returns {Promise<Models.User<Preferences>>}
506
+ * @deprecated Use the object parameter style method for a better developer experience.
507
+ */
508
+ updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
509
+ /**
510
+ * 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.
511
+ *
512
+ * @param {string} params.email - User email.
513
+ * @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.
245
514
  * @throws {AppwriteException}
246
515
  * @returns {Promise}
247
516
  */
517
+ createRecovery(params: {
518
+ email: string;
519
+ url: string;
520
+ }): Promise<Models.Token>;
521
+ /**
522
+ * 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.
523
+ *
524
+ * @param {string} email - User email.
525
+ * @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.
526
+ * @throws {AppwriteException}
527
+ * @returns {Promise<Models.Token>}
528
+ * @deprecated Use the object parameter style method for a better developer experience.
529
+ */
248
530
  createRecovery(email: string, url: string): Promise<Models.Token>;
249
531
  /**
250
- * Use this endpoint to complete the user account password reset. Both the
251
- * **userId** and **secret** arguments will be passed as query parameters to
252
- * the redirect URL you have provided when sending your request to the [POST
253
- * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
254
- * endpoint.
532
+ * 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.
255
533
  *
256
- * Please note that in order to avoid a [Redirect
257
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
258
- * the only valid redirect URLs are the ones from domains you have set when
259
- * adding your platforms in the console interface.
534
+ * 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.
260
535
  *
261
- * @param {string} userId
262
- * @param {string} secret
263
- * @param {string} password
536
+ * @param {string} params.userId - User ID.
537
+ * @param {string} params.secret - Valid reset token.
538
+ * @param {string} params.password - New user password. Must be between 8 and 256 chars.
264
539
  * @throws {AppwriteException}
265
540
  * @returns {Promise}
266
541
  */
542
+ updateRecovery(params: {
543
+ userId: string;
544
+ secret: string;
545
+ password: string;
546
+ }): Promise<Models.Token>;
547
+ /**
548
+ * 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.
549
+ *
550
+ * 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.
551
+ *
552
+ * @param {string} userId - User ID.
553
+ * @param {string} secret - Valid reset token.
554
+ * @param {string} password - New user password. Must be between 8 and 256 chars.
555
+ * @throws {AppwriteException}
556
+ * @returns {Promise<Models.Token>}
557
+ * @deprecated Use the object parameter style method for a better developer experience.
558
+ */
267
559
  updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
268
560
  /**
269
- * Get the list of active sessions across different devices for the currently
270
- * logged in user.
561
+ * Get the list of active sessions across different devices for the currently logged in user.
271
562
  *
272
563
  * @throws {AppwriteException}
273
564
  * @returns {Promise}
274
565
  */
275
566
  listSessions(): Promise<Models.SessionList>;
276
567
  /**
277
- * Delete all sessions from the user account and remove any sessions cookies
278
- * from the end client.
568
+ * Delete all sessions from the user account and remove any sessions cookies from the end client.
279
569
  *
280
570
  * @throws {AppwriteException}
281
571
  * @returns {Promise}
282
572
  */
283
573
  deleteSessions(): Promise<{}>;
284
574
  /**
285
- * Use this endpoint to allow a new user to register an anonymous account in
286
- * your project. This route will also create a new session for the user. To
287
- * allow the new user to convert an anonymous account to a normal account, you
288
- * need to update its [email and
289
- * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
290
- * or create an [OAuth2
291
- * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
575
+ * 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).
292
576
  *
293
577
  * @throws {AppwriteException}
294
578
  * @returns {Promise}
295
579
  */
296
580
  createAnonymousSession(): Promise<Models.Session>;
297
581
  /**
298
- * Allow the user to login into their account by providing a valid email and
299
- * password combination. This route will create a new session for the user.
582
+ * 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.
300
583
  *
301
- * A user is limited to 10 active sessions at a time by default. [Learn more
302
- * about session
303
- * limits](https://appwrite.io/docs/authentication-security#limits).
584
+ * 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).
304
585
  *
305
- * @param {string} email
306
- * @param {string} password
586
+ * @param {string} params.email - User email.
587
+ * @param {string} params.password - User password. Must be at least 8 chars.
307
588
  * @throws {AppwriteException}
308
589
  * @returns {Promise}
309
590
  */
591
+ createEmailPasswordSession(params: {
592
+ email: string;
593
+ password: string;
594
+ }): Promise<Models.Session>;
595
+ /**
596
+ * 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.
597
+ *
598
+ * 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).
599
+ *
600
+ * @param {string} email - User email.
601
+ * @param {string} password - User password. Must be at least 8 chars.
602
+ * @throws {AppwriteException}
603
+ * @returns {Promise<Models.Session>}
604
+ * @deprecated Use the object parameter style method for a better developer experience.
605
+ */
310
606
  createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
311
607
  /**
312
- * Use this endpoint to create a session from token. Provide the **userId**
313
- * and **secret** parameters from the successful response of authentication
314
- * flows initiated by token creation. For example, magic URL and phone login.
608
+ * 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.
315
609
  *
316
- * @param {string} userId
317
- * @param {string} secret
610
+ * @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.
611
+ * @param {string} params.secret - Valid verification token.
318
612
  * @throws {AppwriteException}
319
613
  * @returns {Promise}
614
+ * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
615
+ */
616
+ updateMagicURLSession(params: {
617
+ userId: string;
618
+ secret: string;
619
+ }): Promise<Models.Session>;
620
+ /**
621
+ * 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.
622
+ *
623
+ * @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.
624
+ * @param {string} secret - Valid verification token.
625
+ * @throws {AppwriteException}
626
+ * @returns {Promise<Models.Session>}
627
+ * @deprecated Use the object parameter style method for a better developer experience.
320
628
  */
321
629
  updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
322
630
  /**
323
- * Allow the user to login to their account using the OAuth2 provider of their
324
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
325
- * first. Use the success and failure arguments to provide a redirect URL's
326
- * back to your app when login is completed.
631
+ * 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.
327
632
  *
328
- * If there is already an active session, the new session will be attached to
329
- * the logged-in account. If there are no active sessions, the server will
330
- * attempt to look for a user with the same email address as the email
331
- * received from the OAuth2 provider and attach the new session to the
332
- * existing user. If no matching user is found - the server will create a new
333
- * user.
633
+ * 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.
334
634
  *
335
- * A user is limited to 10 active sessions at a time by default. [Learn more
336
- * about session
337
- * limits](https://appwrite.io/docs/authentication-security#limits).
635
+ * 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).
338
636
  *
339
637
  *
340
- * @param {OAuthProvider} provider
341
- * @param {string} success
342
- * @param {string} failure
343
- * @param {string[]} scopes
638
+ * @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.
639
+ * @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.
640
+ * @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.
641
+ * @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.
344
642
  * @throws {AppwriteException}
345
643
  * @returns {void|string}
346
644
  */
645
+ createOAuth2Session(params: {
646
+ provider: OAuthProvider;
647
+ success?: string;
648
+ failure?: string;
649
+ scopes?: string[];
650
+ }): void | URL;
651
+ /**
652
+ * 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.
653
+ *
654
+ * 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.
655
+ *
656
+ * 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).
657
+ *
658
+ *
659
+ * @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.
660
+ * @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.
661
+ * @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.
662
+ * @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.
663
+ * @throws {AppwriteException}
664
+ * @returns {void | URL}
665
+ * @deprecated Use the object parameter style method for a better developer experience.
666
+ */
347
667
  createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
348
668
  /**
349
- * Use this endpoint to create a session from token. Provide the **userId**
350
- * and **secret** parameters from the successful response of authentication
351
- * flows initiated by token creation. For example, magic URL and phone login.
669
+ * 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.
352
670
  *
353
- * @param {string} userId
354
- * @param {string} secret
671
+ * @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.
672
+ * @param {string} params.secret - Valid verification token.
355
673
  * @throws {AppwriteException}
356
674
  * @returns {Promise}
675
+ * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
676
+ */
677
+ updatePhoneSession(params: {
678
+ userId: string;
679
+ secret: string;
680
+ }): Promise<Models.Session>;
681
+ /**
682
+ * 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.
683
+ *
684
+ * @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.
685
+ * @param {string} secret - Valid verification token.
686
+ * @throws {AppwriteException}
687
+ * @returns {Promise<Models.Session>}
688
+ * @deprecated Use the object parameter style method for a better developer experience.
357
689
  */
358
690
  updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
359
691
  /**
360
- * Use this endpoint to create a session from token. Provide the **userId**
361
- * and **secret** parameters from the successful response of authentication
362
- * flows initiated by token creation. For example, magic URL and phone login.
692
+ * 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.
363
693
  *
364
- * @param {string} userId
365
- * @param {string} secret
694
+ * @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.
695
+ * @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
366
696
  * @throws {AppwriteException}
367
697
  * @returns {Promise}
368
698
  */
699
+ createSession(params: {
700
+ userId: string;
701
+ secret: string;
702
+ }): Promise<Models.Session>;
703
+ /**
704
+ * 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.
705
+ *
706
+ * @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.
707
+ * @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
708
+ * @throws {AppwriteException}
709
+ * @returns {Promise<Models.Session>}
710
+ * @deprecated Use the object parameter style method for a better developer experience.
711
+ */
369
712
  createSession(userId: string, secret: string): Promise<Models.Session>;
370
713
  /**
371
- * Use this endpoint to get a logged in user's session using a Session ID.
372
- * Inputting 'current' will return the current session being used.
714
+ * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
373
715
  *
374
- * @param {string} sessionId
716
+ * @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
375
717
  * @throws {AppwriteException}
376
718
  * @returns {Promise}
377
719
  */
720
+ getSession(params: {
721
+ sessionId: string;
722
+ }): Promise<Models.Session>;
723
+ /**
724
+ * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
725
+ *
726
+ * @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
727
+ * @throws {AppwriteException}
728
+ * @returns {Promise<Models.Session>}
729
+ * @deprecated Use the object parameter style method for a better developer experience.
730
+ */
378
731
  getSession(sessionId: string): Promise<Models.Session>;
379
732
  /**
380
- * Use this endpoint to extend a session's length. Extending a session is
381
- * useful when session expiry is short. If the session was created using an
382
- * OAuth provider, this endpoint refreshes the access token from the provider.
733
+ * 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.
383
734
  *
384
- * @param {string} sessionId
735
+ * @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session.
385
736
  * @throws {AppwriteException}
386
737
  * @returns {Promise}
387
738
  */
739
+ updateSession(params: {
740
+ sessionId: string;
741
+ }): Promise<Models.Session>;
742
+ /**
743
+ * 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.
744
+ *
745
+ * @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
746
+ * @throws {AppwriteException}
747
+ * @returns {Promise<Models.Session>}
748
+ * @deprecated Use the object parameter style method for a better developer experience.
749
+ */
388
750
  updateSession(sessionId: string): Promise<Models.Session>;
389
751
  /**
390
- * Logout the user. Use 'current' as the session ID to logout on this device,
391
- * use a session ID to logout on another device. If you're looking to logout
392
- * the user on all devices, use [Delete
393
- * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
394
- * instead.
752
+ * 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.
395
753
  *
396
- * @param {string} sessionId
754
+ * @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
397
755
  * @throws {AppwriteException}
398
756
  * @returns {Promise}
399
757
  */
758
+ deleteSession(params: {
759
+ sessionId: string;
760
+ }): Promise<{}>;
761
+ /**
762
+ * 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.
763
+ *
764
+ * @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
765
+ * @throws {AppwriteException}
766
+ * @returns {Promise<{}>}
767
+ * @deprecated Use the object parameter style method for a better developer experience.
768
+ */
400
769
  deleteSession(sessionId: string): Promise<{}>;
401
770
  /**
402
- * Block the currently logged in user account. Behind the scene, the user
403
- * record is not deleted but permanently blocked from any access. To
404
- * completely delete a user, use the Users API instead.
771
+ * 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.
405
772
  *
406
773
  * @throws {AppwriteException}
407
774
  * @returns {Promise}
408
775
  */
409
776
  updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>>;
410
777
  /**
411
- * Use this endpoint to register a device for push notifications. Provide a
412
- * target ID (custom or generated using ID.unique()), a device identifier
413
- * (usually a device token), and optionally specify which provider should send
414
- * notifications to this target. The target is automatically linked to the
415
- * current session and includes device information like brand and model.
778
+ * 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.
416
779
  *
417
- * @param {string} targetId
418
- * @param {string} identifier
419
- * @param {string} providerId
780
+ * @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.
781
+ * @param {string} params.identifier - The target identifier (token, email, phone etc.)
782
+ * @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.
420
783
  * @throws {AppwriteException}
421
784
  * @returns {Promise}
422
785
  */
786
+ createPushTarget(params: {
787
+ targetId: string;
788
+ identifier: string;
789
+ providerId?: string;
790
+ }): Promise<Models.Target>;
791
+ /**
792
+ * 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.
793
+ *
794
+ * @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.
795
+ * @param {string} identifier - The target identifier (token, email, phone etc.)
796
+ * @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.
797
+ * @throws {AppwriteException}
798
+ * @returns {Promise<Models.Target>}
799
+ * @deprecated Use the object parameter style method for a better developer experience.
800
+ */
423
801
  createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
424
802
  /**
425
- * Update the currently logged in user's push notification target. You can
426
- * modify the target's identifier (device token) and provider ID (token,
427
- * email, phone etc.). The target must exist and belong to the current user.
428
- * If you change the provider ID, notifications will be sent through the new
429
- * messaging provider instead.
803
+ * 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.
430
804
  *
431
- * @param {string} targetId
432
- * @param {string} identifier
805
+ * @param {string} params.targetId - Target ID.
806
+ * @param {string} params.identifier - The target identifier (token, email, phone etc.)
433
807
  * @throws {AppwriteException}
434
808
  * @returns {Promise}
435
809
  */
810
+ updatePushTarget(params: {
811
+ targetId: string;
812
+ identifier: string;
813
+ }): Promise<Models.Target>;
814
+ /**
815
+ * 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.
816
+ *
817
+ * @param {string} targetId - Target ID.
818
+ * @param {string} identifier - The target identifier (token, email, phone etc.)
819
+ * @throws {AppwriteException}
820
+ * @returns {Promise<Models.Target>}
821
+ * @deprecated Use the object parameter style method for a better developer experience.
822
+ */
436
823
  updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
437
824
  /**
438
- * Delete a push notification target for the currently logged in user. After
439
- * deletion, the device will no longer receive push notifications. The target
440
- * must exist and belong to the current user.
825
+ * 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.
441
826
  *
442
- * @param {string} targetId
827
+ * @param {string} params.targetId - Target ID.
443
828
  * @throws {AppwriteException}
444
829
  * @returns {Promise}
445
830
  */
831
+ deletePushTarget(params: {
832
+ targetId: string;
833
+ }): Promise<{}>;
834
+ /**
835
+ * 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.
836
+ *
837
+ * @param {string} targetId - Target ID.
838
+ * @throws {AppwriteException}
839
+ * @returns {Promise<{}>}
840
+ * @deprecated Use the object parameter style method for a better developer experience.
841
+ */
446
842
  deletePushTarget(targetId: string): Promise<{}>;
447
843
  /**
448
- * Sends the user an email with a secret key for creating a session. If the
449
- * provided user ID has not be registered, a new user will be created. Use the
450
- * returned user ID and secret and submit a request to the [POST
451
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
452
- * endpoint to complete the login process. The secret sent to the user's email
453
- * is valid for 15 minutes.
844
+ * 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.
454
845
  *
455
- * A user is limited to 10 active sessions at a time by default. [Learn more
456
- * about session
457
- * limits](https://appwrite.io/docs/authentication-security#limits).
846
+ * 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).
458
847
  *
459
- * @param {string} userId
460
- * @param {string} email
461
- * @param {boolean} phrase
848
+ *
849
+ * @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.
850
+ * @param {string} params.email - User email.
851
+ * @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.
462
852
  * @throws {AppwriteException}
463
853
  * @returns {Promise}
464
854
  */
855
+ createEmailToken(params: {
856
+ userId: string;
857
+ email: string;
858
+ phrase?: boolean;
859
+ }): Promise<Models.Token>;
860
+ /**
861
+ * 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.
862
+ *
863
+ * 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).
864
+ *
865
+ *
866
+ * @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.
867
+ * @param {string} email - User email.
868
+ * @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.
869
+ * @throws {AppwriteException}
870
+ * @returns {Promise<Models.Token>}
871
+ * @deprecated Use the object parameter style method for a better developer experience.
872
+ */
465
873
  createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
466
874
  /**
467
- * Sends the user an email with a secret key for creating a session. If the
468
- * provided user ID has not been registered, a new user will be created. When
469
- * the user clicks the link in the email, the user is redirected back to the
470
- * URL you provided with the secret key and userId values attached to the URL
471
- * query string. Use the query string parameters to submit a request to the
472
- * [POST
473
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
474
- * endpoint to complete the login process. The link sent to the user's email
475
- * address is valid for 1 hour.
875
+ * 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.
476
876
  *
477
- * A user is limited to 10 active sessions at a time by default. [Learn more
478
- * about session
479
- * limits](https://appwrite.io/docs/authentication-security#limits).
877
+ * 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).
480
878
  *
481
879
  *
482
- * @param {string} userId
483
- * @param {string} email
484
- * @param {string} url
485
- * @param {boolean} phrase
880
+ * @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.
881
+ * @param {string} params.email - User email.
882
+ * @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.
883
+ * @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.
486
884
  * @throws {AppwriteException}
487
885
  * @returns {Promise}
488
886
  */
887
+ createMagicURLToken(params: {
888
+ userId: string;
889
+ email: string;
890
+ url?: string;
891
+ phrase?: boolean;
892
+ }): Promise<Models.Token>;
893
+ /**
894
+ * 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.
895
+ *
896
+ * 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).
897
+ *
898
+ *
899
+ * @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.
900
+ * @param {string} email - User email.
901
+ * @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.
902
+ * @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.
903
+ * @throws {AppwriteException}
904
+ * @returns {Promise<Models.Token>}
905
+ * @deprecated Use the object parameter style method for a better developer experience.
906
+ */
489
907
  createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
490
908
  /**
491
- * Allow the user to login to their account using the OAuth2 provider of their
492
- * choice. Each OAuth2 provider should be enabled from the Appwrite console
493
- * first. Use the success and failure arguments to provide a redirect URL's
494
- * back to your app when login is completed.
909
+ * 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.
495
910
  *
496
- * If authentication succeeds, `userId` and `secret` of a token will be
497
- * appended to the success URL as query parameters. These can be used to
498
- * create a new session using the [Create
499
- * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
500
- * endpoint.
911
+ * 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.
501
912
  *
502
- * A user is limited to 10 active sessions at a time by default. [Learn more
503
- * about session
504
- * limits](https://appwrite.io/docs/authentication-security#limits).
913
+ * 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).
505
914
  *
506
- * @param {OAuthProvider} provider
507
- * @param {string} success
508
- * @param {string} failure
509
- * @param {string[]} scopes
915
+ * @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.
916
+ * @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.
917
+ * @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.
918
+ * @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.
510
919
  * @throws {AppwriteException}
511
920
  * @returns {void|string}
512
921
  */
922
+ createOAuth2Token(params: {
923
+ provider: OAuthProvider;
924
+ success?: string;
925
+ failure?: string;
926
+ scopes?: string[];
927
+ }): void | URL;
928
+ /**
929
+ * 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.
930
+ *
931
+ * 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.
932
+ *
933
+ * 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).
934
+ *
935
+ * @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.
936
+ * @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.
937
+ * @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.
938
+ * @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.
939
+ * @throws {AppwriteException}
940
+ * @returns {void | URL}
941
+ * @deprecated Use the object parameter style method for a better developer experience.
942
+ */
513
943
  createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
514
944
  /**
515
- * Sends the user an SMS with a secret key for creating a session. If the
516
- * provided user ID has not be registered, a new user will be created. Use the
517
- * returned user ID and secret and submit a request to the [POST
518
- * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
519
- * endpoint to complete the login process. The secret sent to the user's phone
520
- * is valid for 15 minutes.
945
+ * 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.
521
946
  *
522
- * A user is limited to 10 active sessions at a time by default. [Learn more
523
- * about session
524
- * limits](https://appwrite.io/docs/authentication-security#limits).
947
+ * 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).
525
948
  *
526
- * @param {string} userId
527
- * @param {string} phone
949
+ * @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.
950
+ * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
528
951
  * @throws {AppwriteException}
529
952
  * @returns {Promise}
530
953
  */
954
+ createPhoneToken(params: {
955
+ userId: string;
956
+ phone: string;
957
+ }): Promise<Models.Token>;
958
+ /**
959
+ * 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.
960
+ *
961
+ * 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).
962
+ *
963
+ * @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.
964
+ * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
965
+ * @throws {AppwriteException}
966
+ * @returns {Promise<Models.Token>}
967
+ * @deprecated Use the object parameter style method for a better developer experience.
968
+ */
531
969
  createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
532
970
  /**
533
- * Use this endpoint to send a verification message to your user email address
534
- * to confirm they are the valid owners of that address. Both the **userId**
535
- * and **secret** arguments will be passed as query parameters to the URL you
536
- * have provided to be attached to the verification email. The provided URL
537
- * should redirect the user back to your app and allow you to complete the
538
- * verification process by verifying both the **userId** and **secret**
539
- * parameters. Learn more about how to [complete the verification
540
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
541
- * The verification link sent to the user's email address is valid for 7 days.
971
+ * 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.
542
972
  *
543
- * Please note that in order to avoid a [Redirect
544
- * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
545
- * the only valid redirect URLs are the ones from domains you have set when
546
- * adding your platforms in the console interface.
973
+ * 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.
547
974
  *
548
975
  *
549
- * @param {string} url
976
+ * @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.
550
977
  * @throws {AppwriteException}
551
978
  * @returns {Promise}
552
979
  */
980
+ createVerification(params: {
981
+ url: string;
982
+ }): Promise<Models.Token>;
983
+ /**
984
+ * 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.
985
+ *
986
+ * 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.
987
+ *
988
+ *
989
+ * @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.
990
+ * @throws {AppwriteException}
991
+ * @returns {Promise<Models.Token>}
992
+ * @deprecated Use the object parameter style method for a better developer experience.
993
+ */
553
994
  createVerification(url: string): Promise<Models.Token>;
554
995
  /**
555
- * Use this endpoint to complete the user email verification process. Use both
556
- * the **userId** and **secret** parameters that were attached to your app URL
557
- * to verify the user email ownership. If confirmed this route will return a
558
- * 200 status code.
996
+ * 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.
559
997
  *
560
- * @param {string} userId
561
- * @param {string} secret
998
+ * @param {string} params.userId - User ID.
999
+ * @param {string} params.secret - Valid verification token.
562
1000
  * @throws {AppwriteException}
563
1001
  * @returns {Promise}
564
1002
  */
1003
+ updateVerification(params: {
1004
+ userId: string;
1005
+ secret: string;
1006
+ }): Promise<Models.Token>;
1007
+ /**
1008
+ * 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.
1009
+ *
1010
+ * @param {string} userId - User ID.
1011
+ * @param {string} secret - Valid verification token.
1012
+ * @throws {AppwriteException}
1013
+ * @returns {Promise<Models.Token>}
1014
+ * @deprecated Use the object parameter style method for a better developer experience.
1015
+ */
565
1016
  updateVerification(userId: string, secret: string): Promise<Models.Token>;
566
1017
  /**
567
- * Use this endpoint to send a verification SMS to the currently logged in
568
- * user. This endpoint is meant for use after updating a user's phone number
569
- * using the
570
- * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
571
- * endpoint. Learn more about how to [complete the verification
572
- * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
573
- * The verification code sent to the user's phone number is valid for 15
574
- * minutes.
1018
+ * 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.
575
1019
  *
576
1020
  * @throws {AppwriteException}
577
1021
  * @returns {Promise}
578
1022
  */
579
1023
  createPhoneVerification(): Promise<Models.Token>;
580
1024
  /**
581
- * Use this endpoint to complete the user phone verification process. Use the
582
- * **userId** and **secret** that were sent to your user's phone number to
583
- * verify the user email ownership. If confirmed this route will return a 200
584
- * status code.
1025
+ * 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.
585
1026
  *
586
- * @param {string} userId
587
- * @param {string} secret
1027
+ * @param {string} params.userId - User ID.
1028
+ * @param {string} params.secret - Valid verification token.
588
1029
  * @throws {AppwriteException}
589
1030
  * @returns {Promise}
590
1031
  */
1032
+ updatePhoneVerification(params: {
1033
+ userId: string;
1034
+ secret: string;
1035
+ }): Promise<Models.Token>;
1036
+ /**
1037
+ * 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.
1038
+ *
1039
+ * @param {string} userId - User ID.
1040
+ * @param {string} secret - Valid verification token.
1041
+ * @throws {AppwriteException}
1042
+ * @returns {Promise<Models.Token>}
1043
+ * @deprecated Use the object parameter style method for a better developer experience.
1044
+ */
591
1045
  updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
592
1046
  }