| 1 | import type * as socialmessaging from "@distilled.cloud/aws/socialmessaging"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { LinkedWhatsAppBusinessAccount } from "./LinkedWhatsAppBusinessAccount.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link PublishWhatsAppFlow}. The linked WABA `id` is injected by |
| 8 | * the binding from the bound {@link LinkedWhatsAppBusinessAccount}. |
| 9 | */ |
| 10 | export interface PublishWhatsAppFlowRequest extends Omit< |
| 11 | socialmessaging.PublishWhatsAppFlowInput, |
| 12 | "id" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `social-messaging:PublishWhatsAppFlow`. |
| 17 | * |
| 18 | * Publishes a DRAFT WhatsApp Flow on the bound account so it can be sent to |
| 19 | * users. Published flows can no longer be edited, only deprecated. |
| 20 | * |
| 21 | * The deploy-time half grants `social-messaging:PublishWhatsAppFlow` on the |
| 22 | * bound WABA's ARN and the runtime half injects the linked account id |
| 23 | * into every request. |
| 24 | * Provide the implementation with |
| 25 | * `Effect.provide(AWS.SocialMessaging.PublishWhatsAppFlowHttp)`. |
| 26 | * ### Managing WhatsApp Flows |
| 27 | * **Example:** Publish a Flow |
| 28 | * ```typescript |
| 29 | * // init — bind the operation to the linked WABA |
| 30 | * const publishFlow = yield* AWS.SocialMessaging.PublishWhatsAppFlow(account); |
| 31 | * |
| 32 | * // runtime |
| 33 | * yield* publishFlow({ flowId: "1234567890" }); |
| 34 | * ``` |
| 35 | * |
| 36 | * @binding |
| 37 | */ |
| 38 | export interface PublishWhatsAppFlow extends Binding.Service< |
| 39 | PublishWhatsAppFlow, |
| 40 | "AWS.SocialMessaging.PublishWhatsAppFlow", |
| 41 | ( |
| 42 | account: LinkedWhatsAppBusinessAccount, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request: PublishWhatsAppFlowRequest, |
| 46 | ) => Effect.Effect< |
| 47 | socialmessaging.PublishWhatsAppFlowOutput, |
| 48 | socialmessaging.PublishWhatsAppFlowError |
| 49 | > |
| 50 | > |
| 51 | > {} |
| 52 | export const PublishWhatsAppFlow = Binding.Service<PublishWhatsAppFlow>( |
| 53 | "AWS.SocialMessaging.PublishWhatsAppFlow", |
| 54 | ); |