| 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 | * `SendManagedThingCommand` request with `ManagedThingId` injected from the |
| 8 | * bound managed thing. |
| 9 | */ |
| 10 | export interface SendManagedThingCommandRequest extends Omit< |
| 11 | mi.SendManagedThingCommandRequest, |
| 12 | "ManagedThingId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for the `SendManagedThingCommand` operation (IAM action |
| 17 | * `iotmanagedintegrations:SendManagedThingCommand`), scoped to one |
| 18 | * {@link ManagedThing}. |
| 19 | * |
| 20 | * Sends a command to the bound device using its Matter-derived capability |
| 21 | * data model — the primary control-plane-to-device data path. Provide the |
| 22 | * implementation with |
| 23 | * `Effect.provide(AWS.IoTManagedIntegrations.SendManagedThingCommandHttp)`. |
| 24 | * |
| 25 | * ### Controlling Devices |
| 26 | * **Example:** Toggle a Device On |
| 27 | * ```typescript |
| 28 | * const sendCommand = yield* IoTManagedIntegrations.SendManagedThingCommand(thing); |
| 29 | * |
| 30 | * const { TraceId } = yield* sendCommand({ |
| 31 | * Endpoints: [ |
| 32 | * { |
| 33 | * endpointId: "1", |
| 34 | * capabilities: [ |
| 35 | * { |
| 36 | * id: "aws.OnOff", |
| 37 | * name: "On/Off", |
| 38 | * version: "1", |
| 39 | * actions: [{ name: "activate", actionTraceId: "req-1" }], |
| 40 | * }, |
| 41 | * ], |
| 42 | * }, |
| 43 | * ], |
| 44 | * }); |
| 45 | * ``` |
| 46 | * |
| 47 | * @binding |
| 48 | */ |
| 49 | export interface SendManagedThingCommand extends Binding.Service< |
| 50 | SendManagedThingCommand, |
| 51 | "AWS.IoTManagedIntegrations.SendManagedThingCommand", |
| 52 | ( |
| 53 | thing: ManagedThing, |
| 54 | ) => Effect.Effect< |
| 55 | ( |
| 56 | request: SendManagedThingCommandRequest, |
| 57 | ) => Effect.Effect< |
| 58 | mi.SendManagedThingCommandResponse, |
| 59 | mi.SendManagedThingCommandError |
| 60 | > |
| 61 | > |
| 62 | > {} |
| 63 | export const SendManagedThingCommand = Binding.Service<SendManagedThingCommand>( |
| 64 | "AWS.IoTManagedIntegrations.SendManagedThingCommand", |
| 65 | ); |