跳轉到主要內容

安裝

Add InsForge to your Swift Package Manager dependencies:

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
Log Levels:
LevelDescription
.traceMost verbose, includes all internal details
.debugDetailed information for debugging
.infoGeneral operational information (default)
.warningWarnings that don’t prevent operation
.errorErrors that affect functionality
.criticalCritical failures
Log Destinations:
DestinationDescription
.consoleStandard output (print)
.osLogApple’s unified logging system (recommended for iOS/macOS)
.noneDisable logging
.customProvide 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 方法有三個多載:
  1. 使用字典主體,傳回類型化回應
  2. 使用 Encodable 主體,傳回類型化回應
  3. 不期望回應主體
SDK 會自動包含來自登入使用者的驗證令牌。

範例

範例:基本叫用與類型化回應

範例:使用 Encodable 要求主體


錯誤處理