| 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 { OptOutList } from "./OptOutList.ts"; |
| 5 | |
| 6 | /** |
| 7 | * The `OptOutListName` is injected by the binding from the bound opt-out |
| 8 | * list; the caller may filter by number or page with `NextToken`. |
| 9 | */ |
| 10 | export interface DescribeOptedOutNumbersRequest extends Omit< |
| 11 | smsvoice.DescribeOptedOutNumbersRequest, |
| 12 | "OptOutListName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `sms-voice:DescribeOptedOutNumbers`. |
| 17 | * |
| 18 | * Lists the opted-out destination numbers in the bound opt-out list (one |
| 19 | * page per call — pass `NextToken` from the previous response to |
| 20 | * continue). Use it to check whether a number opted out before sending. |
| 21 | * The deploy-time half grants `sms-voice:DescribeOptedOutNumbers` on the |
| 22 | * list. Provide the implementation with |
| 23 | * `Effect.provide(AWS.PinpointSMSVoiceV2.DescribeOptedOutNumbersHttp)`. |
| 24 | * ### Managing Opt-Outs |
| 25 | * **Example:** Check a Number Before Sending |
| 26 | * ```typescript |
| 27 | * // init |
| 28 | * const describeOptedOut = |
| 29 | * yield* AWS.PinpointSMSVoiceV2.DescribeOptedOutNumbers(optOuts); |
| 30 | * |
| 31 | * // runtime |
| 32 | * const { OptedOutNumbers } = yield* describeOptedOut({ |
| 33 | * OptedOutNumbers: ["+12065550100"], |
| 34 | * }); |
| 35 | * const optedOut = (OptedOutNumbers ?? []).length > 0; |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface DescribeOptedOutNumbers extends Binding.Service< |
| 41 | DescribeOptedOutNumbers, |
| 42 | "AWS.PinpointSMSVoiceV2.DescribeOptedOutNumbers", |
| 43 | ( |
| 44 | optOutList: OptOutList, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: DescribeOptedOutNumbersRequest, |
| 48 | ) => Effect.Effect< |
| 49 | smsvoice.DescribeOptedOutNumbersResult, |
| 50 | smsvoice.DescribeOptedOutNumbersError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | export const DescribeOptedOutNumbers = Binding.Service<DescribeOptedOutNumbers>( |
| 55 | "AWS.PinpointSMSVoiceV2.DescribeOptedOutNumbers", |
| 56 | ); |