sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ NotificationsContacts/ SendActivationCode.ts

import type * as contacts from "@distilled.cloud/aws/notificationscontacts";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { EmailContact } from "./EmailContact.ts";

/**
 * Runtime binding for `notifications-contacts:SendActivationCode`.
 *
 * Send (or re-send) the activation email to the bound contact's address.
 * The email contains the activation code the address owner uses to confirm
 * the contact (directly via the emailed link, or through your app via
 * {@link ActivateEmailContact}). Provide the implementation with
 * `Effect.provide(AWS.NotificationsContacts.SendActivationCodeHttp)`.
 * ### Activating a Contact
 * **Example:** Re-send the Activation Email
 * ```typescript
 * // init — bind the operation to the contact
 * const sendActivationCode =
 *   yield* AWS.NotificationsContacts.SendActivationCode(contact);
 *
 * // runtime — e.g. behind a "resend confirmation email" button
 * yield* sendActivationCode();
 * ```
 *
 * @binding
 */
export interface SendActivationCode extends Binding.Service<
  SendActivationCode,
  "AWS.NotificationsContacts.SendActivationCode",
  (
    contact: EmailContact,
  ) => Effect.Effect<
    () => Effect.Effect<contacts.SendActivationCodeResponse, contacts.SendActivationCodeError>
  >
> {}

export const SendActivationCode = Binding.Service<SendActivationCode>(
  "AWS.NotificationsContacts.SendActivationCode",
);