Skip to content

Commit 3231f9b

Browse files
Merge pull request #61 from appwrite/1.6.x
1.6.x
2 parents 469a7a4 + f110d17 commit 3231f9b

File tree

148 files changed

+398
-140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+398
-140
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ let package = Package(
2222
),
2323
],
2424
dependencies: [
25-
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.17.0"),
26-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.32.0"),
25+
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.19.0"),
26+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.58.0"),
2727
],
2828
targets: [
2929
.target(

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-apple.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-apple.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.5.6-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**This SDK is compatible with Appwrite server version 1.5.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).**
10+
**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).**
1111

1212
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Apple SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1313

@@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies:
3131

3232
```swift
3333
dependencies: [
34-
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "6.0.0"),
34+
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "7.0.0"),
3535
],
3636
```
3737

Sources/Appwrite/Client.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ open class Client {
2323
"x-sdk-name": "Apple",
2424
"x-sdk-platform": "client",
2525
"x-sdk-language": "apple",
26-
"x-sdk-version": "6.0.0",
27-
"x-appwrite-response-format": "1.5.0"
26+
"x-sdk-version": "7.0.0",
27+
"x-appwrite-response-format": "1.6.0"
2828
]
2929

3030
internal var config: [String: String] = [:]
@@ -313,6 +313,12 @@ open class Client {
313313
timeout: .seconds(30)
314314
)
315315

