Saltar al contenido principal

Instalación

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.
Actualmente, InsForge solo admite funciones JavaScript/TypeScript ejecutándose en un entorno Deno.

invoke()

Invoca una función sin servidor por slug.

Parámetros

  • slug (String) - Slug/nombre de función
  • body ([String: Any], optional) - Cuerpo de solicitud como diccionario

Sobrecargas

El método invoke tiene tres sobrecargas:
  1. Con cuerpo de diccionario, devolviendo respuesta tipada
  2. Con cuerpo Encodable, devolviendo respuesta tipada
  3. Sin esperar cuerpo de respuesta
SDK incluye automáticamente el token de autenticación del usuario conectado.

Ejemplos

Ejemplo: Invocación básica con respuesta tipada

Ejemplo: Con cuerpo de solicitud Encodable


Manejo de errores