| 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 { RouteCalculator } from "./RouteCalculator.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `CalculateRoute` request with `CalculatorName` injected from the bound |
| 8 | * resource. |
| 9 | */ |
| 10 | export interface CalculateRouteRequest extends Omit< |
| 11 | location.CalculateRouteRequest, |
| 12 | "CalculatorName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Calculates a route (distance, duration, and legs) between a departure and a destination position. |
| 17 | * |
| 18 | * Runtime binding for the `CalculateRoute` operation (IAM action |
| 19 | * `geo:CalculateRoute`), scoped to one {@link RouteCalculator}. Provide the implementation with |
| 20 | * `Effect.provide(AWS.Location.CalculateRouteHttp)`. |
| 21 | * |
| 22 | * ### Calculating Routes |
| 23 | * **Example:** Calculate a Route |
| 24 | * ```typescript |
| 25 | * const calculateRoute = yield* Location.CalculateRoute(calculator); |
| 26 | * |
| 27 | * const route = yield* calculateRoute({ |
| 28 | * DeparturePosition: [-122.3493, 47.6205], |
| 29 | * DestinationPosition: [-122.3321, 47.6062], |
| 30 | * }); |
| 31 | * // route.Summary.Distance, route.Summary.DurationSeconds |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface CalculateRoute extends Binding.Service< |
| 37 | CalculateRoute, |
| 38 | "AWS.Location.CalculateRoute", |
| 39 | ( |
| 40 | calculator: RouteCalculator, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: CalculateRouteRequest, |
| 44 | ) => Effect.Effect< |
| 45 | location.CalculateRouteResponse, |
| 46 | location.CalculateRouteError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const CalculateRoute = Binding.Service<CalculateRoute>( |
| 51 | "AWS.Location.CalculateRoute", |
| 52 | ); |