Skip to main content
All methods are static on ClarioDesk. Reads are replay-last AsyncStreams (a new iterator immediately receives the current value, then live updates), with closure-based subscribe* variants for UIKit hosts that return a cancellable ClarioSubscription.

Lifecycle

initialize

Synchronous, fire-and-forget, idempotent — call from App.init or application(_:didFinishLaunchingWithOptions:) with no await. Every subsequent method awaits the shared bootstrap internally, so nothing races. First launch generates the Secure Enclave device key and registers the device; later launches reuse it. ClarioDeskOptions — only apiKey is required:

identify

Without a token, attach unverified display metadata. With a token/provider, perform Verified identity. Proof failures never fall back to labels.
Use clearIdentity() before Verified-identity logout/account switch.

reset

Acknowledged one-installation revoke, then wipe the hardware key, caches, and outbox. It is not logout or customer erase. The next initialize registers a fresh device.

State & diagnostics

Tickets & messages

createTicket

sendMessage

Optimistic: the message appears as pending immediately and settles on success. An offline send waits in the durable Keychain outbox and auto-flushes on reconnect.

retryMessage

Re-send a message whose optimistic write failed (message.failed == true). Tap-to-retry only; never auto-retried.

One-shot fetches

Read & typing

Bug reports

submitBugReport

A thin wrapper over ticket-create with type: .bug: the subject is derived from the description (first line, ≤60 chars — the user never types a title), the logCollector output (if wired in options) is attached as clariodesk-logs.txt, and the optional screenshot rides along. One-shot — no outbox; surface failure with tap-to-retry. The prebuilt ClarioDeskWidgets.openBugReport() auto-captures a screenshot and calls this for you (see prebuilt UI, including opt-in shake-to-report); headless hosts call it directly.

CSAT

submitCsat

See CSAT. The rating is cached on the Ticket (csatScore / csatComment / hasCsat).

Attachments

See Attachments for limits and the upload flow.

Push

See the push guide.

Reactive reads

Streams that can carry a load failure are throwing; the rest are plain AsyncStreams. Subscribing before initialize throws .notInitialized on first await.

Closure subscriptions (UIKit)

Same semantics; each returns a ClarioSubscription — call .cancel() when done.

Types

All models are Sendable value types: Ticket, Message, Attachment, OutgoingAttachment, NotificationPreferences, ClarioPushPayload, ClarioDeskError, and the enums above (TicketType, TicketStatus, MessageAuthor, AttachmentKind, MessageReadState).
This SDK implements the same wire contract as the Flutter and React Native SDKs — identical bytes on the wire and the same state machines, expressed in Swift idioms (initialize instead of init, tuples for create results, AsyncStream reads).