| 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 | * `SearchPlaceIndexForText` request with `IndexName` injected from the bound |
| 8 | * resource. |
| 9 | */ |
| 10 | export interface SearchPlaceIndexForTextRequest extends Omit< |
| 11 | location.SearchPlaceIndexForTextRequest, |
| 12 | "IndexName" |
| 13 | > {} |
| 14 | |
| 15 | /** |
| 16 | * Geocodes a free-form text query (address, place name, business) into ranked places with coordinates. |
| 17 | * |
| 18 | * Runtime binding for the `SearchPlaceIndexForText` operation (IAM action |
| 19 | * `geo:SearchPlaceIndexForText`), scoped to one {@link PlaceIndex}. Provide the implementation with |
| 20 | * `Effect.provide(AWS.Location.SearchPlaceIndexForTextHttp)`. |
| 21 | * |
| 22 | * ### Searching Places |
| 23 | * **Example:** Geocode an Address |
| 24 | * ```typescript |
| 25 | * const searchText = yield* Location.SearchPlaceIndexForText(index); |
| 26 | * |
| 27 | * const results = yield* searchText({ |
| 28 | * Text: "Space Needle, Seattle, WA", |
| 29 | * MaxResults: 3, |
| 30 | * }); |
| 31 | * // results.Results[0].Place.Geometry.Point → [longitude, latitude] |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface SearchPlaceIndexForText extends Binding.Service< |
| 37 | SearchPlaceIndexForText, |
| 38 | "AWS.Location.SearchPlaceIndexForText", |
| 39 | ( |
| 40 | index: PlaceIndex, |
| 41 | ) => Effect.Effect< |
| 42 | ( |
| 43 | request: SearchPlaceIndexForTextRequest, |
| 44 | ) => Effect.Effect< |
| 45 | location.SearchPlaceIndexForTextResponse, |
| 46 | location.SearchPlaceIndexForTextError |
| 47 | > |
| 48 | > |
| 49 | > {} |
| 50 | export const SearchPlaceIndexForText = Binding.Service<SearchPlaceIndexForText>( |
| 51 | "AWS.Location.SearchPlaceIndexForText", |
| 52 | ); |