Files
fal-swift/Sources/FalClient/Queue+Codable.swift
Daniel Rochetti 24f531005d feat: realtime binary protocol (#3)
* 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
2023-12-12 11:00:07 -08:00

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)
)
}
}