| 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:Geocode` — convert an address or place |
| 7 | * description into geographic coordinates. |
| 8 | * |
| 9 | * geo-places is a standalone, pay-per-call Amazon Location API with no |
| 10 | * resource to manage: the binding takes no arguments and grants the function |
| 11 | * `geo-places:Geocode`. Requests and responses are raw distilled types (no |
| 12 | * marshalling). |
| 13 | * |
| 14 | * ### Geocoding Addresses |
| 15 | * Provide the `GeocodeHttp` implementation layer on the Function effect |
| 16 | * (`.pipe(Effect.provide(AWS.GeoPlaces.GeocodeHttp))`), bind in the init |
| 17 | * phase, then call the client at runtime. |
| 18 | * |
| 19 | * **Example:** Geocode an address to coordinates |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const geocode = yield* AWS.GeoPlaces.Geocode(); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const result = yield* geocode({ |
| 26 | * QueryText: "1600 Pennsylvania Ave NW, Washington, DC", |
| 27 | * }); |
| 28 | * const position = result.ResultItems?.[0]?.Position; // [lng, lat] |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface Geocode extends Binding.Service< |
| 34 | Geocode, |
| 35 | "AWS.GeoPlaces.Geocode", |
| 36 | () => Effect.Effect< |
| 37 | ( |
| 38 | request: geoPlaces.GeocodeRequest, |
| 39 | ) => Effect.Effect<geoPlaces.GeocodeResponse, geoPlaces.GeocodeError> |
| 40 | > |
| 41 | > {} |
| 42 | export const Geocode = Binding.Service<Geocode>("AWS.GeoPlaces.Geocode"); |