316+
if let warning = response.headers["x-appwrite-warning"].first {
317+
warning.split(separator: ";").forEach { warning in
318+
print("Warning: \(warning)")
319+
}
320+
}
321+
316322
switch response.status.code {
317323
case 0..<400:
318324
if response.headers["Set-Cookie"].count > 0 {

Sources/Appwrite/OAuth/WebAuthComponent.swift

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,24 @@ public class WebAuthComponent {
5353
/// - url: The URL containing the cookie
5454
///
5555
public static func handleIncomingCookie(from url: URL) {
56-
let components = URLComponents(string: url.absoluteString)!
5756

58-
let cookieParts = [String: String](uniqueKeysWithValues: components.queryItems!.map {
59-
($0.name, $0.value!)
57+
guard let components = URLComponents(string: url.absoluteString),
58+
let queryItems = components.queryItems else {
59+
return
60+
}
61+
62+
let cookieParts = [String: String](uniqueKeysWithValues: queryItems.compactMap { item in
63+
item.value.map { (item.name, $0) }
6064
})
6165

62-
var domain = cookieParts["domain"]!
66+
guard var domain = cookieParts["domain"],
67+
let key = cookieParts["key"],
68+
let secret = cookieParts["secret"] else {
69+
return
70+
}
71+
6372
domain.remove(at: domain.startIndex)
6473

65-
let key: String = cookieParts["key"]!
66-
let secret: String = cookieParts["secret"]!
6774
let path: String? = cookieParts["path"]
6875
let expires: String? = cookieParts["expires"]
6976
let maxAge: String? = cookieParts["maxAge"]
@@ -92,10 +99,7 @@ public class WebAuthComponent {
9299
cookie += "; secure"
93100
}
94101

95-
let existing = UserDefaults.standard.stringArray(forKey: domain)
96-
let new = [cookie]
97-
98-
UserDefaults.standard.set(new, forKey: domain)
102+
UserDefaults.standard.set([cookie], forKey: domain)
99103

100104
WebAuthComponent.onCallback(
101105
scheme: components.scheme!,

Sources/Appwrite/Services/Account.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ open class Account: Service {
290290
///
291291
open func createJWT(
292292
) async throws -> AppwriteModels.Jwt {
293-
let apiPath: String = "/account/jwt"
293+
let apiPath: String = "/account/jwts"
294294

295295
let apiParams: [String: Any] = [:]
296296

@@ -402,7 +402,7 @@ open class Account: Service {
402402
}
403403

404404
///
405-
/// Add Authenticator
405+
/// Create Authenticator
406406
///
407407
/// Add an authenticator app to be used as an MFA factor. Verify the
408408
/// authenticator using the [verify
@@ -443,7 +443,7 @@ open class Account: Service {
443443
///
444444
/// Verify an authenticator app after adding it using the [add
445445
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
446-
/// method. add
446+
/// method.
447447
///
448448
/// @param AppwriteEnums.AuthenticatorType type
449449
/// @param String otp
@@ -484,7 +484,7 @@ open class Account: Service {
484484
///
485485
/// Verify an authenticator app after adding it using the [add
486486
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
487-
/// method. add
487+
/// method.
488488
///
489489
/// @param AppwriteEnums.AuthenticatorType type
490490
/// @param String otp
@@ -508,20 +508,16 @@ open class Account: Service {
508508
/// Delete an authenticator for a user by ID.
509509
///
510510
/// @param AppwriteEnums.AuthenticatorType type
511-
/// @param String otp
512511
/// @throws Exception
513512
/// @return array
514513
///
515514
open func deleteMfaAuthenticator(
516-
type: AppwriteEnums.AuthenticatorType,
517-
otp: String
515+
type: AppwriteEnums.AuthenticatorType
518516
) async throws -> Any {
519517
let apiPath: String = "/account/mfa/authenticators/{type}"
520518
.replacingOccurrences(of: "{type}", with: type.rawValue)
521519

522-
let apiParams: [String: Any?] = [
523-
"otp": otp
524-
]
520+
let apiParams: [String: Any] = [:]
525521

526522
let apiHeaders: [String: String] = [
527523
"content-type": "application/json"
@@ -535,7 +531,7 @@ open class Account: Service {
535531
}
536532

537533
///
538-
/// Create 2FA Challenge
534+
/// Create MFA Challenge
539535
///
540536
/// Begin the process of MFA verification after sign-in. Finish the flow with
541537
/// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -2037,7 +2033,7 @@ open class Account: Service {
20372033
}
20382034

20392035
///
2040-
/// Create phone verification (confirmation)
2036+
/// Update phone verification (confirmation)
20412037
///
20422038
/// Use this endpoint to complete the user phone verification process. Use the
20432039
/// **userId** and **secret** that were sent to your user's phone number to

Sources/Appwrite/Services/Avatars.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ open class Avatars: Service {
101101
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
102102
/// website URL.
103103
///
104+
/// This endpoint does not follow HTTP redirects.
104105
///
105106
/// @param String url
106107
/// @throws Exception
@@ -180,6 +181,7 @@ open class Avatars: Service {
180181
/// image at source quality. If dimensions are not specified, the default size
181182
/// of image returned is 400x400px.
182183
///
184+
/// This endpoint does not follow HTTP redirects.
183185
///
184186
/// @param String url
185187
/// @param Int width

Sources/Appwrite/Services/Functions.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ open class Functions: Service {
6464
/// @param String path
6565
/// @param AppwriteEnums.ExecutionMethod method
6666
/// @param Any headers
67+
/// @param String scheduledAt
6768
/// @throws Exception
6869
/// @return array
6970
///
@@ -73,7 +74,8 @@ open class Functions: Service {
7374
async: Bool? = nil,
7475
path: String? = nil,
7576
method: AppwriteEnums.ExecutionMethod? = nil,
76-
headers: Any? = nil
77+
headers: Any? = nil,
78+
scheduledAt: String? = nil
7779
) async throws -> AppwriteModels.Execution {
7880
let apiPath: String = "/functions/{functionId}/executions"
7981
.replacingOccurrences(of: "{functionId}", with: functionId)
@@ -83,7 +85,8 @@ open class Functions: Service {
8385
"async": async,
8486
"path": path,
8587
"method": method,
86-
"headers": headers
88+
"headers": headers,
89+
"scheduledAt": scheduledAt
8790
]
8891

8992
let apiHeaders: [String: String] = [

Sources/AppwriteModels/AlgoArgon2.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ public class AlgoArgon2 {
77
/// Algo type.
88
public let type: String
99

10+
1011
/// Memory used to compute hash.
1112
public let memoryCost: Int
1213

14+
1315
/// Amount of time consumed to compute hash
1416
public let timeCost: Int
1517

18+
1619
/// Number of threads used to compute hash.
1720
public let threads: Int
1821

1922

23+
2024
init(
2125
type: String,
2226
memoryCost: Int,

Sources/AppwriteModels/AlgoBcrypt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class AlgoBcrypt {
88
public let type: String
99

1010

11+
1112
init(
1213
type: String
1314
) {

Sources/AppwriteModels/AlgoMd5.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class AlgoMd5 {
88
public let type: String
99

1010

11+
1112
init(
1213
type: String
1314
) {

0 commit comments

Comments
 (0)