@@ -350,6 +350,8 @@ open class Account: Service {
350350 ///
351351 /// Update MFA
352352 ///
353+ /// Enable or disable MFA on an account.
354+ ///
353355 /// @param Bool mfa
354356 /// @throws Exception
355357 /// @return array
@@ -384,6 +386,8 @@ open class Account: Service {
384386 ///
385387 /// Update MFA
386388 ///
389+ /// Enable or disable MFA on an account.
390+ ///
387391 /// @param Bool mfa
388392 /// @throws Exception
389393 /// @return array
@@ -433,6 +437,8 @@ open class Account: Service {
433437 ///
434438 /// Create MFA Challenge (confirmation)
435439 ///
440+ /// Complete the MFA challenge by providing the one-time password.
441+ ///
436442 /// @param String challengeId
437443 /// @param String otp
438444 /// @throws Exception
@@ -463,6 +469,8 @@ open class Account: Service {
463469 ///
464470 /// List Factors
465471 ///
472+ /// List the factors available on the account to be used as a MFA challange.
473+ ///
466474 /// @throws Exception
467475 /// @return array
468476 ///
@@ -492,6 +500,11 @@ open class Account: Service {
492500 ///
493501 /// Add Authenticator
494502 ///
503+ /// Add an authenticator app to be used as an MFA factor. Verify the
504+ /// authenticator using the [verify
505+ /// authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
506+ /// method.
507+ ///
495508 /// @param AppwriteEnums.AuthenticatorType type
496509 /// @throws Exception
497510 /// @return array
@@ -524,6 +537,10 @@ open class Account: Service {
524537 ///
525538 /// Verify Authenticator
526539 ///
540+ /// Verify an authenticator app after adding it using the [add
541+ /// authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
542+ /// method.
543+ ///
527544 /// @param AppwriteEnums.AuthenticatorType type
528545 /// @param String otp
529546 /// @throws Exception
@@ -561,6 +578,10 @@ open class Account: Service {
561578 ///
562579 /// Verify Authenticator
563580 ///
581+ /// Verify an authenticator app after adding it using the [add
582+ /// authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
583+ /// method.
584+ ///
564585 /// @param AppwriteEnums.AuthenticatorType type
565586 /// @param String otp
566587 /// @throws Exception
@@ -580,6 +601,8 @@ open class Account: Service {
580601 ///
581602 /// Delete Authenticator
582603 ///
604+ /// Delete an authenticator for a user by ID.
605+ ///
583606 /// @param AppwriteEnums.AuthenticatorType type
584607 /// @param String otp
585608 /// @throws Exception
@@ -617,6 +640,8 @@ open class Account: Service {
617640 ///
618641 /// Delete Authenticator
619642 ///
643+ /// Delete an authenticator for a user by ID.
644+ ///
620645 /// @param AppwriteEnums.AuthenticatorType type
621646 /// @param String otp
622647 /// @throws Exception
@@ -1158,7 +1183,7 @@ open class Account: Service {
11581183 }
11591184
11601185 ///
1161- /// Create session (deprecated)
1186+ /// Update magic URL session
11621187 ///
11631188 /// Use this endpoint to create a session from token. Provide the **userId**
11641189 /// and **secret** parameters from the successful response of authentication
@@ -1198,57 +1223,42 @@ open class Account: Service {
11981223 }
11991224
12001225 ///
1201- /// Create OAuth2 session
1226+ /// Update phone session
12021227 ///
1203- /// Allow the user to login to their account using the OAuth2 provider of their
1204- /// choice. Each OAuth2 provider should be enabled from the Appwrite console
1205- /// first. Use the success and failure arguments to provide a redirect URL's
1206- /// back to your app when login is completed.
1207- ///
1208- /// If there is already an active session, the new session will be attached to
1209- /// the logged-in account. If there are no active sessions, the server will
1210- /// attempt to look for a user with the same email address as the email
1211- /// received from the OAuth2 provider and attach the new session to the
1212- /// existing user. If no matching user is found - the server will create a new
1213- /// user.
1214- ///
1215- /// A user is limited to 10 active sessions at a time by default. [Learn more
1216- /// about session
1217- /// limits](https://appwrite.io/docs/authentication-security#limits).
1218- ///
1228+ /// Use this endpoint to create a session from token. Provide the **userId**
1229+ /// and **secret** parameters from the successful response of authentication
1230+ /// flows initiated by token creation. For example, magic URL and phone login.
12191231 ///
1220- /// @param AppwriteEnums.OAuthProvider provider
1221- /// @param String success
1222- /// @param String failure
1223- /// @param [String] scopes
1232+ /// @param String userId
1233+ /// @param String secret
12241234 /// @throws Exception
12251235 /// @return array
12261236 ///
1227- open func createOAuth2Session(
1228- provider: AppwriteEnums . OAuthProvider ,
1229- success: String ? = nil ,
1230- failure: String ? = nil ,
1231- scopes: [ String ] ? = nil
1232- ) async throws -> String ? {
1233- let apiPath : String = " /account/sessions/oauth2/{provider} "
1234- . replacingOccurrences ( of: " {provider} " , with: provider. rawValue)
1237+ open func updatePhoneSession(
1238+ userId: String ,
1239+ secret: String
1240+ ) async throws -> AppwriteModels . Session {
1241+ let apiPath : String = " /account/sessions/phone "
12351242
12361243 let apiParams : [ String : Any ? ] = [
1237- " success " : success,
1238- " failure " : failure,
1239- " scopes " : scopes,
1240- " project " : client. config [ " project " ]
1244+ " userId " : userId,
1245+ " secret " : secret
12411246 ]
12421247
12431248 let apiHeaders : [ String : String ] = [
12441249 " content-type " : " application/json "
12451250 ]
12461251
1247- return try await client. redirect (
1248- method: " GET " ,
1252+ let converter : ( Any ) -> AppwriteModels . Session = { response in
1253+ return AppwriteModels . Session. from ( map: response as! [ String : Any ] )
1254+ }
1255+
1256+ return try await client. call (
1257+ method: " PUT " ,
12491258 path: apiPath,
12501259 headers: apiHeaders,
1251- params: apiParams
1260+ params: apiParams,
1261+ converter: converter
12521262 )
12531263 }
12541264
@@ -1328,7 +1338,7 @@ open class Account: Service {
13281338 }
13291339
13301340 ///
1331- /// Update (or renew) a session
1341+ /// Update (or renew) session
13321342 ///
13331343 /// Extend session's expiry to increase it's lifespan. Extending a session is
13341344 /// useful when session length is short such as 5 minutes.
0 commit comments