| 1 | import * as sns from "@distilled.cloud/aws/sns"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface PublishSmsRequest extends Omit< |
| 6 | sns.PublishInput, |
| 7 | "TopicArn" | "TargetArn" |
| 8 | > {} |
| 9 | |
| 10 | /** |
| 11 | * Runtime binding for `sns:Publish`. |
| 12 | * |
| 13 | * Runtime binding for direct SMS delivery with `sns:Publish` — send a text |
| 14 | * message straight to a phone number without a topic. Accounts start in the |
| 15 | * SMS sandbox, where only verified destination numbers are deliverable. |
| 16 | * Provide the `PublishSmsHttp` layer on the Function to implement the binding. |
| 17 | * ### Sending SMS |
| 18 | * **Example:** Send a Text Message |
| 19 | * ```typescript |
| 20 | * const publishSms = yield* SNS.PublishSms(); |
| 21 | * yield* publishSms({ |
| 22 | * PhoneNumber: "+15555550123", |
| 23 | * Message: "Your code is 123456", |
| 24 | * }); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface PublishSms extends Binding.Service< |
| 30 | PublishSms, |
| 31 | "AWS.SNS.PublishSms", |
| 32 | () => Effect.Effect< |
| 33 | ( |
| 34 | request: PublishSmsRequest, |
| 35 | ) => Effect.Effect<sns.PublishResponse, sns.PublishError> |
| 36 | > |
| 37 | > {} |
| 38 | |
| 39 | export const PublishSms = Binding.Service<PublishSms>("AWS.SNS.PublishSms"); |