| 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 GetWirelessDeviceStatistics}. The bound device's id is |
| 8 | * injected automatically, leaving nothing else to supply. |
| 9 | */ |
| 10 | export interface GetWirelessDeviceStatisticsRequest extends Omit< |
| 11 | iotw.GetWirelessDeviceStatisticsRequest, |
| 12 | "WirelessDeviceId" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `iotwireless:GetWirelessDeviceStatistics` — read the |
| 17 | * bound wireless device's operating information (last uplink time, RSSI/SNR |
| 18 | * gateway metadata, battery level, device state) from a deployed Lambda or |
| 19 | * Task. |
| 20 | * |
| 21 | * ### Reading Device Statistics |
| 22 | * Provide the `GetWirelessDeviceStatisticsHttp` implementation layer on the |
| 23 | * Function effect, bind the device in the init phase, then call the |
| 24 | * returned client at runtime. |
| 25 | * |
| 26 | * **Example:** Check When the Device Last Reported |
| 27 | * ```typescript |
| 28 | * // init |
| 29 | * const getStats = yield* AWS.IoTWireless.GetWirelessDeviceStatistics(device); |
| 30 | * |
| 31 | * // runtime |
| 32 | * const stats = yield* getStats(); |
| 33 | * const lastSeen = stats.LastUplinkReceivedAt; |
| 34 | * // on the Function effect: |
| 35 | * // .pipe(Effect.provide(AWS.IoTWireless.GetWirelessDeviceStatisticsHttp)) |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface GetWirelessDeviceStatistics extends Binding.Service< |
| 41 | GetWirelessDeviceStatistics, |
| 42 | "AWS.IoTWireless.GetWirelessDeviceStatistics", |
| 43 | ( |
| 44 | device: WirelessDevice, |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request?: GetWirelessDeviceStatisticsRequest, |
| 48 | ) => Effect.Effect< |
| 49 | iotw.GetWirelessDeviceStatisticsResponse, |
| 50 | iotw.GetWirelessDeviceStatisticsError |
| 51 | > |
| 52 | > |
| 53 | > {} |
| 54 | export const GetWirelessDeviceStatistics = |
| 55 | Binding.Service<GetWirelessDeviceStatistics>( |
| 56 | "AWS.IoTWireless.GetWirelessDeviceStatistics", |
| 57 | ); |