Figranium class is a final class with two initializers: a designated initializer that accepts a URL and an authentication enum, and a convenience initializer that accepts a String base URL and an optional API key. Every option is optional, and the SDK falls back to sensible defaults so a local install works with Figranium().
Initializers
Designated initializer
Client.swift
URL
Absolute URL of your Figranium server. Must use
http or https (enforced with a precondition). Defaults to http://localhost:11345.FigraniumAuthentication
Authentication strategy. Defaults to
.none. See Authentication for details.[String: String]
Default headers merged into every request. Per-call
RequestOptions.headers override these.TimeInterval
Client-wide default timeout for non-stream requests, in seconds. Defaults to
30.URLSession
The
URLSession used for all network requests. Defaults to .shared. The SDK never replaces a caller-supplied session.Convenience initializer
Client.swift
String
Absolute URL of your Figranium server as a string. Must be a valid URL (enforced with a
precondition). Defaults to "http://localhost:11345".String?
API key sent as
Authorization: Bearer <key> by default. When nil, authentication is .none.String
Header name for the API key. Defaults to
"authorization". Set to "x-api-key" if your deployment expects that header.TimeInterval
Client-wide default timeout for non-stream requests, in seconds. Defaults to
30.Option details
baseURL
example.swift
authentication
The FigraniumAuthentication enum has three cases:
.apiKey(String, header: String = "authorization")sends the key asAuthorization: Bearer <key>when the header is"authorization", or as the raw key for any other header name..sessionsends no auth header and relies onURLSessioncookies..nonesends no auth header.
example.swift
timeout
Client-wide default timeout for non-stream requests, in seconds. Defaults to 30. Streams have no default timeout; set a per-call timeout in RequestOptions if you want a terminal deadline.
example.swift
options: .init(timeout: 5). See Request options.
session
Provide a preconfigured URLSession for custom delegate behavior, certificate pinning, or test doubles. The SDK never replaces a caller-supplied session.
example.swift
headers
Default headers merged into every request. Per-call headers override these.
example.swift
Complete example
example.swift
Client resources
TheFigranium instance exposes one lazy property per resource, plus a few top-level convenience helpers.
Top-level shortcuts:
client.runTask(_:input:options:)proxies totasks.run.client.scrape(_:options:)proxies toexecution.scrape.client.agent(_:options:)proxies toexecution.agent.client.headful(_:options:)proxies toexecution.headful.