sailfork / t3code-github / .repos/ alchemy-effect/ packages/ gcp/ src/ BigQuery/ ListTabledata.ts

import type * as bigquery from "@distilled.cloud/gcp/bigquery_v2";
import * as Binding from "alchemy/Binding";
import type { RuntimeContext } from "alchemy/RuntimeContext";
import type * as Effect from "effect/Effect";
import type { Table } from "./Table.ts";

export interface ListTabledataRequest extends Omit<
  bigquery.ListTabledataRequest,
  "projectId" | "datasetId" | "tableId"
> {}

/**
 * Runtime binding for BigQuery `tabledata.list`.
 *
 * Bind this operation to a {@link Table} in a Function/Action init phase.
 * Provide {@link ListTabledataHttp}.
 *
 * ### Listing Rows
 * **Example:** List table rows
 * ```typescript
 * const listRows = yield* GCP.BigQuery.ListTabledata(events);
 * const page = yield* listRows({ maxResults: 100 });
 * ```
 *
 * @binding
 * @category BigQuery
 */
export interface ListTabledata extends Binding.Service<
  ListTabledata,
  "GCP.BigQuery.ListTabledata",
  (
    table: Table,
  ) => Effect.Effect<
    (
      request?: ListTabledataRequest,
    ) => Effect.Effect<bigquery.TableDataList, bigquery.ListTabledataError, RuntimeContext>
  >
> {}

export const ListTabledata = Binding.Service<ListTabledata>("GCP.BigQuery.ListTabledata");