1import type * as location from "@distilled.cloud/aws/location";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Tracker } from "./Tracker.ts";
5
6/**
7 * `GetDevicePosition` request with `TrackerName` injected from the bound
8 * resource.
9 */
10export interface GetDevicePositionRequest extends Omit<
11 location.GetDevicePositionRequest,
12 "TrackerName"
13> {}
14
15/**
16 * Retrieves a device's most recent position reported to the tracker.
17 *
18 * Runtime binding for the `GetDevicePosition` operation (IAM action
19 * `geo:GetDevicePosition`), scoped to one {@link Tracker}. Provide the implementation with
20 * `Effect.provide(AWS.Location.GetDevicePositionHttp)`.
21 *
22 * ### Reading Device Positions
23 * **Example:** Read a Device's Latest Position
24 * ```typescript
25 * const getPosition = yield* Location.GetDevicePosition(tracker);
26 *
27 * const latest = yield* getPosition({ DeviceId: "vehicle-1" });
28 * // latest.Position → [longitude, latitude]
29 * ```
30 *
31 * @binding
32 */
33export interface GetDevicePosition extends Binding.Service<
34 GetDevicePosition,
35 "AWS.Location.GetDevicePosition",
36 (
37 tracker: Tracker,
38 ) => Effect.Effect<
39 (
40 request: GetDevicePositionRequest,
41 ) => Effect.Effect<
42 location.GetDevicePositionResponse,
43 location.GetDevicePositionError
44 >
45 >
46> {}
47export const GetDevicePosition = Binding.Service<GetDevicePosition>(
48 "AWS.Location.GetDevicePosition",
49);