| 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 ListQueuedMessages}. The bound device's id is injected |
| 8 | * automatically. |
| 9 | */ |
| 10 | export interface ListQueuedMessagesRequest extends Omit< |
| 11 | iotw.ListQueuedMessagesRequest, |
| 12 | "Id" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for `iotwireless:ListQueuedMessages` — list the downlink |
| 17 | * messages queued for the bound wireless device from a deployed Lambda or |
| 18 | * Task. |
| 19 | * |
| 20 | * ### Inspecting the Downlink Queue |
| 21 | * Provide the `ListQueuedMessagesHttp` implementation layer on the Function |
| 22 | * effect, bind the device in the init phase, then call the returned client |
| 23 | * at runtime. |
| 24 | * |
| 25 | * **Example:** Count Pending Downlinks |
| 26 | * ```typescript |
| 27 | * // init |
| 28 | * const listQueued = yield* AWS.IoTWireless.ListQueuedMessages(device); |
| 29 | * |
| 30 | * // runtime |
| 31 | * const { DownlinkQueueMessagesList } = yield* listQueued(); |
| 32 | * const pending = DownlinkQueueMessagesList?.length ?? 0; |
| 33 | * // on the Function effect: |
| 34 | * // .pipe(Effect.provide(AWS.IoTWireless.ListQueuedMessagesHttp)) |
| 35 | * ``` |
| 36 | * |
| 37 | * @binding |
| 38 | */ |
| 39 | export interface ListQueuedMessages extends Binding.Service< |
| 40 | ListQueuedMessages, |
| 41 | "AWS.IoTWireless.ListQueuedMessages", |
| 42 | ( |
| 43 | device: WirelessDevice, |
| 44 | ) => Effect.Effect< |
| 45 | ( |
| 46 | request?: ListQueuedMessagesRequest, |
| 47 | ) => Effect.Effect< |
| 48 | iotw.ListQueuedMessagesResponse, |
| 49 | iotw.ListQueuedMessagesError |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | export const ListQueuedMessages = Binding.Service<ListQueuedMessages>( |
| 54 | "AWS.IoTWireless.ListQueuedMessages", |
| 55 | ); |