| 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 | * `BatchPutDocument` request with `applicationId` + `indexId` injected from the bound index. |
| 8 | */ |
| 9 | export interface BatchPutDocumentRequest extends Omit< |
| 10 | qbusiness.BatchPutDocumentRequest, |
| 11 | "applicationId" | "indexId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for the `BatchPutDocument` operation (IAM action |
| 16 | * `qbusiness:BatchPutDocument`), scoped to one {@link Index}. |
| 17 | * |
| 18 | * Adds or updates documents in the index directly (the CUSTOM data |
| 19 | * source path), with optional access controls and enrichment. |
| 20 | * Provide the implementation with |
| 21 | * `Effect.provide(AWS.QBusiness.BatchPutDocumentHttp)`. |
| 22 | * |
| 23 | * ### Document Ingestion |
| 24 | * **Example:** Push Documents into an Index |
| 25 | * ```typescript |
| 26 | * const putDocuments = yield* AWS.QBusiness.BatchPutDocument(index); |
| 27 | * |
| 28 | * const { failedDocuments } = yield* putDocuments({ |
| 29 | * documents: [ |
| 30 | * { |
| 31 | * id: "welcome", |
| 32 | * title: "Welcome", |
| 33 | * content: { blob: new TextEncoder().encode("Hello Q!") }, |
| 34 | * contentType: "PLAIN_TEXT", |
| 35 | * }, |
| 36 | * ], |
| 37 | * }); |
| 38 | * ``` |
| 39 | * |
| 40 | * @binding |
| 41 | */ |
| 42 | export interface BatchPutDocument extends Binding.Service< |
| 43 | BatchPutDocument, |
| 44 | "AWS.QBusiness.BatchPutDocument", |
| 45 | ( |
| 46 | index: Index, |
| 47 | ) => Effect.Effect< |
| 48 | ( |
| 49 | request: BatchPutDocumentRequest, |
| 50 | ) => Effect.Effect< |
| 51 | qbusiness.BatchPutDocumentResponse, |
| 52 | qbusiness.BatchPutDocumentError |
| 53 | > |
| 54 | > |
| 55 | > {} |
| 56 | export const BatchPutDocument = Binding.Service<BatchPutDocument>( |
| 57 | "AWS.QBusiness.BatchPutDocument", |
| 58 | ); |