sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ SNS/ PublishSms.ts

import * as sns from "@distilled.cloud/aws/sns";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";

export interface PublishSmsRequest extends Omit<sns.PublishInput, "TopicArn" | "TargetArn"> {}

/**
 * Runtime binding for `sns:Publish`.
 *
 * Runtime binding for direct SMS delivery with `sns:Publish` — send a text
 * message straight to a phone number without a topic. Accounts start in the
 * SMS sandbox, where only verified destination numbers are deliverable.
 * Provide the `PublishSmsHttp` layer on the Function to implement the binding.
 * ### Sending SMS
 * **Example:** Send a Text Message
 * ```typescript
 * const publishSms = yield* SNS.PublishSms();
 * yield* publishSms({
 *   PhoneNumber: "+15555550123",
 *   Message: "Your code is 123456",
 * });
 * ```
 *
 * @binding
 */
export interface PublishSms extends Binding.Service<
  PublishSms,
  "AWS.SNS.PublishSms",
  () => Effect.Effect<
    (request: PublishSmsRequest) => Effect.Effect<sns.PublishResponse, sns.PublishError>
  >
> {}

export const PublishSms = Binding.Service<PublishSms>("AWS.SNS.PublishSms");