sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Forecast/ QueryForecast.ts

import type * as forecastquery from "@distilled.cloud/aws/forecastquery";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Runtime binding for `forecast:QueryForecast` — the Forecast Query data
 * plane. Retrieves the predicted time series for a single item from a
 * generated forecast, the call an API or personalization function makes to
 * serve predictions.
 *
 * Forecast ARNs are created at runtime, so the binding takes no arguments
 * and grants `forecast:QueryForecast` on `*`. Provide the implementation
 * with `Effect.provide(AWS.Forecast.QueryForecastHttp)`.
 *
 * ### Querying Forecasts
 * **Example:** Serve a Prediction
 * ```typescript
 * // init
 * const queryForecast = yield* AWS.Forecast.QueryForecast();
 *
 * // runtime
 * const { Forecast } = yield* queryForecast({
 *   ForecastArn: forecastArn,
 *   Filters: { item_id: "sku_1234" },
 * });
 * const p50 = Forecast?.Predictions?.p50 ?? [];
 * ```
 *
 * @binding
 */
export interface QueryForecast extends Binding.Service<
  QueryForecast,
  "AWS.Forecast.QueryForecast",
  () => Effect.Effect<
    (
      request: forecastquery.QueryForecastRequest,
    ) => Effect.Effect<forecastquery.QueryForecastResponse, forecastquery.QueryForecastError>
  >
> {}
export const QueryForecast = Binding.Service<QueryForecast>("AWS.Forecast.QueryForecast");