| 1 | import type * as qbusiness from "@distilled.cloud/aws/qbusiness"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Index } from "./SearchIndex.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `GetDocumentContent` request with `applicationId` + `indexId` injected from the bound index. |
| 8 | */ |
| 9 | export interface GetDocumentContentRequest extends Omit< |
| 10 | qbusiness.GetDocumentContentRequest, |
| 11 | "applicationId" | "indexId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for the `GetDocumentContent` operation (IAM action |
| 16 | * `qbusiness:GetDocumentContent`), scoped to one {@link Index}. |
| 17 | * |
| 18 | * Returns a presigned URL for an indexed document's content, in the |
| 19 | * raw uploaded format or the extracted text. |
| 20 | * Provide the implementation with |
| 21 | * `Effect.provide(AWS.QBusiness.GetDocumentContentHttp)`. |
| 22 | * |
| 23 | * ### Document Ingestion |
| 24 | * **Example:** Fetch a Document's Content |
| 25 | * ```typescript |
| 26 | * const getContent = yield* AWS.QBusiness.GetDocumentContent(index); |
| 27 | * |
| 28 | * const { presignedUrl } = yield* getContent({ documentId: "welcome" }); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface GetDocumentContent extends Binding.Service< |
| 34 | GetDocumentContent, |
| 35 | "AWS.QBusiness.GetDocumentContent", |
| 36 | ( |
| 37 | index: Index, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: GetDocumentContentRequest, |
| 41 | ) => Effect.Effect< |
| 42 | qbusiness.GetDocumentContentResponse, |
| 43 | qbusiness.GetDocumentContentError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const GetDocumentContent = Binding.Service<GetDocumentContent>( |
| 48 | "AWS.QBusiness.GetDocumentContent", |
| 49 | ); |