| 1 | import type * as textract from "@distilled.cloud/aws/textract"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `textract:StartDocumentAnalysis` — start an |
| 7 | * asynchronous analysis job for a (possibly multi-page) document stored in |
| 8 | * S3. Poll the returned `JobId` with `GetDocumentAnalysis`, or pass a |
| 9 | * `NotificationChannel` to receive the completion event on an SNS topic |
| 10 | * (pair it with an SNS event source to invoke a Function on completion). |
| 11 | * The caller needs `s3:GetObject` on the input bucket. |
| 12 | * |
| 13 | * ### Asynchronous Document Analysis |
| 14 | * **Example:** Start an Analysis Job |
| 15 | * ```typescript |
| 16 | * // init |
| 17 | * const startDocumentAnalysis = yield* AWS.Textract.StartDocumentAnalysis(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { JobId } = yield* startDocumentAnalysis({ |
| 21 | * DocumentLocation: { S3Object: { Bucket: bucketName, Name: "doc.pdf" } }, |
| 22 | * FeatureTypes: ["TABLES"], |
| 23 | * }); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface StartDocumentAnalysis extends Binding.Service< |
| 29 | StartDocumentAnalysis, |
| 30 | "AWS.Textract.StartDocumentAnalysis", |
| 31 | () => Effect.Effect< |
| 32 | ( |
| 33 | request: textract.StartDocumentAnalysisRequest, |
| 34 | ) => Effect.Effect< |
| 35 | textract.StartDocumentAnalysisResponse, |
| 36 | textract.StartDocumentAnalysisError |
| 37 | > |
| 38 | > |
| 39 | > {} |
| 40 | export const StartDocumentAnalysis = Binding.Service<StartDocumentAnalysis>( |
| 41 | "AWS.Textract.StartDocumentAnalysis", |
| 42 | ); |