| 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:Autocomplete` — complete potential places |
| 7 | * and addresses as the user types, based on partial input. |
| 8 | * |
| 9 | * geo-places is a standalone, pay-per-call Amazon Location API with no |
| 10 | * resource to manage: the binding takes no arguments and grants the function |
| 11 | * `geo-places:Autocomplete`. Requests and responses are raw distilled types |
| 12 | * (no marshalling). |
| 13 | * |
| 14 | * ### Autocompleting Queries |
| 15 | * Provide the `AutocompleteHttp` implementation layer on the Function effect |
| 16 | * (`.pipe(Effect.provide(AWS.GeoPlaces.AutocompleteHttp))`), bind in the init |
| 17 | * phase, then call the client at runtime. |
| 18 | * |
| 19 | * **Example:** Autocomplete a partial address |
| 20 | * ```typescript |
| 21 | * // init |
| 22 | * const autocomplete = yield* AWS.GeoPlaces.Autocomplete(); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const result = yield* autocomplete({ |
| 26 | * QueryText: "1600 Pennsylvania", |
| 27 | * MaxResults: 5, |
| 28 | * }); |
| 29 | * const first = result.ResultItems?.[0]?.Title; |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface Autocomplete extends Binding.Service< |
| 35 | Autocomplete, |
| 36 | "AWS.GeoPlaces.Autocomplete", |
| 37 | () => Effect.Effect< |
| 38 | ( |
| 39 | request: geoPlaces.AutocompleteRequest, |
| 40 | ) => Effect.Effect< |
| 41 | geoPlaces.AutocompleteResponse, |
| 42 | geoPlaces.AutocompleteError |
| 43 | > |
| 44 | > |
| 45 | > {} |
| 46 | export const Autocomplete = Binding.Service<Autocomplete>( |
| 47 | "AWS.GeoPlaces.Autocomplete", |
| 48 | ); |