mirror of
https://github.com/zhigang1992/fal-swift.git
synced 2026-01-12 22:47:17 +08:00
* feat: initial high fps sample * fix: remove prints * feat: realtime turbo camera demo * fix: fps count * chore: docs and build update * fix: remove non-exported targets * feat: binary realtime protocol with msgpack * fix: update macos support to v13 * chore: rename ObjectValue to Payload
25 lines
761 B
Swift
25 lines
761 B
Swift
|
|
|
|
public struct QueueSubmitResult: Decodable {
|
|
let requestId: String
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case requestId = "request_id"
|
|
}
|
|
}
|
|
|
|
public extension Queue {
|
|
func submit(_ id: String, input: (some Encodable) = EmptyInput.empty, webhookUrl _: String? = nil) async throws -> String {
|
|
let result: QueueSubmitResult = try await client.run(id, input: input, options: .route("/fal/queue/submit"))
|
|
return result.requestId
|
|
}
|
|
|
|
func response<Output: Decodable>(_ id: String, of requestId: String) async throws -> Output {
|
|
try await client.run(
|
|
id,
|
|
input: EmptyInput.empty,
|
|
options: .route("/fal/queue/requests/\(requestId)/response", withMethod: .get)
|
|
)
|
|
}
|
|
}
|