| 1 | import type * as iotw from "@distilled.cloud/aws/iot-wireless"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { WirelessDevice } from "./WirelessDevice.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Request for {@link TestWirelessDevice}. The bound device's id is injected |
| 8 | * automatically, leaving nothing else to supply. |
| 9 | */ |
| 10 | export interface TestWirelessDeviceRequest extends Omit< |
| 11 | iotw.TestWirelessDeviceRequest, |
| 12 | "Id" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `iotwireless:TestWirelessDevice` — simulate a |
| 17 | * provisioned device by sending an uplink data payload of `Hello` on behalf |
| 18 | * of the bound wireless device, from a deployed Lambda or Task. Useful for |
| 19 | * verifying a destination's routing without radio hardware. |
| 20 | * |
| 21 | * ### Simulating an Uplink |
| 22 | * Provide the `TestWirelessDeviceHttp` implementation layer on the Function |
| 23 | * effect, bind the device in the init phase, then call the returned client |
| 24 | * at runtime. |
| 25 | * |
| 26 | * **Example:** Send a Test Uplink |
| 27 | * ```typescript |
| 28 | * // init |
| 29 | * const testDevice = yield* AWS.IoTWireless.TestWirelessDevice(device); |
| 30 | * |
| 31 | * // runtime |
| 32 | * const { Result } = yield* testDevice(); |
| 33 | * // on the Function effect: |
| 34 | * // .pipe(Effect.provide(AWS.IoTWireless.TestWirelessDeviceHttp)) |
| 35 | * ``` |
| 36 | * |
| 37 | * @binding |
| 38 | */ |
| 39 | export interface TestWirelessDevice extends Binding.Service< |
| 40 | TestWirelessDevice, |
| 41 | "AWS.IoTWireless.TestWirelessDevice", |
| 42 | ( |
| 43 | device: WirelessDevice, |
| 44 | ) => Effect.Effect< |
| 45 | ( |
| 46 | request?: TestWirelessDeviceRequest, |
| 47 | ) => Effect.Effect< |
| 48 | iotw.TestWirelessDeviceResponse, |
| 49 | iotw.TestWirelessDeviceError |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | export const TestWirelessDevice = Binding.Service<TestWirelessDevice>( |
| 54 | "AWS.IoTWireless.TestWirelessDevice", |
| 55 | ); |