1import type * as location from "@distilled.cloud/aws/location";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { PlaceIndex } from "./PlaceIndex.ts";
5
6/**
7 * `SearchPlaceIndexForPosition` request with `IndexName` injected from the bound
8 * resource.
9 */
10export interface SearchPlaceIndexForPositionRequest extends Omit<
11 location.SearchPlaceIndexForPositionRequest,
12 "IndexName"
13> {}
14
15/**
16 * Reverse-geocodes a coordinate into the nearest addresses and places.
17 *
18 * Runtime binding for the `SearchPlaceIndexForPosition` operation (IAM action
19 * `geo:SearchPlaceIndexForPosition`), scoped to one {@link PlaceIndex}. Provide the implementation with
20 * `Effect.provide(AWS.Location.SearchPlaceIndexForPositionHttp)`.
21 *
22 * ### Searching Places
23 * **Example:** Reverse-Geocode a Coordinate
24 * ```typescript
25 * const searchPosition = yield* Location.SearchPlaceIndexForPosition(index);
26 *
27 * const results = yield* searchPosition({
28 * Position: [-122.3493, 47.6205], // [longitude, latitude]
29 * MaxResults: 1,
30 * });
31 * // results.Results[0].Place.Label → nearest address
32 * ```
33 *
34 * @binding
35 */
36export interface SearchPlaceIndexForPosition extends Binding.Service<
37 SearchPlaceIndexForPosition,
38 "AWS.Location.SearchPlaceIndexForPosition",
39 (
40 index: PlaceIndex,
41 ) => Effect.Effect<
42 (
43 request: SearchPlaceIndexForPositionRequest,
44 ) => Effect.Effect<
45 location.SearchPlaceIndexForPositionResponse,
46 location.SearchPlaceIndexForPositionError
47 >
48 >
49> {}
50export const SearchPlaceIndexForPosition =
51 Binding.Service<SearchPlaceIndexForPosition>(
52 "AWS.Location.SearchPlaceIndexForPosition",
53 );