| 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 UpdateWhatsAppFlowAssets}. The linked WABA `id` is injected by |
| 8 | * the binding from the bound {@link LinkedWhatsAppBusinessAccount}. |
| 9 | */ |
| 10 | export interface UpdateWhatsAppFlowAssetsRequest extends Omit< |
| 11 | socialmessaging.UpdateWhatsAppFlowAssetsInput, |
| 12 | "id" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `social-messaging:UpdateWhatsAppFlowAssets`. |
| 17 | * |
| 18 | * Replaces a WhatsApp Flow's Flow JSON asset on the bound account and |
| 19 | * returns any validation errors Meta reports. |
| 20 | * |
| 21 | * The deploy-time half grants `social-messaging:UpdateWhatsAppFlowAssets` 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.UpdateWhatsAppFlowAssetsHttp)`. |
| 26 | * ### Managing WhatsApp Flows |
| 27 | * **Example:** Upload Flow JSON |
| 28 | * ```typescript |
| 29 | * // init — bind the operation to the linked WABA |
| 30 | * const updateFlowAssets = yield* AWS.SocialMessaging.UpdateWhatsAppFlowAssets(account); |
| 31 | * |
| 32 | * // runtime |
| 33 | * const { validationErrors } = yield* updateFlowAssets({ |
| 34 | * flowId: "1234567890", |
| 35 | * flowJson: new TextEncoder().encode(JSON.stringify(flowDefinition)), |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface UpdateWhatsAppFlowAssets extends Binding.Service< |
| 42 | UpdateWhatsAppFlowAssets, |
| 43 | "AWS.SocialMessaging.UpdateWhatsAppFlowAssets", |
| 44 | ( |
| 45 | account: LinkedWhatsAppBusinessAccount, |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: UpdateWhatsAppFlowAssetsRequest, |
| 49 | ) => Effect.Effect< |
| 50 | socialmessaging.UpdateWhatsAppFlowAssetsOutput, |
| 51 | socialmessaging.UpdateWhatsAppFlowAssetsError |
| 52 | > |
| 53 | > |
| 54 | > {} |
| 55 | export const UpdateWhatsAppFlowAssets = |
| 56 | Binding.Service<UpdateWhatsAppFlowAssets>( |
| 57 | "AWS.SocialMessaging.UpdateWhatsAppFlowAssets", |
| 58 | ); |