react-native-appwrite 0.2.2 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/.github/workflows/publish.yml +13 -4
  2. package/CHANGELOG.md +1 -1
  3. package/LICENSE +1 -1
  4. package/README.md +22 -9
  5. package/dist/cjs/sdk.js +1193 -269
  6. package/dist/cjs/sdk.js.map +1 -1
  7. package/dist/esm/sdk.js +1193 -270
  8. package/dist/esm/sdk.js.map +1 -1
  9. package/docs/examples/account/create-anonymous-session.md +6 -13
  10. package/docs/examples/account/create-email-password-session.md +14 -0
  11. package/docs/examples/account/create-email-token.md +15 -0
  12. package/docs/examples/account/create-j-w-t.md +6 -13
  13. package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
  14. package/docs/examples/account/create-mfa-authenticator.md +13 -0
  15. package/docs/examples/account/create-mfa-challenge.md +13 -0
  16. package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
  17. package/docs/examples/account/create-o-auth2session.md +10 -9
  18. package/docs/examples/account/create-o-auth2token.md +15 -0
  19. package/docs/examples/account/create-phone-token.md +14 -0
  20. package/docs/examples/account/create-phone-verification.md +6 -13
  21. package/docs/examples/account/create-push-target.md +15 -0
  22. package/docs/examples/account/create-recovery.md +9 -13
  23. package/docs/examples/account/create-session.md +14 -0
  24. package/docs/examples/account/create-verification.md +8 -13
  25. package/docs/examples/account/create.md +11 -13
  26. package/docs/examples/account/delete-identity.md +8 -13
  27. package/docs/examples/account/delete-mfa-authenticator.md +14 -0
  28. package/docs/examples/account/delete-push-target.md +13 -0
  29. package/docs/examples/account/delete-session.md +8 -13
  30. package/docs/examples/account/delete-sessions.md +6 -13
  31. package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
  32. package/docs/examples/account/get-prefs.md +6 -13
  33. package/docs/examples/account/get-session.md +8 -13
  34. package/docs/examples/account/get.md +6 -13
  35. package/docs/examples/account/list-identities.md +8 -13
  36. package/docs/examples/account/list-logs.md +8 -13
  37. package/docs/examples/account/list-mfa-factors.md +11 -0
  38. package/docs/examples/account/list-sessions.md +6 -13
  39. package/docs/examples/account/update-email.md +9 -13
  40. package/docs/examples/account/update-m-f-a.md +13 -0
  41. package/docs/examples/account/update-magic-u-r-l-session.md +9 -13
  42. package/docs/examples/account/update-mfa-authenticator.md +14 -0
  43. package/docs/examples/account/update-mfa-challenge.md +14 -0
  44. package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
  45. package/docs/examples/account/update-name.md +8 -13
  46. package/docs/examples/account/update-password.md +9 -13
  47. package/docs/examples/account/update-phone-session.md +9 -13
  48. package/docs/examples/account/update-phone-verification.md +9 -13
  49. package/docs/examples/account/update-phone.md +9 -13
  50. package/docs/examples/account/update-prefs.md +8 -13
  51. package/docs/examples/account/update-push-target.md +14 -0
  52. package/docs/examples/account/update-recovery.md +10 -13
  53. package/docs/examples/account/update-session.md +8 -13
  54. package/docs/examples/account/update-status.md +6 -13
  55. package/docs/examples/account/update-verification.md +9 -13
  56. package/docs/examples/avatars/get-browser.md +11 -9
  57. package/docs/examples/avatars/get-credit-card.md +11 -9
  58. package/docs/examples/avatars/get-favicon.md +8 -9
  59. package/docs/examples/avatars/get-flag.md +11 -9
  60. package/docs/examples/avatars/get-image.md +10 -9
  61. package/docs/examples/avatars/get-initials.md +11 -9
  62. package/docs/examples/avatars/get-q-r.md +11 -9
  63. package/docs/examples/databases/create-document.md +12 -13
  64. package/docs/examples/databases/delete-document.md +10 -13
  65. package/docs/examples/databases/get-document.md +11 -13
  66. package/docs/examples/databases/list-documents.md +10 -13
  67. package/docs/examples/databases/update-document.md +12 -13
  68. package/docs/examples/functions/create-execution.md +13 -13
  69. package/docs/examples/functions/get-execution.md +9 -13
  70. package/docs/examples/functions/list-executions.md +10 -13
  71. package/docs/examples/graphql/mutation.md +8 -13
  72. package/docs/examples/graphql/query.md +8 -13
  73. package/docs/examples/locale/get.md +6 -13
  74. package/docs/examples/locale/list-codes.md +6 -13
  75. package/docs/examples/locale/list-continents.md +6 -13
  76. package/docs/examples/locale/list-countries-e-u.md +6 -13
  77. package/docs/examples/locale/list-countries-phones.md +6 -13
  78. package/docs/examples/locale/list-countries.md +6 -13
  79. package/docs/examples/locale/list-currencies.md +6 -13
  80. package/docs/examples/locale/list-languages.md +6 -13
  81. package/docs/examples/messaging/create-subscriber.md +15 -0
  82. package/docs/examples/messaging/delete-subscriber.md +14 -0
  83. package/docs/examples/storage/create-file.md +11 -13
  84. package/docs/examples/storage/delete-file.md +9 -13
  85. package/docs/examples/storage/get-file-download.md +9 -9
  86. package/docs/examples/storage/get-file-preview.md +20 -9
  87. package/docs/examples/storage/get-file-view.md +9 -9
  88. package/docs/examples/storage/get-file.md +9 -13
  89. package/docs/examples/storage/list-files.md +10 -13
  90. package/docs/examples/storage/update-file.md +11 -13
  91. package/docs/examples/teams/create-membership.md +14 -13
  92. package/docs/examples/teams/create.md +10 -13
  93. package/docs/examples/teams/delete-membership.md +9 -13
  94. package/docs/examples/teams/delete.md +8 -13
  95. package/docs/examples/teams/get-membership.md +9 -13
  96. package/docs/examples/teams/get-prefs.md +8 -13
  97. package/docs/examples/teams/get.md +8 -13
  98. package/docs/examples/teams/list-memberships.md +10 -13
  99. package/docs/examples/teams/list.md +9 -13
  100. package/docs/examples/teams/update-membership-status.md +11 -13
  101. package/docs/examples/teams/update-membership.md +10 -13
  102. package/docs/examples/teams/update-name.md +9 -13
  103. package/docs/examples/teams/update-prefs.md +9 -13
  104. package/package.json +1 -1
  105. package/src/client.ts +37 -11
  106. package/src/enums/authentication-factor.ts +6 -0
  107. package/src/enums/authenticator-type.ts +3 -0
  108. package/src/enums/browser.ts +16 -0
  109. package/src/enums/credit-card.ts +18 -0
  110. package/src/enums/execution-method.ts +8 -0
  111. package/src/enums/flag.ts +197 -0
  112. package/src/enums/image-format.ts +7 -0
  113. package/src/enums/image-gravity.ts +11 -0
  114. package/src/enums/o-auth-provider.ts +41 -0
  115. package/src/id.ts +23 -4
  116. package/src/index.ts +13 -2
  117. package/src/models.ts +174 -0
  118. package/src/query.ts +61 -34
  119. package/src/service.ts +4 -7
  120. package/src/services/account.ts +643 -119
  121. package/src/services/avatars.ts +12 -6
  122. package/src/services/databases.ts +7 -4
  123. package/src/services/functions.ts +6 -2
  124. package/src/services/graphql.ts +3 -0
  125. package/src/services/locale.ts +3 -0
  126. package/src/services/messaging.ts +84 -0
  127. package/src/services/storage.ts +12 -6
  128. package/src/services/teams.ts +3 -0
  129. package/types/client.d.ts +133 -0
  130. package/types/enums/authentication-factor.d.ts +6 -0
  131. package/types/enums/authenticator-type.d.ts +3 -0
  132. package/types/enums/browser.d.ts +16 -0
  133. package/types/enums/credit-card.d.ts +18 -0
  134. package/types/enums/execution-method.d.ts +8 -0
  135. package/types/enums/flag.d.ts +197 -0
  136. package/types/enums/image-format.d.ts +7 -0
  137. package/types/enums/image-gravity.d.ts +11 -0
  138. package/types/enums/o-auth-provider.d.ts +41 -0
  139. package/types/id.d.ts +5 -0
  140. package/types/index.d.ts +25 -0
  141. package/types/models.d.ts +1195 -0
  142. package/types/permission.d.ts +7 -0
  143. package/types/query.d.ts +34 -0
  144. package/types/role.d.ts +70 -0
  145. package/types/service.d.ts +8 -0
  146. package/types/services/account.d.ts +676 -0
  147. package/types/services/avatars.d.ts +149 -0
  148. package/types/services/databases.d.ts +77 -0
  149. package/types/services/functions.d.ts +49 -0
  150. package/types/services/graphql.d.ts +25 -0
  151. package/types/services/locale.d.ts +91 -0
  152. package/types/services/messaging.d.ts +29 -0
  153. package/types/services/storage.d.ts +147 -0
  154. package/types/services/teams.d.ts +197 -0
  155. package/docs/examples/account/create-email-session.md +0 -18
  156. package/docs/examples/account/create-magic-u-r-l-session.md +0 -18
  157. package/docs/examples/account/create-phone-session.md +0 -18
