Effect whose error channel holds the endpoint’s tagged
errors, so failures show up in your handler’s type. See Errors.
In handlers
reintersect in the context is already authorized for the install the delivery came from. It has
the methods for the scopes the piece declares, and its block methods accept the blocks the piece can
use:
src/onDecision.tsx
reintersect.forInstall(installId) to get a client for an install your app knows.
See Routes.
Outside handlers
In a job, a script or your own backend, build a client withReintersectAppClient.make(app, options).
It needs an HttpClient, such as FetchHttpClient.layer:
src/markDone.ts
See Authentication for how tokens are minted and cached.
App streams
An app stream posts events into a circle as conversations from your app. There are two ways to post. With an install, callstreams.sendEvent on the client. It needs replies:write:
ReintersectStream. The
URL is the credential, so keep it secret. ReintersectStream.make checks the options and returns an
Either, which you can yield inside Effect.gen:
src/announceDeploy.ts
idempotencyKey makes a resend post
once, so a retry like the one above is safe. A stream post fails with
ReintersectStreamRateLimitedError (with retryAfterSeconds), ReintersectStreamInvalidTokenError,
ReintersectStreamRevokedError, ReintersectStreamInvalidPayloadError or
ReintersectStreamPayloadTooLargeError, or a transport error. See
Writing to circles for threads, titles and personas.
renderPayload
renderPayload(content) from @reintersect/sdk/effect renders JSX into the document JSON the API
accepts, for an HTTP client of your own. It returns an Effect:
The member API client
Reintersect is a service for Reintersect’s member API, which acts as a member with an API key from
Settings → Developer → API keys. It reads circles, conversations, replies and files, and creates
and updates replies. It’s separate from the app client. Provide it with ReintersectClient.layer or,
to read REINTERSECT_API_KEY and REINTERSECT_BASE_URL through Config, with
ReintersectClient.layerConfig():
src/circles.ts
ReintersectApiCircleNotFoundError.