| 1 | import type * as location from "@distilled.cloud/aws/location"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { GeofenceCollection } from "./GeofenceCollection.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `ForecastGeofenceEvents` request with `CollectionName` injected from the bound |
| 8 | * resource. |
| 9 | */ |
| 10 | export interface ForecastGeofenceEventsRequest extends Omit< |
| 11 | location.ForecastGeofenceEventsRequest, |
| 12 | "CollectionName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Forecasts which geofences a device will enter or exit given its position and speed. |
| 17 | * |
| 18 | * Runtime binding for the `ForecastGeofenceEvents` operation (IAM action |
| 19 | * `geo:ForecastGeofenceEvents`), scoped to one {@link GeofenceCollection}. Provide the implementation with |
| 20 | * `Effect.provide(AWS.Location.ForecastGeofenceEventsHttp)`. |
| 21 | * |
| 22 | * ### Evaluating Positions Against Geofences |
| 23 | * **Example:** Forecast Upcoming Geofence Events |
| 24 | * ```typescript |
| 25 | * const forecast = yield* Location.ForecastGeofenceEvents(collection); |
| 26 | * |
| 27 | * const events = yield* forecast({ |
| 28 | * DeviceState: { Position: [-122.3493, 47.6205], Speed: 20 }, |
| 29 | * TimeHorizonMinutes: 30, |
| 30 | * }); |
| 31 | * // events.ForecastedEvents → [{ GeofenceId, EventType, NearestDistance }, …] |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface ForecastGeofenceEvents extends Binding.Service< |
| 37 | ForecastGeofenceEvents, |
| 38 | "AWS.Location.ForecastGeofenceEvents", |
| 39 | ( |
| 40 | collection: GeofenceCollection, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: ForecastGeofenceEventsRequest, |
| 44 | ) => Effect.Effect< |
| 45 | location.ForecastGeofenceEventsResponse, |
| 46 | location.ForecastGeofenceEventsError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const ForecastGeofenceEvents = Binding.Service<ForecastGeofenceEvents>( |
| 51 | "AWS.Location.ForecastGeofenceEvents", |
| 52 | ); |