| 1 | import type * as geoPlaces from "@distilled.cloud/aws/geo-places"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `geo-places:ReverseGeocode` — convert geographic |
| 7 | * coordinates into a human-readable address or place, with optional filtering |
| 8 | * by place type and additional features such as time zones. |
| 9 | * |
| 10 | * geo-places 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-places:ReverseGeocode`. Requests and responses are raw distilled types |
| 13 | * (no marshalling). |
| 14 | * |
| 15 | * ### Reverse Geocoding |
| 16 | * Provide the `ReverseGeocodeHttp` implementation layer on the Function effect |
| 17 | * (`.pipe(Effect.provide(AWS.GeoPlaces.ReverseGeocodeHttp))`), bind in the |
| 18 | * init phase, then call the client at runtime. |
| 19 | * |
| 20 | * **Example:** Reverse geocode a position |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const reverseGeocode = yield* AWS.GeoPlaces.ReverseGeocode(); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const result = yield* reverseGeocode({ |
| 27 | * QueryPosition: [-122.3381, 47.6101], // [longitude, latitude] |
| 28 | * MaxResults: 1, |
| 29 | * }); |
| 30 | * const address = result.ResultItems?.[0]?.Address?.Label; |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface ReverseGeocode extends Binding.Service< |
| 36 | ReverseGeocode, |
| 37 | "AWS.GeoPlaces.ReverseGeocode", |
| 38 | () => Effect.Effect< |
| 39 | ( |
| 40 | request: geoPlaces.ReverseGeocodeRequest, |
| 41 | ) => Effect.Effect< |
| 42 | geoPlaces.ReverseGeocodeResponse, |
| 43 | geoPlaces.ReverseGeocodeError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ReverseGeocode = Binding.Service<ReverseGeocode>( |
| 48 | "AWS.GeoPlaces.ReverseGeocode", |
| 49 | ); |