Configuration
Configure Swift authentication, networking, retries, and request overrides
Overview
Configuration is optional. The SDK's defaults are suitable for most integrations, so you only need this guide when you want fine-grained control over behavior such as retries, timeouts, networking, and per-request overrides.
import Insion
let client = InsionClient(
token: "<token>",
timeout: 30,
maxRetries: 2
)Keep the API key on a trusted server. Never embed it in an application bundle, logs, or source control.
The client is Sendable; create one shared instance for an application. You can pass an async token supplier, shared headers, or a configured URLSession.
Per-request options
Every operation accepts requestOptions for timeout, additional headers, additional query parameters, and other one-off transport values.
let page = try await client.listRecords(
limit: 50,
requestOptions: .init(
timeout: 10,
additionalHeaders: ["X-Request-ID": "req-123"]
)
)The default timeout is 60 seconds. Prefer task cancellation for call lifecycle control.
How is this guide?