sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ SocialMessaging/ GetWhatsAppFlowPreview.ts

import type * as socialmessaging from "@distilled.cloud/aws/socialmessaging";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { LinkedWhatsAppBusinessAccount } from "./LinkedWhatsAppBusinessAccount.ts";

/**
 * Request for {@link GetWhatsAppFlowPreview}. The linked WABA `id` is injected by
 * the binding from the bound {@link LinkedWhatsAppBusinessAccount}.
 */
export interface GetWhatsAppFlowPreviewRequest extends Omit<
  socialmessaging.GetWhatsAppFlowPreviewInput,
  "id"
> {}

/**
 * Runtime binding for `social-messaging:GetWhatsAppFlowPreview`.
 *
 * Generates (or refreshes with `invalidate`) a shareable preview URL for a
 * WhatsApp Flow on the bound account.
 *
 * The deploy-time half grants `social-messaging:GetWhatsAppFlowPreview` on the
 * bound WABA's ARN and the runtime half injects the linked account id
 * into every request.
 * Provide the implementation with
 * `Effect.provide(AWS.SocialMessaging.GetWhatsAppFlowPreviewHttp)`.
 * ### Managing WhatsApp Flows
 * **Example:** Get a Flow Preview URL
 * ```typescript
 * // init — bind the operation to the linked WABA
 * const getFlowPreview = yield* AWS.SocialMessaging.GetWhatsAppFlowPreview(account);
 *
 * // runtime
 * const { preview } = yield* getFlowPreview({
 *   flowId: "1234567890",
 *   invalidate: true,
 * });
 * ```
 *
 * @binding
 */
export interface GetWhatsAppFlowPreview extends Binding.Service<
  GetWhatsAppFlowPreview,
  "AWS.SocialMessaging.GetWhatsAppFlowPreview",
  (
    account: LinkedWhatsAppBusinessAccount,
  ) => Effect.Effect<
    (
      request: GetWhatsAppFlowPreviewRequest,
    ) => Effect.Effect<
      socialmessaging.GetWhatsAppFlowPreviewOutput,
      socialmessaging.GetWhatsAppFlowPreviewError
    >
  >
> {}
export const GetWhatsAppFlowPreview = Binding.Service<GetWhatsAppFlowPreview>(
  "AWS.SocialMessaging.GetWhatsAppFlowPreview",
);