The best way to control Claude Code, Codex and more from any computer or phone

main
ts 79 lines 2.64 KB
Raw
1 import type * as sesv2 from "@distilled.cloud/aws/sesv2";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { ConfigurationSet } from "./ConfigurationSet.ts";
5 import type { EmailIdentity } from "./EmailIdentity.ts";
6
7 /**
8 * The `sendEmail` request with the binding-injected members removed:
9 * `ConfigurationSetName` comes from the bound configuration set, and
10 * `FromEmailAddress` defaults to the bound identity (override it for domain
11 * identities, e.g. `hello@{domain}`).
12 */
13 export interface SendEmailRequest extends Omit<sesv2.SendEmailRequest, "ConfigurationSetName"> {}
14
15 /**
16 * Runtime binding for `sesv2:SendEmail`.
17 *
18 * Bind this operation to an `EmailIdentity` (and optionally a
19 * `ConfigurationSet`) inside a function runtime to get a callable that sends
20 * simple, raw, or templated email. The binding grants the function
21 * `ses:SendEmail` (and the raw/templated variants) scoped to the identity,
22 * the account's templates, and the configuration set.
23 *
24 * For an email-address identity, `FromEmailAddress` defaults to the identity
25 * itself. For a domain identity, pass an address at the domain explicitly.
26 *
27 * Note: while the account is in the SES sandbox, both the sender identity
28 * must be verified and every recipient must be a verified identity or the
29 * SES mailbox simulator (e.g. `success@simulator.amazonses.com`).
30 * ### Sending Email
31 * **Example:** Send a Simple Message
32 * ```typescript
33 * // init
34 * const sendEmail = yield* SES.SendEmail(identity);
35 *
36 * // runtime
37 * const result = yield* sendEmail({
38 * Destination: { ToAddresses: ["success@simulator.amazonses.com"] },
39 * Content: {
40 * Simple: {
41 * Subject: { Data: "Hello" },
42 * Body: { Text: { Data: "Hello from SES." } },
43 * },
44 * },
45 * });
46 * // result.MessageId
47 * ```
48 *
49 * **Example:** Send Through a Configuration Set
50 * ```typescript
51 * const sendEmail = yield* SES.SendEmail(identity, configSet);
52 * ```
53 *
54 * **Example:** Send a Templated Message
55 * ```typescript
56 * const result = yield* sendEmail({
57 * Destination: { ToAddresses: ["customer@example.com"] },
58 * Content: {
59 * Template: {
60 * TemplateName: "welcome-template",
61 * TemplateData: JSON.stringify({ name: "Ada" }),
62 * },
63 * },
64 * });
65 * ```
66 *
67 * @binding
68 */
69 export interface SendEmail extends Binding.Service<
70 SendEmail,
71 "AWS.SES.SendEmail",
72 <I extends EmailIdentity>(
73 identity: I,
74 configurationSet?: ConfigurationSet,
75 ) => Effect.Effect<
76 (request: SendEmailRequest) => Effect.Effect<sesv2.SendEmailResponse, sesv2.SendEmailError>
77 >
78 > {}
79 export const SendEmail = Binding.Service<SendEmail>("AWS.SES.SendEmail");