| 1 | import type * as mm from "@distilled.cloud/aws/mailmanager"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Archive } from "./Archive.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `ses:GetArchiveMessageContent`. |
| 8 | * |
| 9 | * Fetches the parsed text/HTML body of one archived message (by |
| 10 | * `ArchivedMessageId` from a search result). IAM access is granted on |
| 11 | * the bound archive's ARN. Provide the implementation with |
| 12 | * `Effect.provide(AWS.MailManager.GetArchiveMessageContentHttp)`. |
| 13 | * ### Reading Archived Messages |
| 14 | * **Example:** Read a Message Body |
| 15 | * ```typescript |
| 16 | * const getMessageContent = yield* MailManager.GetArchiveMessageContent(archive); |
| 17 | * |
| 18 | * // runtime |
| 19 | * const { Body } = yield* getMessageContent({ ArchivedMessageId }); |
| 20 | * yield* Effect.log(Body?.Text ?? Body?.Html ?? "(malformed)"); |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | */ |
| 25 | export interface GetArchiveMessageContent extends Binding.Service< |
| 26 | GetArchiveMessageContent, |
| 27 | "AWS.MailManager.GetArchiveMessageContent", |
| 28 | ( |
| 29 | archive: Archive, |
| 30 | ) => Effect.Effect< |
| 31 | ( |
| 32 | request: mm.GetArchiveMessageContentRequest, |
| 33 | ) => Effect.Effect< |
| 34 | mm.GetArchiveMessageContentResponse, |
| 35 | mm.GetArchiveMessageContentError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | export const GetArchiveMessageContent = |
| 40 | Binding.Service<GetArchiveMessageContent>( |
| 41 | "AWS.MailManager.GetArchiveMessageContent", |
| 42 | ); |