sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ Location/ SearchPlaceIndexForText.ts

import type * as location from "@distilled.cloud/aws/location";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { PlaceIndex } from "./PlaceIndex.ts";

/**
 * `SearchPlaceIndexForText` request with `IndexName` injected from the bound
 * resource.
 */
export interface SearchPlaceIndexForTextRequest extends Omit<
  location.SearchPlaceIndexForTextRequest,
  "IndexName"
> {}

/**
 * Geocodes a free-form text query (address, place name, business) into ranked places with coordinates.
 *
 * Runtime binding for the `SearchPlaceIndexForText` operation (IAM action
 * `geo:SearchPlaceIndexForText`), scoped to one {@link PlaceIndex}. Provide the implementation with
 * `Effect.provide(AWS.Location.SearchPlaceIndexForTextHttp)`.
 *
 * ### Searching Places
 * **Example:** Geocode an Address
 * ```typescript
 * const searchText = yield* Location.SearchPlaceIndexForText(index);
 *
 * const results = yield* searchText({
 *   Text: "Space Needle, Seattle, WA",
 *   MaxResults: 3,
 * });
 * // results.Results[0].Place.Geometry.Point → [longitude, latitude]
 * ```
 *
 * @binding
 */
export interface SearchPlaceIndexForText extends Binding.Service<
  SearchPlaceIndexForText,
  "AWS.Location.SearchPlaceIndexForText",
  (
    index: PlaceIndex,
  ) => Effect.Effect<
    (
      request: SearchPlaceIndexForTextRequest,
    ) => Effect.Effect<
      location.SearchPlaceIndexForTextResponse,
      location.SearchPlaceIndexForTextError
    >
  >
> {}
export const SearchPlaceIndexForText = Binding.Service<SearchPlaceIndexForText>(
  "AWS.Location.SearchPlaceIndexForText",
);