| 1 | import type * as kendra from "@distilled.cloud/aws/kendra"; |
| 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 | * `GetSnapshots` request with `IndexId` injected from the bound index. |
| 8 | */ |
| 9 | export interface GetSnapshotsRequest extends Omit< |
| 10 | kendra.GetSnapshotsRequest, |
| 11 | "IndexId" |
| 12 | > {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for the `GetSnapshots` operation (IAM action |
| 16 | * `kendra:GetSnapshots`), scoped to one {@link Index}. |
| 17 | * |
| 18 | * Fetches search-analytics metric snapshots for the index (click-through |
| 19 | * rate, zero-result queries, top queries, …) over a time interval. |
| 20 | * Provide the implementation with |
| 21 | * `Effect.provide(AWS.Kendra.GetSnapshotsHttp)`. |
| 22 | * |
| 23 | * ### Search Analytics |
| 24 | * **Example:** Fetch Search Metrics |
| 25 | * ```typescript |
| 26 | * const getSnapshots = yield* AWS.Kendra.GetSnapshots(index); |
| 27 | * |
| 28 | * const metrics = yield* getSnapshots({ |
| 29 | * Interval: "ONE_WEEK_AGO", |
| 30 | * MetricType: "QUERIES_BY_COUNT", |
| 31 | * }); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetSnapshots extends Binding.Service< |
| 37 | GetSnapshots, |
| 38 | "AWS.Kendra.GetSnapshots", |
| 39 | ( |
| 40 | index: Index, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: GetSnapshotsRequest, |
| 44 | ) => Effect.Effect<kendra.GetSnapshotsResponse, kendra.GetSnapshotsError> |
| 45 | > |
| 46 | > {} |
| 47 | export const GetSnapshots = Binding.Service<GetSnapshots>( |
| 48 | "AWS.Kendra.GetSnapshots", |
| 49 | ); |