sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Bedrock/ ListIngestionJobs.ts

import type * as bedrock from "@distilled.cloud/aws/bedrock-agent";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { DataSource } from "./DataSource.ts";

/**
 * The `ListIngestionJobs` request with the binding-injected
 * `knowledgeBaseId` and `dataSourceId` removed — they are supplied
 * automatically from the bound {@link DataSource}.
 */
export interface ListIngestionJobsRequest extends Omit<
  bedrock.ListIngestionJobsRequest,
  "knowledgeBaseId" | "dataSourceId"
> {}

/**
 * Runtime binding for `bedrock-agent:ListIngestionJobs` — list the ingestion
 * jobs that have run against the bound {@link DataSource}, optionally
 * filtered and sorted.
 *
 * The binding grants the function `bedrock:ListIngestionJobs` scoped to the
 * data source's parent knowledge base.
 *
 * ### Syncing a Data Source
 * **Example:** List Recent Ingestion Jobs
 * ```typescript
 * // init
 * const listIngestionJobs = yield* Bedrock.ListIngestionJobs(dataSource);
 *
 * // runtime
 * const { ingestionJobSummaries } = yield* listIngestionJobs({
 *   sortBy: { attribute: "STARTED_AT", order: "DESCENDING" },
 *   maxResults: 10,
 * });
 * ```
 *
 * @binding
 */
export interface ListIngestionJobs extends Binding.Service<
  ListIngestionJobs,
  "AWS.Bedrock.ListIngestionJobs",
  <D extends DataSource>(
    dataSource: D,
  ) => Effect.Effect<
    (
      request: ListIngestionJobsRequest,
    ) => Effect.Effect<bedrock.ListIngestionJobsResponse, bedrock.ListIngestionJobsError>
  >
> {}
export const ListIngestionJobs = Binding.Service<ListIngestionJobs>(
  "AWS.Bedrock.ListIngestionJobs",
);