sailfork / t3code-github / .repos/ alchemy-effect/ packages/ gcp/ src/ Translate/ GetModel.ts

import type * as translate from "@distilled.cloud/gcp/translate_v3";
import * as Binding from "alchemy/Binding";
import type { RuntimeContext } from "alchemy/RuntimeContext";
import type * as Effect from "effect/Effect";
import type { Model } from "./Model.ts";

export interface GetModelRequest extends Omit<
  translate.GetProjectsLocationsModelsRequest,
  "name"
> {}

/**
 * Runtime binding for Cloud Translation `models.get`.
 *
 * Bind this operation to a {@link Model} in a Function/Action init
 * phase. Provide {@link GetModelHttp}.
 *
 * ### Reading a Model
 * **Example:** Read the bound model
 * ```typescript
 * const getModel = yield* GCP.Translate.GetModel(model);
 * const live = yield* getModel();
 * ```
 *
 * @binding
 * @category Translate
 */
export interface GetModel extends Binding.Service<
  GetModel,
  "GCP.Translate.GetModel",
  (
    model: Model,
  ) => Effect.Effect<
    (
      request?: GetModelRequest,
    ) => Effect.Effect<translate.Model, translate.GetProjectsLocationsModelsError, RuntimeContext>
  >
> {}

export const GetModel = Binding.Service<GetModel>("GCP.Translate.GetModel");