sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ SimpleDB/ GetAttributes.ts

import type * as sdb from "@distilled.cloud/aws/simpledb";
import * as Binding from "alchemy/Binding";
import type { RuntimeContext } from "alchemy/RuntimeContext";
import type * as Effect from "effect/Effect";
import type { Domain } from "./Domain.ts";

export interface GetAttributesRequest extends Omit<sdb.GetAttributesRequest, "DomainName"> {}

/**
 * Runtime binding for `sdb:GetAttributes`.
 *
 * Bind this operation to a {@link Domain} inside a function runtime to get a
 * callable that automatically injects the domain name.
 * ### Reading Items
 * **Example:** Read an Item's Attributes
 * ```typescript
 * const getAttributes = yield* AWS.SimpleDB.GetAttributes(domain);
 *
 * const response = yield* getAttributes({
 *   ItemName: "user#123",
 *   ConsistentRead: true,
 * });
 * // response.Attributes: [{ Name: "email", Value: "a@b.com" }, ...]
 * ```
 *
 * @binding
 */
export interface GetAttributes extends Binding.Service<
  GetAttributes,
  "AWS.SimpleDB.GetAttributes",
  (
    domain: Domain,
  ) => Effect.Effect<
    (
      request: GetAttributesRequest,
    ) => Effect.Effect<sdb.GetAttributesResponse, sdb.GetAttributesError, RuntimeContext>
  >
> {}
export const GetAttributes = Binding.Service<GetAttributes>("AWS.SimpleDB.GetAttributes");