1import type * as sitewise from "@distilled.cloud/aws/iotsitewise";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Asset } from "./Asset.ts";
5
6/**
7 * Request for {@link GetAssetPropertyValueHistory}. The bound asset's id is
8 * injected automatically.
9 */
10export interface GetAssetPropertyValueHistoryRequest extends Omit<
11 sitewise.GetAssetPropertyValueHistoryRequest,
12 "assetId"
13> {}
14
15/**
16 * Runtime binding for `iotsitewise:GetAssetPropertyValueHistory` — read the
17 * historical timestamp-quality-values of one property of the bound asset
18 * over a time range from a deployed Lambda or Task.
19 *
20 * ### Reading Value History
21 * Provide the `GetAssetPropertyValueHistoryHttp` implementation layer on
22 * the Function effect, bind the asset in the init phase, then call the
23 * returned client at runtime. Page through large ranges with `nextToken`.
24 *
25 * **Example:** Read the Last Hour of Values
26 * ```typescript
27 * // init
28 * const getHistory = yield* AWS.IoTSiteWise.GetAssetPropertyValueHistory(asset);
29 *
30 * // runtime
31 * const now = yield* Effect.sync(() => new Date());
32 * const { assetPropertyValueHistory } = yield* getHistory({
33 * propertyId,
34 * startDate: new Date(now.getTime() - 3_600_000),
35 * endDate: now,
36 * timeOrdering: "DESCENDING",
37 * });
38 * // on the Function effect:
39 * // .pipe(Effect.provide(AWS.IoTSiteWise.GetAssetPropertyValueHistoryHttp))
40 * ```
41 *
42 * @binding
43 */
44export interface GetAssetPropertyValueHistory extends Binding.Service<
45 GetAssetPropertyValueHistory,
46 "AWS.IoTSiteWise.GetAssetPropertyValueHistory",
47 (
48 asset: Asset,
49 ) => Effect.Effect<
50 (
51 request: GetAssetPropertyValueHistoryRequest,
52 ) => Effect.Effect<
53 sitewise.GetAssetPropertyValueHistoryResponse,
54 sitewise.GetAssetPropertyValueHistoryError
55 >
56 >
57> {}
58export const GetAssetPropertyValueHistory =
59 Binding.Service<GetAssetPropertyValueHistory>(
60 "AWS.IoTSiteWise.GetAssetPropertyValueHistory",
61 );