| 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:GetPlace` — fetch the full details of a |
| 7 | * place (address, contacts, opening hours, time zone, …) by its `PlaceId`, |
| 8 | * as returned by Geocode, SearchText, SearchNearby, Suggest, or |
| 9 | * Autocomplete. |
| 10 | * |
| 11 | * geo-places is a standalone, pay-per-call Amazon Location API with no |
| 12 | * resource to manage: the binding takes no arguments and grants the function |
| 13 | * `geo-places:GetPlace`. Requests and responses are raw distilled types (no |
| 14 | * marshalling). |
| 15 | * |
| 16 | * ### Fetching Place Details |
| 17 | * Provide the `GetPlaceHttp` implementation layer on the Function effect |
| 18 | * (`.pipe(Effect.provide(AWS.GeoPlaces.GetPlaceHttp))`), bind in the init |
| 19 | * phase, then call the client at runtime. |
| 20 | * |
| 21 | * **Example:** Look up a place by its PlaceId |
| 22 | * ```typescript |
| 23 | * // init |
| 24 | * const geocode = yield* AWS.GeoPlaces.Geocode(); |
| 25 | * const getPlace = yield* AWS.GeoPlaces.GetPlace(); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const geocoded = yield* geocode({ QueryText: "Space Needle, Seattle" }); |
| 29 | * const placeId = geocoded.ResultItems?.[0]?.PlaceId; |
| 30 | * const place = yield* getPlace({ PlaceId: placeId! }); |
| 31 | * const label = place.Address?.Label; |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface GetPlace extends Binding.Service< |
| 37 | GetPlace, |
| 38 | "AWS.GeoPlaces.GetPlace", |
| 39 | () => Effect.Effect< |
| 40 | ( |
| 41 | request: geoPlaces.GetPlaceRequest, |
| 42 | ) => Effect.Effect<geoPlaces.GetPlaceResponse, geoPlaces.GetPlaceError> |
| 43 | > |
| 44 | > {} |
| 45 | export const GetPlace = Binding.Service<GetPlace>("AWS.GeoPlaces.GetPlace"); |