sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Kendra/ GetSnapshots.ts

import type * as kendra from "@distilled.cloud/aws/kendra";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { Index } from "./SearchIndex.ts";

/**
 * `GetSnapshots` request with `IndexId` injected from the bound index.
 */
export interface GetSnapshotsRequest extends Omit<kendra.GetSnapshotsRequest, "IndexId"> {}

/**
 * Runtime binding for the `GetSnapshots` operation (IAM action
 * `kendra:GetSnapshots`), scoped to one {@link Index}.
 *
 * Fetches search-analytics metric snapshots for the index (click-through
 * rate, zero-result queries, top queries, …) over a time interval.
 * Provide the implementation with
 * `Effect.provide(AWS.Kendra.GetSnapshotsHttp)`.
 *
 * ### Search Analytics
 * **Example:** Fetch Search Metrics
 * ```typescript
 * const getSnapshots = yield* AWS.Kendra.GetSnapshots(index);
 *
 * const metrics = yield* getSnapshots({
 *   Interval: "ONE_WEEK_AGO",
 *   MetricType: "QUERIES_BY_COUNT",
 * });
 * ```
 *
 * @binding
 */
export interface GetSnapshots extends Binding.Service<
  GetSnapshots,
  "AWS.Kendra.GetSnapshots",
  (
    index: Index,
  ) => Effect.Effect<
    (
      request: GetSnapshotsRequest,
    ) => Effect.Effect<kendra.GetSnapshotsResponse, kendra.GetSnapshotsError>
  >
> {}
export const GetSnapshots = Binding.Service<GetSnapshots>("AWS.Kendra.GetSnapshots");