1import type * as pubsublite from "@distilled.cloud/gcp/pubsublite_v1";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { RuntimeContext } from "../../RuntimeContext.ts";
5import type { AdminSubscription } from "./AdminSubscription.ts";
6
7export interface CommitCursorRequest extends Omit<
8 pubsublite.CommitCursorCursorProjectsLocationsSubscriptionsRequest,
9 "subscription"
10> {}
11
12/**
13 * Runtime binding for Pub/Sub Lite `cursor.commitCursor`.
14 *
15 * Bind this operation to an {@link AdminSubscription} in a Function/Action
16 * init phase. Provide {@link CommitCursorHttp}.
17 *
18 * Grants `roles/pubsublite.subscriber` on the project: Pub/Sub Lite has no
19 * resource-level IAM.
20 *
21 * ### Committing a Cursor
22 * **Example:** Commit partition 0 to offset 10
23 * ```typescript
24 * const commit = yield* GCP.PubSubLite.CommitCursor(inbox);
25 * yield* commit({
26 * body: { partition: "0", cursor: { offset: "10" } },
27 * });
28 * ```
29 *
30 * @binding
31 * @category PubSubLite
32 */
33export interface CommitCursor extends Binding.Service<
34 CommitCursor,
35 "GCP.PubSubLite.CommitCursor",
36 (
37 subscription: AdminSubscription,
38 ) => Effect.Effect<
39 (
40 request?: CommitCursorRequest,
41 ) => Effect.Effect<
42 pubsublite.CommitCursorResponse,
43 pubsublite.CommitCursorCursorProjectsLocationsSubscriptionsError,
44 RuntimeContext
45 >
46 >
47> {}
48
49export const CommitCursor = Binding.Service<CommitCursor>(
50 "GCP.PubSubLite.CommitCursor",
51);