functions-swift

警告

此仓库已弃用,并已迁移至 monorepo。仓库将保持可用以支持旧版本的库,但任何新的更新必须在 monorepo 上完成。

用于与 Supabase Functions 交互的 Swift 客户端库。

用法

let client = FunctionsClient(
  url: URL(string: "https://project-id.supabase.com/functions/v1")!,
  headers: [
    "apikey": "project-api-key"
  ]
)

struct Response: Decodable {
  let message: String
}

let response: Response = try await client.invoke(
  functionName: "hello-world",
  invokeOptions: FunctionInvokeOptions(body: ["name": "Functions"])
)

assert(response.message = "Hello Functions")