安装
Add InsForge to your Swift Package Manager dependencies:Enable Logging (Optional)
For debugging, you can configure the SDK log level and destination:| Level | Description |
|---|---|
.trace | Most verbose, includes all internal details |
.debug | Detailed information for debugging |
.info | General operational information (default) |
.warning | Warnings that don’t prevent operation |
.error | Errors that affect functionality |
.critical | Critical failures |
| Destination | Description |
|---|---|
.console | Standard output (print) |
.osLog | Apple’s unified logging system (recommended for iOS/macOS) |
.none | Disable logging |
.custom | Provide your own LogHandler factory |
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 方法有三个重载:
-
使用字典体,返回类型化响应
-
使用 Encodable 体,返回类型化响应
-
不期望响应体
SDK 自动包含来自登录用户的身份验证令牌。