CorsairCloud is a small Swift client for a hosted Corsair Cloud
project. It uses URLSession and async/await. Give it your API key, and
every plugin your runtime has is callable over HTTP.
1. Install
Add it to yourPackage.swift. The package lives under clients/swift in the
corsair monorepo. Until a root-level Swift mirror ships, add it as a local path
dependency from a checkout of corsair:
2. Add your API key
Copy your project’s API key (ck_cloud_…) from the dashboard Overview page.
Keep it on a server; don’t ship it inside an app you distribute. The client
derives its own URL from the key:
3. Make a call
Pick a user (a “tenant”), then call any operation on any plugin your runtime has:tenant("acme") runs the call as your user “acme”. By default result is a
JSONValue. To get a typed result, pass your own Decodable and Corsair decodes
it for you:
4. Connect a user’s account
A tenant can only call Notion after they have connected their Notion account. Create a connect link and send the user to it:Handle errors
Any non-2xx response throwsCorsairError:
code (machine reason, branch on this), status (HTTP status),
message, and the upstream provider’s status when the error came from them.