| 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 { PlaceIndex } from "./PlaceIndex.ts"; |
| 5 | |
| 6 | /** |
| 7 | * `GetPlace` request with `IndexName` injected from the bound |
| 8 | * resource. |
| 9 | */ |
| 10 | export interface GetPlaceRequest extends Omit< |
| 11 | location.GetPlaceRequest, |
| 12 | "IndexName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Fetches the full details of a place by the `PlaceId` returned from a search. |
| 17 | * |
| 18 | * Runtime binding for the `GetPlace` operation (IAM action |
| 19 | * `geo:GetPlace`), scoped to one {@link PlaceIndex}. Provide the implementation with |
| 20 | * `Effect.provide(AWS.Location.GetPlaceHttp)`. |
| 21 | * |
| 22 | * ### Searching Places |
| 23 | * **Example:** Fetch Place Details |
| 24 | * ```typescript |
| 25 | * const getPlace = yield* Location.GetPlace(index); |
| 26 | * |
| 27 | * const place = yield* getPlace({ PlaceId: placeId }); |
| 28 | * // place.Place.Label, place.Place.Geometry.Point |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface GetPlace extends Binding.Service< |
| 34 | GetPlace, |
| 35 | "AWS.Location.GetPlace", |
| 36 | ( |
| 37 | index: PlaceIndex, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: GetPlaceRequest, |
| 41 | ) => Effect.Effect<location.GetPlaceResponse, location.GetPlaceError> |
| 42 | > |
| 43 | > {} |
| 44 | export const GetPlace = Binding.Service<GetPlace>("AWS.Location.GetPlace"); |