Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.6.x #23

Merged
merged 8 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.9.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.32.0"),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.19.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.58.0"),
],
targets: [
.target(
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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

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

> This is the Swift SDK for integrating with Appwrite from your Swift server-side code. If you're looking for the Apple SDK you should check [appwrite/sdk-for-apple](https://github.com/appwrite/sdk-for-apple)

Expand All @@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:

```swift
dependencies: [
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "5.0.2"),
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "6.0.0"),
],
```

Expand Down
10 changes: 8 additions & 2 deletions Sources/Appwrite/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ open class Client {
"x-sdk-name": "Swift",
"x-sdk-platform": "server",
"x-sdk-language": "swift",
"x-sdk-version": "5.0.2",
"x-appwrite-response-format": "1.5.0"
"x-sdk-version": "6.0.0",
"x-appwrite-response-format": "1.6.0"
]

internal var config: [String: String] = [:]
Expand Down Expand Up @@ -386,6 +386,12 @@ open class Client {
timeout: .seconds(30)
)

if let warning = response.headers["x-appwrite-warning"].first {
warning.split(separator: ";").forEach { warning in
print("Warning: \(warning)")
}
}

switch response.status.code {
case 0..<400:
switch T.self {
Expand Down
20 changes: 8 additions & 12 deletions Sources/Appwrite/Services/Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ open class Account: Service {
///
open func createJWT(
) async throws -> AppwriteModels.Jwt {
let apiPath: String = "/account/jwt"
let apiPath: String = "/account/jwts"

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

Expand Down Expand Up @@ -402,7 +402,7 @@ open class Account: Service {
}

///
/// Add Authenticator
/// Create Authenticator
///
/// Add an authenticator app to be used as an MFA factor. Verify the
/// authenticator using the [verify
Expand Down Expand Up @@ -443,7 +443,7 @@ open class Account: Service {
///
/// Verify an authenticator app after adding it using the [add
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
/// method. add
/// method.
///
/// @param AppwriteEnums.AuthenticatorType type
/// @param String otp
Expand Down Expand Up @@ -484,7 +484,7 @@ open class Account: Service {
///
/// Verify an authenticator app after adding it using the [add
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
/// method. add
/// method.
///
/// @param AppwriteEnums.AuthenticatorType type
/// @param String otp
Expand All @@ -508,20 +508,16 @@ open class Account: Service {
/// Delete an authenticator for a user by ID.
///
/// @param AppwriteEnums.AuthenticatorType type
/// @param String otp
/// @throws Exception
/// @return array
///
open func deleteMfaAuthenticator(
type: AppwriteEnums.AuthenticatorType,
otp: String
type: AppwriteEnums.AuthenticatorType
) async throws -> Any {
let apiPath: String = "/account/mfa/authenticators/{type}"
.replacingOccurrences(of: "{type}", with: type.rawValue)

let apiParams: [String: Any?] = [
"otp": otp
]
let apiParams: [String: Any] = [:]

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

///
/// Create 2FA Challenge
/// Create MFA Challenge
///
/// Begin the process of MFA verification after sign-in. Finish the flow with
/// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
Expand Down Expand Up @@ -1877,7 +1873,7 @@ open class Account: Service {
}

///
/// Create phone verification (confirmation)
/// Update phone verification (confirmation)
///
/// Use this endpoint to complete the user phone verification process. Use the
/// **userId** and **secret** that were sent to your user's phone number to
Expand Down
2 changes: 2 additions & 0 deletions Sources/Appwrite/Services/Avatars.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ open class Avatars: Service {
/// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote
/// website URL.
///
/// This endpoint does not follow HTTP redirects.
///
/// @param String url
/// @throws Exception
Expand Down Expand Up @@ -200,6 +201,7 @@ open class Avatars: Service {
/// image at source quality. If dimensions are not specified, the default size
/// of image returned is 400x400px.
///
/// This endpoint does not follow HTTP redirects.
///
/// @param String url
/// @param Int width
Expand Down
Loading