sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Forecast/ QueryWhatIfForecast.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:QueryWhatIfForecast` — retrieve the
 * predicted time series for a single item from a what-if forecast, so an
 * application can compare a scenario (price change, promotion) against the
 * baseline served by {@link QueryForecast}.
 *
 * What-if forecast ARNs are created at runtime, so the binding takes no
 * arguments and grants `forecast:QueryWhatIfForecast` on `*`. Provide the
 * implementation with `Effect.provide(AWS.Forecast.QueryWhatIfForecastHttp)`.
 *
 * ### Querying Forecasts
 * **Example:** Compare a Scenario
 * ```typescript
 * // init
 * const queryWhatIfForecast = yield* AWS.Forecast.QueryWhatIfForecast();
 *
 * // runtime
 * const { Forecast } = yield* queryWhatIfForecast({
 *   WhatIfForecastArn: whatIfForecastArn,
 *   Filters: { item_id: "sku_1234" },
 * });
 * ```
 *
 * @binding
 */
export interface QueryWhatIfForecast extends Binding.Service<
  QueryWhatIfForecast,
  "AWS.Forecast.QueryWhatIfForecast",
  () => Effect.Effect<
    (
      request: forecastquery.QueryWhatIfForecastRequest,
    ) => Effect.Effect<
      forecastquery.QueryWhatIfForecastResponse,
      forecastquery.QueryWhatIfForecastError
    >
  >
> {}
export const QueryWhatIfForecast = Binding.Service<QueryWhatIfForecast>(
  "AWS.Forecast.QueryWhatIfForecast",
);