Skip to content

Commit f3e05c7

Browse files
committed
chore: regen
1 parent a3f7cb3 commit f3e05c7

File tree

9 files changed

+140
-18
lines changed

9 files changed

+140
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## 13.0.1
4+
5+
* Deprecate `createVerification` method in `Account` service
6+
* Add `createEmailVerification` method in `Account` service
7+
38
## 10.2.0
49

510
* Update sdk to use swift-native doc comments instead of jsdoc styled comments as per [Swift Documentation Comments](https://github.com/swiftlang/swift/blob/main/docs/DocumentationComments.md)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:
3333

3434
```swift
3535
dependencies: [
36-
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "13.0.0"),
36+
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "13.0.1"),
3737
],
3838
```
3939

Sources/Appwrite/Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open class Client {
2121
"x-sdk-name": "Swift",
2222
"x-sdk-platform": "server",
2323
"x-sdk-language": "swift",
24-
"x-sdk-version": "13.0.0",
24+
"x-sdk-version": "13.0.1",
2525
"x-appwrite-response-format": "1.8.0"
2626
]
2727

Sources/Appwrite/Services/Account.swift

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

Sources/Appwrite/Services/Functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ open class Functions: Service {
514514
/// Create a deployment based on a template.
515515
///
516516
/// Use this endpoint with combination of
517-
/// [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to
517+
/// [listTemplates](https://appwrite.io/docs/products/functions/templates) to
518518
/// find the template details.
519519
///
520520
/// - Parameters:

Sources/Appwrite/Services/Sites.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ open class Sites: Service {
505505
/// Create a deployment based on a template.
506506
///
507507
/// Use this endpoint with combination of
508-
/// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to
509-
/// find the template details.
508+
/// [listTemplates](https://appwrite.io/docs/products/sites/templates) to find
509+
/// the template details.
510510
///
511511
/// - Parameters:
512512
/// - siteId: String

Sources/Appwrite/Services/TablesDb.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ open class TablesDB: Service {
227227
///
228228
/// Create a new Table. Before using this route, you should create a new
229229
/// database resource using either a [server
230-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
230+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
231231
/// API or directly from your database console.
232232
///
233233
/// - Parameters:
@@ -2062,7 +2062,7 @@ open class TablesDB: Service {
20622062
///
20632063
/// Create a new Row. Before using this route, you should create a new table
20642064
/// resource using either a [server
2065-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2065+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
20662066
/// API or directly from your database console.
20672067
///
20682068
/// - Parameters:
@@ -2112,7 +2112,7 @@ open class TablesDB: Service {
21122112
///
21132113
/// Create a new Row. Before using this route, you should create a new table
21142114
/// resource using either a [server
2115-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2115+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
21162116
/// API or directly from your database console.
21172117
///
21182118
/// - Parameters:
@@ -2144,7 +2144,7 @@ open class TablesDB: Service {
21442144
///
21452145
/// Create new Rows. Before using this route, you should create a new table
21462146
/// resource using either a [server
2147-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2147+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
21482148
/// API or directly from your database console.
21492149
///
21502150
/// - Parameters:
@@ -2188,7 +2188,7 @@ open class TablesDB: Service {
21882188
///
21892189
/// Create new Rows. Before using this route, you should create a new table
21902190
/// resource using either a [server
2191-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2191+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
21922192
/// API or directly from your database console.
21932193
///
21942194
/// - Parameters:
@@ -2214,7 +2214,7 @@ open class TablesDB: Service {
22142214
///
22152215
/// Create or update Rows. Before using this route, you should create a new
22162216
/// table resource using either a [server
2217-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2217+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
22182218
/// API or directly from your database console.
22192219
///
22202220
///
@@ -2259,7 +2259,7 @@ open class TablesDB: Service {
22592259
///
22602260
/// Create or update Rows. Before using this route, you should create a new
22612261
/// table resource using either a [server
2262-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2262+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
22632263
/// API or directly from your database console.
22642264
///
22652265
///
@@ -2494,7 +2494,7 @@ open class TablesDB: Service {
24942494
///
24952495
/// Create or update a Row. Before using this route, you should create a new
24962496
/// table resource using either a [server
2497-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2497+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
24982498
/// API or directly from your database console.
24992499
///
25002500
/// - Parameters:
@@ -2544,7 +2544,7 @@ open class TablesDB: Service {
25442544
///
25452545
/// Create or update a Row. Before using this route, you should create a new
25462546
/// table resource using either a [server
2547-
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
2547+
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
25482548
/// API or directly from your database console.
25492549
///
25502550
/// - Parameters:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Appwrite
2+
3+
let client = Client()
4+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
5+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
6+
.setSession("") // The user session to authenticate with
7+
8+
let account = Account(client)
9+
10+
let token = try await account.createEmailVerification(
11+
url: "https://example.com"
12+
)
13+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Appwrite
2+
3+
let client = Client()
4+
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
5+
.setProject("<YOUR_PROJECT_ID>") // Your project ID
6+
.setSession("") // The user session to authenticate with
7+
8+
let account = Account(client)
9+
10+
let token = try await account.updateEmailVerification(
11+
userId: "<USER_ID>",
12+
secret: "<SECRET>"
13+
)
14+

0 commit comments

Comments
 (0)