1import type * as bigquery from "@distilled.cloud/gcp/bigquery_v2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { Table } from "./Table.ts";
6
7export interface InsertAllRequest extends Omit<
8 bigquery.InsertAllTabledataRequest,
9 "projectId" | "datasetId" | "tableId"
10> {}
11
12/**
13 * Runtime binding for BigQuery `tabledata.insertAll`.
14 *
15 * Bind this operation to a {@link Table} in a Function/Action init phase.
16 * Provide {@link InsertAllHttp}.
17 *
18 * ### Inserting Rows
19 * **Example:** Stream a row
20 * ```typescript
21 * const insertAll = yield* GCP.BigQuery.InsertAll(events);
22 * yield* insertAll({
23 * body: { rows: [{ json: { id: "1" } }] },
24 * });
25 * ```
26 *
27 * @binding
28 * @category BigQuery
29 */
30export interface InsertAll extends Binding.Service<
31 InsertAll,
32 "GCP.BigQuery.InsertAll",
33 (
34 table: Table,
35 ) => Effect.Effect<
36 (
37 request: InsertAllRequest,
38 ) => Effect.Effect<
39 bigquery.TableDataInsertAllResponse,
40 bigquery.InsertAllTabledataError,
41 RuntimeContext
42 >
43 >
44> {}
45
46export const InsertAll = Binding.Service<InsertAll>("GCP.BigQuery.InsertAll");