diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ffa37c..df3170c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 13.3.1 + +* Fix `onOpen` callback not being called when the websocket connection is established +* Fix add missing `scheduled` value to `ExecutionStatus` enum + ## 13.3.0 * Add `onOpen`, `onClose` and `onError` callbacks to `Realtime` service diff --git a/README.md b/README.md index 5310269..4639c71 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Add the package to your `Package.swift` dependencies: ```swift dependencies: [ - .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "13.3.0"), + .package(url: "git@github.com:appwrite/sdk-for-apple.git", from: "13.3.1"), ], ``` diff --git a/Sources/Appwrite/Client.swift b/Sources/Appwrite/Client.swift index 7e8fc3c..fc686c2 100644 --- a/Sources/Appwrite/Client.swift +++ b/Sources/Appwrite/Client.swift @@ -23,7 +23,7 @@ open class Client { "x-sdk-name": "Apple", "x-sdk-platform": "client", "x-sdk-language": "apple", - "x-sdk-version": "13.3.0", + "x-sdk-version": "13.3.1", "x-appwrite-response-format": "1.8.0" ] diff --git a/Sources/Appwrite/WebSockets/WebSocketClient.swift b/Sources/Appwrite/WebSockets/WebSocketClient.swift index 72322b7..e28502e 100644 --- a/Sources/Appwrite/WebSockets/WebSocketClient.swift +++ b/Sources/Appwrite/WebSockets/WebSocketClient.swift @@ -297,7 +297,13 @@ public class WebSocketClient { self.channel = channel } - return channel.pipeline.addHandler(handler) + return channel.pipeline.addHandler(handler).map { + if let delegate = self.delegate { + delegate.onOpen(channel: channel) + } else { + self.onOpen(channel) + } + } } // MARK: - Close connection diff --git a/Sources/AppwriteEnums/ExecutionStatus.swift b/Sources/AppwriteEnums/ExecutionStatus.swift index 2f167a9..e27392f 100644 --- a/Sources/AppwriteEnums/ExecutionStatus.swift +++ b/Sources/AppwriteEnums/ExecutionStatus.swift @@ -5,6 +5,7 @@ public enum ExecutionStatus: String, CustomStringConvertible { case processing = "processing" case completed = "completed" case failed = "failed" + case scheduled = "scheduled" public var description: String { return rawValue diff --git a/Sources/AppwriteModels/Execution.swift b/Sources/AppwriteModels/Execution.swift index 47d7734..625fd39 100644 --- a/Sources/AppwriteModels/Execution.swift +++ b/Sources/AppwriteModels/Execution.swift @@ -47,7 +47,7 @@ open class Execution: Codable { /// The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. public let trigger: AppwriteEnums.ExecutionTrigger - /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. + /// The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. public let status: AppwriteEnums.ExecutionStatus /// HTTP request method type. diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index d7fa796..7513244 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -17,7 +17,7 @@ let document = try await databases.createDocument( "age": 30, "isAdmin": false ], - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index d626d7d..33dce44 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -11,7 +11,7 @@ let document = try await databases.updateDocument( collectionId: "", documentId: "", data: [:], // optional - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 8e2a4a0..e678632 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -11,7 +11,7 @@ let document = try await databases.upsertDocument( collectionId: "", documentId: "", data: [:], - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index 2db9b20..938783e 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -10,6 +10,6 @@ let file = try await storage.createFile( bucketId: "", fileId: "", file: InputFile.fromPath("file.png"), - permissions: ["read("any")"] // optional + permissions: [Permission.read(Role.any())] // optional ) diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index adef969..9859d2a 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -10,6 +10,6 @@ let file = try await storage.updateFile( bucketId: "", fileId: "", name: "", // optional - permissions: ["read("any")"] // optional + permissions: [Permission.read(Role.any())] // optional ) diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 4d66980..ade012c 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -17,7 +17,7 @@ let row = try await tablesDB.createRow( "age": 30, "isAdmin": false ], - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index cd5591d..90bf66a 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -11,7 +11,7 @@ let row = try await tablesDB.updateRow( tableId: "", rowId: "", data: [:], // optional - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional ) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 955935a..5665f92 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -11,7 +11,7 @@ let row = try await tablesDB.upsertRow( tableId: "", rowId: "", data: [:], // optional - permissions: ["read("any")"], // optional + permissions: [Permission.read(Role.any())], // optional transactionId: "" // optional )