@@ -0,0 +1,676 @@
1
+ import { Service } from '../service';
2
+ import { Client } from '../client';
3
+ import type { Models } from '../models';
4
+ import { AuthenticatorType } from '../enums/authenticator-type';
5
+ import { AuthenticationFactor } from '../enums/authentication-factor';
6
+ import { OAuthProvider } from '../enums/o-auth-provider';
7
+ export declare class Account extends Service {
8
+ constructor(client: Client);
9
+ /**
10
+ * Get account
11
+ *
12
+ * Get the currently logged in user.
13
+ *
14
+ * @throws {AppwriteException}
15
+ * @returns {Promise}
16
+ */
17
+ get<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
18
+ /**
19
+ * Create account
20
+ *
21
+ * Use this endpoint to allow a new user to register a new account in your
22
+ * project. After the user registration completes successfully, you can use
23
+ * the
24
+ * [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification)
25
+ * route to start verifying the user email address. To allow the new user to
26
+ * login to their new account, you need to create a new [account
27
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
28
+ *
29
+ * @param {string} userId
30
+ * @param {string} email
31
+ * @param {string} password
32
+ * @param {string} name
33
+ * @throws {AppwriteException}
34
+ * @returns {Promise}
35
+ */
36
+ create<Preferences extends Models.Preferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
37
+ /**
38
+ * Update email
39
+ *
40
+ * Update currently logged in user account email address. After changing user
41
+ * address, the user confirmation status will get reset. A new confirmation
42
+ * email is not sent automatically however you can use the send confirmation
43
+ * email endpoint again to send the confirmation email. For security measures,
44
+ * user password is required to complete this request.
45
+ * This endpoint can also be used to convert an anonymous account to a normal
46
+ * one, by passing an email address and a new password.
47
+ *
48
+ *
49
+ * @param {string} email
50
+ * @param {string} password
51
+ * @throws {AppwriteException}
52
+ * @returns {Promise}
53
+ */
54
+ updateEmail<Preferences extends Models.Preferences>(email: string, password: string): Promise<Models.User<Preferences>>;
55
+ /**
56
+ * List Identities
57
+ *
58
+ * Get the list of identities for the currently logged in user.
59
+ *
60
+ * @param {string[]} queries
61
+ * @throws {AppwriteException}
62
+ * @returns {Promise}
63
+ */
64
+ listIdentities(queries?: string[]): Promise<Models.IdentityList>;
65
+ /**
66
+ * Delete identity
67
+ *
68
+ * Delete an identity by its unique ID.
69
+ *
70
+ * @param {string} identityId
71
+ * @throws {AppwriteException}
72
+ * @returns {Promise}
73
+ */
74
+ deleteIdentity(identityId: string): Promise<{}>;
75
+ /**
76
+ * Create JWT
77
+ *
78
+ * Use this endpoint to create a JSON Web Token. You can use the resulting JWT
79
+ * to authenticate on behalf of the current user when working with the
80
+ * Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes
81
+ * from its creation and will be invalid if the user will logout in that time
82
+ * frame.
83
+ *
84
+ * @throws {AppwriteException}
85
+ * @returns {Promise}
86
+ */
87
+ createJWT(): Promise<Models.Jwt>;
88
+ /**
89
+ * List logs
90
+ *
91
+ * Get the list of latest security activity logs for the currently logged in
92
+ * user. Each log returns user IP address, location and date and time of log.
93
+ *
94
+ * @param {string[]} queries
95
+ * @throws {AppwriteException}
96
+ * @returns {Promise}
97
+ */
98
+ listLogs(queries?: string[]): Promise<Models.LogList>;
99
+ /**
100
+ * Update MFA
101
+ *
102
+ * Enable or disable MFA on an account.
103
+ *
104
+ * @param {boolean} mfa
105
+ * @throws {AppwriteException}
106
+ * @returns {Promise}
107
+ */
108
+ updateMFA<Preferences extends Models.Preferences>(mfa: boolean): Promise<Models.User<Preferences>>;
109
+ /**
110
+ * Add Authenticator
111
+ *
112
+ * Add an authenticator app to be used as an MFA factor. Verify the
113
+ * authenticator using the [verify
114
+ * authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
115
+ * method.
116
+ *
117
+ * @param {AuthenticatorType} type
118
+ * @throws {AppwriteException}
119
+ * @returns {Promise}
120
+ */
121
+ createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
122
+ /**
123
+ * Verify Authenticator
124
+ *
125
+ * Verify an authenticator app after adding it using the [add
126
+ * authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
127
+ * method. add
128
+ *
129
+ * @param {AuthenticatorType} type
130
+ * @param {string} otp
131
+ * @throws {AppwriteException}
132
+ * @returns {Promise}
133
+ */
134
+ updateMfaAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
135
+ /**
136
+ * Delete Authenticator
137
+ *
138
+ * Delete an authenticator for a user by ID.
139
+ *
140
+ * @param {AuthenticatorType} type
141
+ * @param {string} otp
142
+ * @throws {AppwriteException}
143
+ * @returns {Promise}
144
+ */
145
+ deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}>;
146
+ /**
147
+ * Create 2FA Challenge
148
+ *
149
+ * Begin the process of MFA verification after sign-in. Finish the flow with
150
+ * [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
151
+ * method.
152
+ *
153
+ * @param {AuthenticationFactor} factor
154
+ * @throws {AppwriteException}
155
+ * @returns {Promise}
156
+ */
157
+ createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
158
+ /**
159
+ * Create MFA Challenge (confirmation)
160
+ *
161
+ * Complete the MFA challenge by providing the one-time password. Finish the
162
+ * process of MFA verification by providing the one-time password. To begin
163
+ * the flow, use
164
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
165
+ * method.
166
+ *
167
+ * @param {string} challengeId
168
+ * @param {string} otp
169
+ * @throws {AppwriteException}
170
+ * @returns {Promise}
171
+ */
172
+ updateMfaChallenge(challengeId: string, otp: string): Promise<{}>;
173
+ /**
174
+ * List Factors
175
+ *
176
+ * List the factors available on the account to be used as a MFA challange.
177
+ *
178
+ * @throws {AppwriteException}
179
+ * @returns {Promise}
180
+ */
181
+ listMfaFactors(): Promise<Models.MfaFactors>;
182
+ /**
183
+ * Get MFA Recovery Codes
184
+ *
185
+ * Get recovery codes that can be used as backup for MFA flow. Before getting
186
+ * codes, they must be generated using
187
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
188
+ * method. An OTP challenge is required to read recovery codes.
189
+ *
190
+ * @throws {AppwriteException}
191
+ * @returns {Promise}
192
+ */
193
+ getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
194
+ /**
195
+ * Create MFA Recovery Codes
196
+ *
197
+ * Generate recovery codes as backup for MFA flow. It's recommended to
198
+ * generate and show then immediately after user successfully adds their
199
+ * authehticator. Recovery codes can be used as a MFA verification type in
200
+ * [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
201
+ * method.
202
+ *
203
+ * @throws {AppwriteException}
204
+ * @returns {Promise}
205
+ */
206
+ createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
207
+ /**
208
+ * Regenerate MFA Recovery Codes
209
+ *
210
+ * Regenerate recovery codes that can be used as backup for MFA flow. Before
211
+ * regenerating codes, they must be first generated using
212
+ * [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
213
+ * method. An OTP challenge is required to regenreate recovery codes.
214
+ *
215
+ * @throws {AppwriteException}
216
+ * @returns {Promise}
217
+ */
218
+ updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
219
+ /**
220
+ * Update name
221
+ *
222
+ * Update currently logged in user account name.
223
+ *
224
+ * @param {string} name
225
+ * @throws {AppwriteException}
226
+ * @returns {Promise}
227
+ */
228
+ updateName<Preferences extends Models.Preferences>(name: string): Promise<Models.User<Preferences>>;
229
+ /**
230
+ * Update password
231
+ *
232
+ * Update currently logged in user password. For validation, user is required
233
+ * to pass in the new password, and the old password. For users created with
234
+ * OAuth, Team Invites and Magic URL, oldPassword is optional.
235
+ *
236
+ * @param {string} password
237
+ * @param {string} oldPassword
238
+ * @throws {AppwriteException}
239
+ * @returns {Promise}
240
+ */
241
+ updatePassword<Preferences extends Models.Preferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
242
+ /**
243
+ * Update phone
244
+ *
245
+ * Update the currently logged in user's phone number. After updating the
246
+ * phone number, the phone verification status will be reset. A confirmation
247
+ * SMS is not sent automatically, however you can use the [POST
248
+ * /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification)
249
+ * endpoint to send a confirmation SMS.
250
+ *
251
+ * @param {string} phone
252
+ * @param {string} password
253
+ * @throws {AppwriteException}
254
+ * @returns {Promise}
255
+ */
256
+ updatePhone<Preferences extends Models.Preferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
257
+ /**
258
+ * Get account preferences
259
+ *
260
+ * Get the preferences as a key-value object for the currently logged in user.
261
+ *
262
+ * @throws {AppwriteException}
263
+ * @returns {Promise}
264
+ */
265
+ getPrefs<Preferences extends Models.Preferences>(): Promise<Preferences>;
266
+ /**
267
+ * Update preferences
268
+ *
269
+ * Update currently logged in user account preferences. The object you pass is
270
+ * stored as is, and replaces any previous value. The maximum allowed prefs
271
+ * size is 64kB and throws error if exceeded.
272
+ *
273
+ * @param {object} prefs
274
+ * @throws {AppwriteException}
275
+ * @returns {Promise}
276
+ */
277
+ updatePrefs<Preferences extends Models.Preferences>(prefs: object): Promise<Models.User<Preferences>>;
278
+ /**
279
+ * Create password recovery
280
+ *
281
+ * Sends the user an email with a temporary secret key for password reset.
282
+ * When the user clicks the confirmation link he is redirected back to your
283
+ * app password reset URL with the secret key and email address values
284
+ * attached to the URL query string. Use the query string params to submit a
285
+ * request to the [PUT
286
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery)
287
+ * endpoint to complete the process. The verification link sent to the user's
288
+ * email address is valid for 1 hour.
289
+ *
290
+ * @param {string} email
291
+ * @param {string} url
292
+ * @throws {AppwriteException}
293
+ * @returns {Promise}
294
+ */
295
+ createRecovery(email: string, url: string): Promise<Models.Token>;
296
+ /**
297
+ * Create password recovery (confirmation)
298
+ *
299
+ * Use this endpoint to complete the user account password reset. Both the
300
+ * **userId** and **secret** arguments will be passed as query parameters to
301
+ * the redirect URL you have provided when sending your request to the [POST
302
+ * /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery)
303
+ * endpoint.
304
+ *
305
+ * Please note that in order to avoid a [Redirect
306
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
307
+ * the only valid redirect URLs are the ones from domains you have set when
308
+ * adding your platforms in the console interface.
309
+ *
310
+ * @param {string} userId
311
+ * @param {string} secret
312
+ * @param {string} password
313
+ * @throws {AppwriteException}
314
+ * @returns {Promise}
315
+ */
316
+ updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
317
+ /**
318
+ * List sessions
319
+ *
320
+ * Get the list of active sessions across different devices for the currently
321
+ * logged in user.
322
+ *
323
+ * @throws {AppwriteException}
324
+ * @returns {Promise}
325
+ */
326
+ listSessions(): Promise<Models.SessionList>;
327
+ /**
328
+ * Delete sessions
329
+ *
330
+ * Delete all sessions from the user account and remove any sessions cookies
331
+ * from the end client.
332
+ *
333
+ * @throws {AppwriteException}
334
+ * @returns {Promise}
335
+ */
336
+ deleteSessions(): Promise<{}>;
337
+ /**
338
+ * Create anonymous session
339
+ *
340
+ * Use this endpoint to allow a new user to register an anonymous account in
341
+ * your project. This route will also create a new session for the user. To
342
+ * allow the new user to convert an anonymous account to a normal account, you
343
+ * need to update its [email and
344
+ * password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail)
345
+ * or create an [OAuth2
346
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
347
+ *
348
+ * @throws {AppwriteException}
349
+ * @returns {Promise}
350
+ */
351
+ createAnonymousSession(): Promise<Models.Session>;
352
+ /**
353
+ * Create email password session
354
+ *
355
+ * Allow the user to login into their account by providing a valid email and
356
+ * password combination. This route will create a new session for the user.
357
+ *
358
+ * A user is limited to 10 active sessions at a time by default. [Learn more
359
+ * about session
360
+ * limits](https://appwrite.io/docs/authentication-security#limits).
361
+ *
362
+ * @param {string} email
363
+ * @param {string} password
364
+ * @throws {AppwriteException}
365
+ * @returns {Promise}
366
+ */
367
+ createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
368
+ /**
369
+ * Update magic URL session
370
+ *
371
+ * Use this endpoint to create a session from token. Provide the **userId**
372
+ * and **secret** parameters from the successful response of authentication
373
+ * flows initiated by token creation. For example, magic URL and phone login.
374
+ *
375
+ * @param {string} userId
376
+ * @param {string} secret
377
+ * @throws {AppwriteException}
378
+ * @returns {Promise}
379
+ */
380
+ updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
381
+ /**
382
+ * Create OAuth2 session
383
+ *
384
+ * Allow the user to login to their account using the OAuth2 provider of their
385
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
386
+ * first. Use the success and failure arguments to provide a redirect URL's
387
+ * back to your app when login is completed.
388
+ *
389
+ * If there is already an active session, the new session will be attached to
390
+ * the logged-in account. If there are no active sessions, the server will
391
+ * attempt to look for a user with the same email address as the email
392
+ * received from the OAuth2 provider and attach the new session to the
393
+ * existing user. If no matching user is found - the server will create a new
394
+ * user.
395
+ *
396
+ * A user is limited to 10 active sessions at a time by default. [Learn more
397
+ * about session
398
+ * limits](https://appwrite.io/docs/authentication-security#limits).
399
+ *
400
+ *
401
+ * @param {OAuthProvider} provider
402
+ * @param {string} success
403
+ * @param {string} failure
404
+ * @param {string[]} scopes
405
+ * @throws {AppwriteException}
406
+ * @returns {void|string}
407
+ */
408
+ createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
409
+ /**
410
+ * Update phone session
411
+ *
412
+ * Use this endpoint to create a session from token. Provide the **userId**
413
+ * and **secret** parameters from the successful response of authentication
414
+ * flows initiated by token creation. For example, magic URL and phone login.
415
+ *
416
+ * @param {string} userId
417
+ * @param {string} secret
418
+ * @throws {AppwriteException}
419
+ * @returns {Promise}
420
+ */
421
+ updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
422
+ /**
423
+ * Create session
424
+ *
425
+ * Use this endpoint to create a session from token. Provide the **userId**
426
+ * and **secret** parameters from the successful response of authentication
427
+ * flows initiated by token creation. For example, magic URL and phone login.
428
+ *
429
+ * @param {string} userId
430
+ * @param {string} secret
431
+ * @throws {AppwriteException}
432
+ * @returns {Promise}
433
+ */
434
+ createSession(userId: string, secret: string): Promise<Models.Session>;
435
+ /**
436
+ * Get session
437
+ *
438
+ * Use this endpoint to get a logged in user's session using a Session ID.
439
+ * Inputting 'current' will return the current session being used.
440
+ *
441
+ * @param {string} sessionId
442
+ * @throws {AppwriteException}
443
+ * @returns {Promise}
444
+ */
445
+ getSession(sessionId: string): Promise<Models.Session>;
446
+ /**
447
+ * Update session
448
+ *
449
+ * Use this endpoint to extend a session's length. Extending a session is
450
+ * useful when session expiry is short. If the session was created using an
451
+ * OAuth provider, this endpoint refreshes the access token from the provider.
452
+ *
453
+ * @param {string} sessionId
454
+ * @throws {AppwriteException}
455
+ * @returns {Promise}
456
+ */
457
+ updateSession(sessionId: string): Promise<Models.Session>;
458
+ /**
459
+ * Delete session
460
+ *
461
+ * Logout the user. Use 'current' as the session ID to logout on this device,
462
+ * use a session ID to logout on another device. If you're looking to logout
463
+ * the user on all devices, use [Delete
464
+ * Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions)
465
+ * instead.
466
+ *
467
+ * @param {string} sessionId
468
+ * @throws {AppwriteException}
469
+ * @returns {Promise}
470
+ */
471
+ deleteSession(sessionId: string): Promise<{}>;
472
+ /**
473
+ * Update status
474
+ *
475
+ * Block the currently logged in user account. Behind the scene, the user
476
+ * record is not deleted but permanently blocked from any access. To
477
+ * completely delete a user, use the Users API instead.
478
+ *
479
+ * @throws {AppwriteException}
480
+ * @returns {Promise}
481
+ */
482
+ updateStatus<Preferences extends Models.Preferences>(): Promise<Models.User<Preferences>>;
483
+ /**
484
+ * Create push target
485
+ *
486
+ *
487
+ * @param {string} targetId
488
+ * @param {string} identifier
489
+ * @param {string} providerId
490
+ * @throws {AppwriteException}
491
+ * @returns {Promise}
492
+ */
493
+ createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Models.Target>;
494
+ /**
495
+ * Update push target
496
+ *
497
+ *
498
+ * @param {string} targetId
499
+ * @param {string} identifier
500
+ * @throws {AppwriteException}
501
+ * @returns {Promise}
502
+ */
503
+ updatePushTarget(targetId: string, identifier: string): Promise<Models.Target>;
504
+ /**
505
+ * Delete push target
506
+ *
507
+ *
508
+ * @param {string} targetId
509
+ * @throws {AppwriteException}
510
+ * @returns {Promise}
511
+ */
512
+ deletePushTarget(targetId: string): Promise<{}>;
513
+ /**
514
+ * Create email token (OTP)
515
+ *
516
+ * Sends the user an email with a secret key for creating a session. If the
517
+ * provided user ID has not be registered, a new user will be created. Use the
518
+ * returned user ID and secret and submit a request to the [POST
519
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
520
+ * endpoint to complete the login process. The secret sent to the user's email
521
+ * is valid for 15 minutes.
522
+ *
523
+ * A user is limited to 10 active sessions at a time by default. [Learn more
524
+ * about session
525
+ * limits](https://appwrite.io/docs/authentication-security#limits).
526
+ *
527
+ * @param {string} userId
528
+ * @param {string} email
529
+ * @param {boolean} phrase
530
+ * @throws {AppwriteException}
531
+ * @returns {Promise}
532
+ */
533
+ createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
534
+ /**
535
+ * Create magic URL token
536
+ *
537
+ * Sends the user an email with a secret key for creating a session. If the
538
+ * provided user ID has not been registered, a new user will be created. When
539
+ * the user clicks the link in the email, the user is redirected back to the
540
+ * URL you provided with the secret key and userId values attached to the URL
541
+ * query string. Use the query string parameters to submit a request to the
542
+ * [POST
543
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
544
+ * endpoint to complete the login process. The link sent to the user's email
545
+ * address is valid for 1 hour. If you are on a mobile device you can leave
546
+ * the URL parameter empty, so that the login completion will be handled by
547
+ * your Appwrite instance by default.
548
+ *
549
+ * A user is limited to 10 active sessions at a time by default. [Learn more
550
+ * about session
551
+ * limits](https://appwrite.io/docs/authentication-security#limits).
552
+ *
553
+ *
554
+ * @param {string} userId
555
+ * @param {string} email
556
+ * @param {string} url
557
+ * @param {boolean} phrase
558
+ * @throws {AppwriteException}
559
+ * @returns {Promise}
560
+ */
561
+ createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
562
+ /**
563
+ * Create OAuth2 token
564
+ *
565
+ * Allow the user to login to their account using the OAuth2 provider of their
566
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
567
+ * first. Use the success and failure arguments to provide a redirect URL's
568
+ * back to your app when login is completed.
569
+ *
570
+ * If authentication succeeds, `userId` and `secret` of a token will be
571
+ * appended to the success URL as query parameters. These can be used to
572
+ * create a new session using the [Create
573
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
574
+ * endpoint.
575
+ *
576
+ * A user is limited to 10 active sessions at a time by default. [Learn more
577
+ * about session
578
+ * limits](https://appwrite.io/docs/authentication-security#limits).
579
+ *
580
+ * @param {OAuthProvider} provider
581
+ * @param {string} success
582
+ * @param {string} failure
583
+ * @param {string[]} scopes
584
+ * @throws {AppwriteException}
585
+ * @returns {void|string}
586
+ */
587
+ createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): void | URL;
588
+ /**
589
+ * Create phone token
590
+ *
591
+ * Sends the user an SMS with a secret key for creating a session. If the
592
+ * provided user ID has not be registered, a new user will be created. Use the
593
+ * returned user ID and secret and submit a request to the [POST
594
+ * /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
595
+ * endpoint to complete the login process. The secret sent to the user's phone
596
+ * is valid for 15 minutes.
597
+ *
598
+ * A user is limited to 10 active sessions at a time by default. [Learn more
599
+ * about session
600
+ * limits](https://appwrite.io/docs/authentication-security#limits).
601
+ *
602
+ * @param {string} userId
603
+ * @param {string} phone
604
+ * @throws {AppwriteException}
605
+ * @returns {Promise}
606
+ */
607
+ createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
608
+ /**
609
+ * Create email verification
610
+ *
611
+ * Use this endpoint to send a verification message to your user email address
612
+ * to confirm they are the valid owners of that address. Both the **userId**
613
+ * and **secret** arguments will be passed as query parameters to the URL you
614
+ * have provided to be attached to the verification email. The provided URL
615
+ * should redirect the user back to your app and allow you to complete the
616
+ * verification process by verifying both the **userId** and **secret**
617
+ * parameters. Learn more about how to [complete the verification
618
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
619
+ * The verification link sent to the user's email address is valid for 7 days.
620
+ *
621
+ * Please note that in order to avoid a [Redirect
622
+ * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
623
+ * the only valid redirect URLs are the ones from domains you have set when
624
+ * adding your platforms in the console interface.
625
+ *
626
+ *
627
+ * @param {string} url
628
+ * @throws {AppwriteException}
629
+ * @returns {Promise}
630
+ */
631
+ createVerification(url: string): Promise<Models.Token>;
632
+ /**
633
+ * Create email verification (confirmation)
634
+ *
635
+ * Use this endpoint to complete the user email verification process. Use both
636
+ * the **userId** and **secret** parameters that were attached to your app URL
637
+ * to verify the user email ownership. If confirmed this route will return a
638
+ * 200 status code.
639
+ *
640
+ * @param {string} userId
641
+ * @param {string} secret
642
+ * @throws {AppwriteException}
643
+ * @returns {Promise}
644
+ */
645
+ updateVerification(userId: string, secret: string): Promise<Models.Token>;
646
+ /**
647
+ * Create phone verification
648
+ *
649
+ * Use this endpoint to send a verification SMS to the currently logged in
650
+ * user. This endpoint is meant for use after updating a user's phone number
651
+ * using the
652
+ * [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone)
653
+ * endpoint. Learn more about how to [complete the verification
654
+ * process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification).
655
+ * The verification code sent to the user's phone number is valid for 15
656
+ * minutes.
657
+ *
658
+ * @throws {AppwriteException}
659
+ * @returns {Promise}
660
+ */
661
+ createPhoneVerification(): Promise<Models.Token>;
662
+ /**
663
+ * Create phone verification (confirmation)
664
+ *
665
+ * Use this endpoint to complete the user phone verification process. Use the
666
+ * **userId** and **secret** that were sent to your user's phone number to
667
+ * verify the user email ownership. If confirmed this route will return a 200
668
+ * status code.
669
+ *
670
+ * @param {string} userId
671
+ * @param {string} secret
672
+ * @throws {AppwriteException}
673
+ * @returns {Promise}
674
+ */
675
+ updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
676
+ }