/** * The routed outbound chat service. * * `Chat` has the ops of every registered adapter and routes each call by the * address's platform. `Chat.layer` provides the router and an empty * `ChatAdapter.Registry`; adapter layers stack on top with * `Layer.provideMerge`, and a platform that is off is a layer left out. * * **Example** (Posting through the router) * * ```ts * import { Effect } from "effect" * import { Chat, ChatThread } from "effect/chat" * * const program = Effect.gen(function*() { * const chat = yield* Chat.Chat * const posted = yield* chat.post(ChatThread.make("slack", "T1/C1"), { markdown: "Hello" }) * return posted.id * }) * ``` * * @stability unstable * @since 4.1.5 */ import * as Context from "../Context.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import type { Descriptor, Ops, User } from "./ChatAdapter.ts"; import { Registry } from "./ChatAdapter.ts"; import { ChatError } from "./ChatError.ts"; import type { ChatThread } from "./ChatThread.ts"; declare const Chat_base: Context.ServiceClass & { readonly getUser: (platform: string, id: string, options?: { readonly in?: ChatThread | undefined; }) => Effect.Effect; readonly descriptor: (platform: string) => Effect.Effect; }>; /** * Service that routes chat operations to the adapter registered for each * address's platform. * * **Details** * * - Every op takes an address and goes to the adapter for * `thread.platform`, failing with `NoAdapter` when there is none. * - `getUser` takes the platform first, because a bare user id names none. * - `followUp` is routed by the platform of the deferred command's thread. * One call per deferral is the portable contract: the first is the * answer, and a second is platform-specific, a new message on Slack (up to * five) and an overwrite of the first on Discord. It is rendered as * `respond` is, so it never mentions anyone: Slack shows the token as * text and Discord renders it and notifies nobody. * - `descriptor` returns a platform's capabilities and limits. * - Each call runs in a `Chat.{op}` span whose attributes are the platform, the * op and, on failure, the error reason and retry value. * * @stability unstable * @category services * @since 4.1.5 */ export declare class Chat extends Chat_base { } /** * Layer that provides the `Chat` router and an empty `ChatAdapter.Registry`. * * **When to use** * * Use as the base of a chat setup. Adapter layers go on top with * `Layer.provideMerge`. * * @stability unstable * @category layers * @since 4.1.5 */ export declare const layer: Layer.Layer; /** * Runs an effect with adapter retries turned off, so every adapter call inside * it makes one attempt. * * **Gotchas** * * The name is provisional. * * @stability unstable * @category combinators * @since 4.1.5 */ export declare const withoutRetries: (effect: Effect.Effect) => Effect.Effect; export {}; //# sourceMappingURL=Chat.d.ts.map