| 1 | import type * as pubsub from "@distilled.cloud/gcp/pubsub_v1"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { Subscription } from "./Subscription.ts"; |
| 6 | |
| 7 | export interface AcknowledgeRequest extends Omit< |
| 8 | pubsub.AcknowledgeProjectsSubscriptionsRequest, |
| 9 | "subscription" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Pub/Sub `subscriptions.acknowledge`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Subscription} in a Function/Action init |
| 16 | * phase. Provide {@link AcknowledgeHttp}. |
| 17 | * |
| 18 | * ### Acknowledging Messages |
| 19 | * **Example:** Acknowledge pulled messages |
| 20 | * ```typescript |
| 21 | * const acknowledge = yield* GCP.PubSub.Acknowledge(subscription); |
| 22 | * yield* acknowledge({ |
| 23 | * body: { ackIds: [ackId] }, |
| 24 | * }); |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | * @category PubSub |
| 29 | */ |
| 30 | export interface Acknowledge extends Binding.Service< |
| 31 | Acknowledge, |
| 32 | "GCP.PubSub.Acknowledge", |
| 33 | ( |
| 34 | subscription: Subscription, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: AcknowledgeRequest, |
| 38 | ) => Effect.Effect< |
| 39 | pubsub.Empty, |
| 40 | pubsub.AcknowledgeProjectsSubscriptionsError, |
| 41 | RuntimeContext |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const Acknowledge = Binding.Service<Acknowledge>( |
| 47 | "GCP.PubSub.Acknowledge", |
| 48 | ); |