@@ -2028,10 +2028,59 @@ open class Account: Service {
20282028 /// - Throws: Exception if the request fails
20292029 /// - Returns: AppwriteModels.Token
20302030 ///
2031+ open func createEmailVerification(
2032+ url: String
2033+ ) async throws -> AppwriteModels . Token {
2034+ let apiPath : String = " /account/verifications/email "
2035+
2036+ let apiParams : [ String : Any ? ] = [
2037+ " url " : url
2038+ ]
2039+
2040+ let apiHeaders : [ String : String ] = [
2041+ " content-type " : " application/json "
2042+ ]
2043+
2044+ let converter : ( Any ) -> AppwriteModels . Token = { response in
2045+ return AppwriteModels . Token. from ( map: response as! [ String : Any ] )
2046+ }
2047+
2048+ return try await client. call (
2049+ method: " POST " ,
2050+ path: apiPath,
2051+ headers: apiHeaders,
2052+ params: apiParams,
2053+ converter: converter
2054+ )
2055+ }
2056+
2057+ ///
2058+ /// Use this endpoint to send a verification message to your user email address
2059+ /// to confirm they are the valid owners of that address. Both the **userId**
2060+ /// and **secret** arguments will be passed as query parameters to the URL you
2061+ /// have provided to be attached to the verification email. The provided URL
2062+ /// should redirect the user back to your app and allow you to complete the
2063+ /// verification process by verifying both the **userId** and **secret**
2064+ /// parameters. Learn more about how to [complete the verification
2065+ /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
2066+ /// The verification link sent to the user's email address is valid for 7 days.
2067+ ///
2068+ /// Please note that in order to avoid a [Redirect
2069+ /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
2070+ /// the only valid redirect URLs are the ones from domains you have set when
2071+ /// adding your platforms in the console interface.
2072+ ///
2073+ ///
2074+ /// - Parameters:
2075+ /// - url: String
2076+ /// - Throws: Exception if the request fails
2077+ /// - Returns: AppwriteModels.Token
2078+ ///
2079+ @available ( * , deprecated, message: " This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead. " )
20312080 open func createVerification(
20322081 url: String
20332082 ) async throws -> AppwriteModels . Token {
2034- let apiPath : String = " /account/verification "
2083+ let apiPath : String = " /account/verifications/email "
20352084
20362085 let apiParams : [ String : Any ? ] = [
20372086 " url " : url
@@ -2066,11 +2115,52 @@ open class Account: Service {
20662115 /// - Throws: Exception if the request fails
20672116 /// - Returns: AppwriteModels.Token
20682117 ///
2118+ open func updateEmailVerification(
2119+ userId: String ,
2120+ secret: String
2121+ ) async throws -> AppwriteModels . Token {
2122+ let apiPath : String = " /account/verifications/email "
2123+
2124+ let apiParams : [ String : Any ? ] = [
2125+ " userId " : userId,
2126+ " secret " : secret
2127+ ]
2128+
2129+ let apiHeaders : [ String : String ] = [
2130+ " content-type " : " application/json "
2131+ ]
2132+
2133+ let converter : ( Any ) -> AppwriteModels . Token = { response in
2134+ return AppwriteModels . Token. from ( map: response as! [ String : Any ] )
2135+ }
2136+
2137+ return try await client. call (
2138+ method: " PUT " ,
2139+ path: apiPath,
2140+ headers: apiHeaders,
2141+ params: apiParams,
2142+ converter: converter
2143+ )
2144+ }
2145+
2146+ ///
2147+ /// Use this endpoint to complete the user email verification process. Use both
2148+ /// the **userId** and **secret** parameters that were attached to your app URL
2149+ /// to verify the user email ownership. If confirmed this route will return a
2150+ /// 200 status code.
2151+ ///
2152+ /// - Parameters:
2153+ /// - userId: String
2154+ /// - secret: String
2155+ /// - Throws: Exception if the request fails
2156+ /// - Returns: AppwriteModels.Token
2157+ ///
2158+ @available ( * , deprecated, message: " This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. " )
20692159 open func updateVerification(
20702160 userId: String ,
20712161 secret: String
20722162 ) async throws -> AppwriteModels . Token {
2073- let apiPath : String = " /account/verification "
2163+ let apiPath : String = " /account/verifications/email "
20742164
20752165 let apiParams : [ String : Any ? ] = [
20762166 " userId " : userId,
@@ -2109,7 +2199,7 @@ open class Account: Service {
21092199 ///
21102200 open func createPhoneVerification(
21112201 ) async throws -> AppwriteModels . Token {
2112- let apiPath : String = " /account/verification /phone "
2202+ let apiPath : String = " /account/verifications /phone "
21132203
21142204 let apiParams : [ String : Any ] = [ : ]
21152205
@@ -2146,7 +2236,7 @@ open class Account: Service {
21462236 userId: String ,
21472237 secret: String
21482238 ) async throws -> AppwriteModels . Token {
2149- let apiPath : String = " /account/verification /phone "
2239+ let apiPath : String = " /account/verifications /phone "
21502240
21512241 let apiParams : [ String : Any ? ] = [
21522242 " userId " : userId,
0 commit comments