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 GetAssetPropertyValue}. The bound asset's id is
8 * injected automatically; identify the property with `propertyId` (or a
9 * `propertyAlias`, which authorizes against the time-series resource
10 * instead of the bound asset).
11 */
12export interface GetAssetPropertyValueRequest extends Omit<
13 sitewise.GetAssetPropertyValueRequest,
14 "assetId"
15> {}
16
17/**
18 * Runtime binding for `iotsitewise:GetAssetPropertyValue` — read the
19 * current (latest) timestamp-quality-value of one property of the bound
20 * asset from a deployed Lambda or Task.
21 *
22 * ### Reading Current Values
23 * Provide the `GetAssetPropertyValueHttp` implementation layer on the
24 * Function effect, bind the asset in the init phase, then call the returned
25 * client at runtime.
26 *
27 * **Example:** Read the Latest Temperature
28 * ```typescript
29 * // init
30 * const getValue = yield* AWS.IoTSiteWise.GetAssetPropertyValue(asset);
31 *
32 * // runtime
33 * const { propertyValue } = yield* getValue({ propertyId });
34 * const celsius = propertyValue?.value.doubleValue;
35 * // on the Function effect:
36 * // .pipe(Effect.provide(AWS.IoTSiteWise.GetAssetPropertyValueHttp))
37 * ```
38 *
39 * @binding
40 */
41export interface GetAssetPropertyValue extends Binding.Service<
42 GetAssetPropertyValue,
43 "AWS.IoTSiteWise.GetAssetPropertyValue",
44 (
45 asset: Asset,
46 ) => Effect.Effect<
47 (
48 request: GetAssetPropertyValueRequest,
49 ) => Effect.Effect<
50 sitewise.GetAssetPropertyValueResponse,
51 sitewise.GetAssetPropertyValueError
52 >
53 >
54> {}
55export const GetAssetPropertyValue = Binding.Service<GetAssetPropertyValue>(
56 "AWS.IoTSiteWise.GetAssetPropertyValue",
57);