1import type * as textract from "@distilled.cloud/aws/textract";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5/**
6 * Runtime binding for `textract:AnalyzeDocument` — synchronous analysis of
7 * relationships in a document: forms (key-value pairs), tables, layout,
8 * signatures, and natural-language queries. Pass the document as raw bytes
9 * or as an S3 object reference; the caller needs `s3:GetObject` on the
10 * bucket for S3 input (bind `AWS.S3.GetObject(bucket)` alongside).
11 *
12 * ### Synchronous Analysis
13 * **Example:** Analyze Forms and Tables
14 * ```typescript
15 * // init
16 * const analyzeDocument = yield* AWS.Textract.AnalyzeDocument();
17 *
18 * // runtime
19 * const result = yield* analyzeDocument({
20 * Document: { Bytes: documentBytes },
21 * FeatureTypes: ["FORMS", "TABLES"],
22 * });
23 * const tables = (result.Blocks ?? []).filter((b) => b.BlockType === "TABLE");
24 * ```
25 *
26 * @binding
27 */
28export interface AnalyzeDocument extends Binding.Service<
29 AnalyzeDocument,
30 "AWS.Textract.AnalyzeDocument",
31 () => Effect.Effect<
32 (
33 request: textract.AnalyzeDocumentRequest,
34 ) => Effect.Effect<
35 textract.AnalyzeDocumentResponse,
36 textract.AnalyzeDocumentError
37 >
38 >
39> {}
40export const AnalyzeDocument = Binding.Service<AnalyzeDocument>(
41 "AWS.Textract.AnalyzeDocument",
42);