1import type * as translate from "@distilled.cloud/aws/translate";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `translate:TranslateDocument` — synchronously
7 * translate a whole document (plain text, HTML, or Word) between a source
8 * and a target language.
9 *
10 * One of the two language codes must be `en` (English). The document
11 * content and the translated result are sensitive blobs — the response's
12 * `TranslatedDocument.Content` decodes as `Redacted<Uint8Array>`.
13 *
14 * ### Translating Documents
15 * **Example:** Translate a plain-text document
16 * ```typescript
17 * // init
18 * const translateDocument = yield* AWS.Translate.TranslateDocument();
19 *
20 * // runtime
21 * const result = yield* translateDocument({
22 * Document: {
23 * Content: new TextEncoder().encode("Good morning!"),
24 * ContentType: "text/plain",
25 * },
26 * SourceLanguageCode: "en",
27 * TargetLanguageCode: "es",
28 * });
29 * const bytes = Redacted.value(result.TranslatedDocument.Content as Redacted.Redacted<Uint8Array>);
30 * // new TextDecoder().decode(bytes) === "¡Buenos días!"
31 * ```
32 *
33 * @binding
34 */
35export interface TranslateDocument extends Binding.Service<
36 TranslateDocument,
37 "AWS.Translate.TranslateDocument",
38 () => Effect.Effect<
39 (
40 request: translate.TranslateDocumentRequest,
41 ) => Effect.Effect<
42 translate.TranslateDocumentResponse,
43 translate.TranslateDocumentError
44 >
45 >
46> {}
47export const TranslateDocument = Binding.Service<TranslateDocument>(
48 "AWS.Translate.TranslateDocument",
49);