cariosan-go
Go SDK for consumer backends that manage Cariosan resources.
Go SDK for your backend — lets your server upsert users, issue JWTs, create channels, manage members, and register webhooks against a Cariosan server. Separate module so you don't pull in the full Cariosan codebase.
Zero third-party dependencies — uses net/http only. Pulls cleanly into any Go project, no transitive bloat.
Setup
Workspace credentials only on the backend — the API key/secret come from cariosan workspace create. They authenticate your backend, not end users. Never ship them to a browser or mobile client.
Users
Channels
Direct channels dedupe server-side:
Webhooks
Verify signatures
Always verify the X-Cariosan-Signature header before trusting webhook payloads.
Error handling
All API errors map to sentinel errors. errors.Is works against the HTTP status class:
Sentinels: ErrNotFound, ErrUnauthorized, ErrValidation, ErrConflict, ErrRateLimit, ErrServer, ErrProtocol.
For the raw status, code, and server-provided error envelope, use errors.As:
Retries
The client auto-retries 5xx, network errors, and request timeouts with exponential backoff (1s × 2ⁿ, capped at 30s, ±20% jitter). 4xx is never retried except 429, which honours Retry-After.
WithMaxRetries(n)— tune the budget (default 3; 0 disables).WithHTTPClient(c)— swap the transport entirely.WithTimeout(d)— per-request timeout on the default client.WithLogger(l)— aslog.Loggerfor retry-attempt logs.
Tip
Pass WithMaxRetries(0) to disable retries entirely, or raise it for long-running batch workloads where transient 5xx responses are expected.
Logs never include request bodies — retry-attempt logs include URL, status, and attempt number only. Server-side admin tokens or workspace API keys never appear in client SDK logs.
Context
Every method takes a context.Context as its first parameter. Cancelling it short-circuits in-flight HTTP and the retry loop. Pair with context.WithTimeout if you need a hard deadline across retries.
Note
Pair with context.WithTimeout in your request handlers — Cariosan respects the deadline and returns an error matching errors.Is(err, context.DeadlineExceeded) on expiry.
Was this page helpful?