1import type * as DynamoDB from "@distilled.cloud/aws/dynamodb";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Table } from "./Table.ts";
5
6export interface GetItemRequest extends Omit<
7 DynamoDB.GetItemInput,
8 "TableName"
9> {}
10
11/**
12 * Runtime binding for `dynamodb:GetItem`.
13 *
14 * Bind this operation to a `Table` inside a function runtime to get a callable
15 * that automatically injects the table name.
16 * ### Reading Data
17 * **Example:** Read a Single Item
18 * ```typescript
19 * const getItem = yield* AWS.DynamoDB.GetItem(table);
20 *
21 * const response = yield* getItem({
22 * Key: {
23 * pk: { S: "user#123" },
24 * },
25 * });
26 * ```
27 *
28 * @binding
29 */
30export interface GetItem extends Binding.Service<
31 GetItem,
32 "AWS.DynamoDB.GetItem",
33 <T extends Table>(
34 table: T,
35 ) => Effect.Effect<
36 (
37 request: GetItemRequest,
38 ) => Effect.Effect<DynamoDB.GetItemOutput, DynamoDB.GetItemError>
39 >
40> {}
41export const GetItem = Binding.Service<GetItem>("AWS.DynamoDB.GetItem");