| 1 | import type * as mi from "@distilled.cloud/aws/iot-managed-integrations"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ManagedThing } from "./ManagedThing.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for the `GetManagedThingState` operation (IAM action |
| 8 | * `iotmanagedintegrations:GetManagedThingState`), scoped to one |
| 9 | * {@link ManagedThing}. |
| 10 | * |
| 11 | * Reads the last-reported state of every endpoint/capability of the bound |
| 12 | * device (e.g. whether a smart plug is on). Provide the implementation with |
| 13 | * `Effect.provide(AWS.IoTManagedIntegrations.GetManagedThingStateHttp)`. |
| 14 | * |
| 15 | * ### Reading Device State |
| 16 | * **Example:** Read the Current Device State |
| 17 | * ```typescript |
| 18 | * const getState = yield* IoTManagedIntegrations.GetManagedThingState(thing); |
| 19 | * |
| 20 | * const { Endpoints } = yield* getState(); |
| 21 | * // Endpoints[0].capabilities[0].properties |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface GetManagedThingState extends Binding.Service< |
| 27 | GetManagedThingState, |
| 28 | "AWS.IoTManagedIntegrations.GetManagedThingState", |
| 29 | ( |
| 30 | thing: ManagedThing, |
| 31 | ) => Effect.Effect< |
| 32 | () => Effect.Effect< |
| 33 | mi.GetManagedThingStateResponse, |
| 34 | mi.GetManagedThingStateError |
| 35 | > |
| 36 | > |
| 37 | > {} |
| 38 | export const GetManagedThingState = Binding.Service<GetManagedThingState>( |
| 39 | "AWS.IoTManagedIntegrations.GetManagedThingState", |
| 40 | ); |