Skip to main content

安装

Add InsForge to your Swift Package Manager dependencies:

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
Log Levels: Log Destinations:
Use .info or .error in production to avoid exposing sensitive data in logs.
目前,InsForge 仅支持在 Deno 环境中运行的 JavaScript/TypeScript 函数。

invoke()

按 slug 调用无服务器函数。

参数

  • slug (String) - 函数 slug/名称
  • body ([String: Any], optional) - 请求体作为字典

重载

invoke 方法有三个重载:
  1. 使用字典体,返回类型化响应
  2. 使用 Encodable 体,返回类型化响应
  3. 不期望响应体
SDK 自动包含来自登录用户的身份验证令牌。

示例

示例:基本调用与类型化响应

示例:使用 Encodable 请求体


错误处理