| 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:Suggest` — suggest places and query |
| 7 | * refinements for a free-form (possibly misspelled or partial) query, |
| 8 | * ranked by relevance. Unlike Autocomplete, Suggest returns place |
| 9 | * suggestions (with `PlaceId`s) and query suggestions, tuned for |
| 10 | * point-of-interest discovery. |
| 11 | * |
| 12 | * geo-places is a standalone, pay-per-call Amazon Location API with no |
| 13 | * resource to manage: the binding takes no arguments and grants the function |
| 14 | * `geo-places:Suggest`. Requests and responses are raw distilled types (no |
| 15 | * marshalling). |
| 16 | * |
| 17 | * ### Suggesting Places |
| 18 | * Provide the `SuggestHttp` implementation layer on the Function effect |
| 19 | * (`.pipe(Effect.provide(AWS.GeoPlaces.SuggestHttp))`), bind in the init |
| 20 | * phase, then call the client at runtime. |
| 21 | * |
| 22 | * **Example:** Suggest places for a free-form query |
| 23 | * ```typescript |
| 24 | * // init |
| 25 | * const suggest = yield* AWS.GeoPlaces.Suggest(); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const result = yield* suggest({ |
| 29 | * QueryText: "coffee", |
| 30 | * BiasPosition: [-122.3493, 47.6205], // [lng, lat] |
| 31 | * MaxResults: 5, |
| 32 | * }); |
| 33 | * const first = result.ResultItems?.[0]?.Title; |
| 34 | * ``` |
| 35 | * |
| 36 | * @binding |
| 37 | */ |
| 38 | export interface Suggest extends Binding.Service< |
| 39 | Suggest, |
| 40 | "AWS.GeoPlaces.Suggest", |
| 41 | () => Effect.Effect< |
| 42 | ( |
| 43 | request: geoPlaces.SuggestRequest, |
| 44 | ) => Effect.Effect<geoPlaces.SuggestResponse, geoPlaces.SuggestError> |
| 45 | > |
| 46 | > {} |
| 47 | export const Suggest = Binding.Service<Suggest>("AWS.GeoPlaces.Suggest"); |