| 1 | import type * as smsvoice from "@distilled.cloud/aws/pinpoint-sms-voice-v2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { PhoneNumber } from "./PhoneNumber.ts"; |
| 5 | |
| 6 | /** |
| 7 | * The `OriginationIdentity` is injected by the binding from the bound |
| 8 | * phone number; the caller supplies the destination and message body. |
| 9 | */ |
| 10 | export interface SendVoiceMessageRequest extends Omit< |
| 11 | smsvoice.SendVoiceMessageRequest, |
| 12 | "OriginationIdentity" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `sms-voice:SendVoiceMessage`. |
| 17 | * |
| 18 | * Sends a voice message from the bound origination phone number — Amazon |
| 19 | * Polly converts the text (or SSML) `MessageBody` into speech. The |
| 20 | * deploy-time half grants `sms-voice:SendVoiceMessage` on the number and |
| 21 | * the runtime half injects its ARN as the request's `OriginationIdentity`. |
| 22 | * The bound number must carry the `VOICE` capability. Provide the |
| 23 | * implementation with |
| 24 | * `Effect.provide(AWS.PinpointSMSVoiceV2.SendVoiceMessageHttp)`. |
| 25 | * ### Sending Voice Messages |
| 26 | * **Example:** Call a Recipient with a Spoken Message |
| 27 | * ```typescript |
| 28 | * // init |
| 29 | * const sendVoice = yield* AWS.PinpointSMSVoiceV2.SendVoiceMessage(number); |
| 30 | * |
| 31 | * // runtime |
| 32 | * const { MessageId } = yield* sendVoice({ |
| 33 | * DestinationPhoneNumber: "+12065550100", |
| 34 | * MessageBody: "Your appointment is confirmed for tomorrow at nine A M.", |
| 35 | * MessageBodyTextType: "TEXT", |
| 36 | * VoiceId: "JOANNA", |
| 37 | * }); |
| 38 | * ``` |
| 39 | * |
| 40 | * @binding |
| 41 | */ |
| 42 | export interface SendVoiceMessage extends Binding.Service< |
| 43 | SendVoiceMessage, |
| 44 | "AWS.PinpointSMSVoiceV2.SendVoiceMessage", |
| 45 | ( |
| 46 | phoneNumber: PhoneNumber, |
| 47 | ) => Effect.Effect< |
| 48 | ( |
| 49 | request: SendVoiceMessageRequest, |
| 50 | ) => Effect.Effect< |
| 51 | smsvoice.SendVoiceMessageResult, |
| 52 | smsvoice.SendVoiceMessageError |
| 53 | > |
| 54 | > |
| 55 | > {} |
| 56 | export const SendVoiceMessage = Binding.Service<SendVoiceMessage>( |
| 57 | "AWS.PinpointSMSVoiceV2.SendVoiceMessage", |
| 58 | ); |