安裝
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 會自動包含來自登入使用者的驗證令牌。