| 1 | import type * as geoRoutes from "@distilled.cloud/aws/geo-routes"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `geo-routes:CalculateRoutes` — compute one or more |
| 7 | * routes between an origin and a destination, with optional waypoints, travel |
| 8 | * mode, and traffic options. |
| 9 | * |
| 10 | * geo-routes is a standalone, pay-per-call Amazon Location API with no |
| 11 | * resource to manage: the binding takes no arguments and grants the function |
| 12 | * `geo-routes:CalculateRoutes`. Requests and responses are raw distilled types |
| 13 | * (`Origin`/`Destination` are `[longitude, latitude]` pairs). |
| 14 | * |
| 15 | * ### Calculating Routes |
| 16 | * Provide the `CalculateRoutesHttp` implementation layer on the Function |
| 17 | * effect (`.pipe(Effect.provide(AWS.GeoRoutes.CalculateRoutesHttp))`), bind in |
| 18 | * the init phase, then call the client at runtime. |
| 19 | * |
| 20 | * **Example:** Calculate a route between two points |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const calculateRoutes = yield* AWS.GeoRoutes.CalculateRoutes(); |
| 24 | * |
| 25 | * // runtime — coordinates are [longitude, latitude] |
| 26 | * const result = yield* calculateRoutes({ |
| 27 | * Origin: [-122.339, 47.61], |
| 28 | * Destination: [-122.201, 47.61], |
| 29 | * TravelMode: "Car", |
| 30 | * }); |
| 31 | * const distanceMeters = result.Routes?.[0]?.Summary?.Distance; |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface CalculateRoutes extends Binding.Service< |
| 37 | CalculateRoutes, |
| 38 | "AWS.GeoRoutes.CalculateRoutes", |
| 39 | () => Effect.Effect< |
| 40 | ( |
| 41 | request: geoRoutes.CalculateRoutesRequest, |
| 42 | ) => Effect.Effect< |
| 43 | geoRoutes.CalculateRoutesResponse, |
| 44 | geoRoutes.CalculateRoutesError |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | export const CalculateRoutes = Binding.Service<CalculateRoutes>( |
| 49 | "AWS.GeoRoutes.CalculateRoutes", |
| 50 | ); |