@@ -2210,10 +2210,59 @@ open class Account: Service {
22102210 /// - Throws: Exception if the request fails
22112211 /// - Returns: AppwriteModels.Token
22122212 ///
2213+ open func createEmailVerification(
2214+ url: String
2215+ ) async throws -> AppwriteModels . Token {
2216+ let apiPath : String = " /account/verifications/email "
2217+
2218+ let apiParams : [ String : Any ? ] = [
2219+ " url " : url
2220+ ]
2221+
2222+ let apiHeaders : [ String : String ] = [
2223+ " content-type " : " application/json "
2224+ ]
2225+
2226+ let converter : ( Any ) -> AppwriteModels . Token = { response in
2227+ return AppwriteModels . Token. from ( map: response as! [ String : Any ] )
2228+ }
2229+
2230+ return try await client. call (
2231+ method: " POST " ,
2232+ path: apiPath,
2233+ headers: apiHeaders,
2234+ params: apiParams,
2235+ converter: converter
2236+ )
2237+ }
2238+
2239+ ///
2240+ /// Use this endpoint to send a verification message to your user email address
2241+ /// to confirm they are the valid owners of that address. Both the **userId**
2242+ /// and **secret** arguments will be passed as query parameters to the URL you
2243+ /// have provided to be attached to the verification email. The provided URL
2244+ /// should redirect the user back to your app and allow you to complete the
2245+ /// verification process by verifying both the **userId** and **secret**
2246+ /// parameters. Learn more about how to [complete the verification
2247+ /// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
2248+ /// The verification link sent to the user's email address is valid for 7 days.
2249+ ///
2250+ /// Please note that in order to avoid a [Redirect
2251+ /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
2252+ /// the only valid redirect URLs are the ones from domains you have set when
2253+ /// adding your platforms in the console interface.
2254+ ///
2255+ ///
2256+ /// - Parameters:
2257+ /// - url: String
2258+ /// - Throws: Exception if the request fails
2259+ /// - Returns: AppwriteModels.Token
2260+ ///
2261+ @available ( * , deprecated, message: " This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead. " )
22132262 open func createVerification(
22142263 url: String
22152264 ) async throws -> AppwriteModels . Token {
2216- let apiPath : String = " /account/verification "
2265+ let apiPath : String = " /account/verifications/email "
22172266
22182267 let apiParams : [ String : Any ? ] = [
22192268 " url " : url
@@ -2248,11 +2297,52 @@ open class Account: Service {
22482297 /// - Throws: Exception if the request fails
22492298 /// - Returns: AppwriteModels.Token
22502299 ///
2300+ open func updateEmailVerification(
2301+ userId: String ,
2302+ secret: String
2303+ ) async throws -> AppwriteModels . Token {
2304+ let apiPath : String = " /account/verifications/email "
2305+
2306+ let apiParams : [ String : Any ? ] = [
2307+ " userId " : userId,
2308+ " secret " : secret
2309+ ]
2310+
2311+ let apiHeaders : [ String : String ] = [
2312+ " content-type " : " application/json "
2313+ ]
2314+
2315+ let converter : ( Any ) -> AppwriteModels . Token = { response in
2316+ return AppwriteModels . Token. from ( map: response as! [ String : Any ] )
2317+ }
2318+
2319+ return try await client. call (
2320+ method: " PUT " ,
2321+ path: apiPath,
2322+ headers: apiHeaders,
2323+ params: apiParams,
2324+ converter: converter
2325+ )
2326+ }
2327+
2328+ ///
2329+ /// Use this endpoint to complete the user email verification process. Use both
2330+ /// the **userId** and **secret** parameters that were attached to your app URL
2331+ /// to verify the user email ownership. If confirmed this route will return a
2332+ /// 200 status code.
2333+ ///
2334+ /// - Parameters:
2335+ /// - userId: String
2336+ /// - secret: String
2337+ /// - Throws: Exception if the request fails
2338+ /// - Returns: AppwriteModels.Token
2339+ ///
2340+ @available ( * , deprecated, message: " This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. " )
22512341 open func updateVerification(
22522342 userId: String ,
22532343 secret: String
22542344 ) async throws -> AppwriteModels . Token {
2255- let apiPath : String = " /account/verification "
2345+ let apiPath : String = " /account/verifications/email "
22562346
22572347 let apiParams : [ String : Any ? ] = [
22582348 " userId " : userId,
@@ -2291,7 +2381,7 @@ open class Account: Service {
22912381 ///
22922382 open func createPhoneVerification(
22932383 ) async throws -> AppwriteModels . Token {
2294- let apiPath : String = " /account/verification /phone "
2384+ let apiPath : String = " /account/verifications /phone "
22952385
22962386 let apiParams : [ String : Any ] = [ : ]
22972387
@@ -2328,7 +2418,7 @@ open class Account: Service {
23282418 userId: String ,
23292419 secret: String
23302420 ) async throws -> AppwriteModels . Token {
2331- let apiPath : String = " /account/verification /phone "
2421+ let apiPath : String = " /account/verifications /phone "
23322422
23332423 let apiParams : [ String : Any ? ] = [
23342424 " userId " : userId,
0 commit comments