@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 46 lines 1.54 KB
Raw
1 import type * as translate from "@distilled.cloud/aws/translate";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
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 */
35 export interface TranslateDocument extends Binding.Service<
36 TranslateDocument,
37 "AWS.Translate.TranslateDocument",
38 () => Effect.Effect<
39 (
40 request: translate.TranslateDocumentRequest,
41 ) => Effect.Effect<translate.TranslateDocumentResponse, translate.TranslateDocumentError>
42 >
43 > {}
44 export const TranslateDocument = Binding.Service<TranslateDocument>(
45 "AWS.Translate.TranslateDocument",
46 );