| 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:SearchNearby` — find places around a |
| 7 | * geographic position, optionally filtered by radius, bounding box, |
| 8 | * categories, or food types. |
| 9 | * |
| 10 | * geo-places is a standalone, pay-per-call Amazon Location API with no |
| 11 | * resource to manage: the binding takes no arguments and grants the function |
| 12 | * `geo-places:SearchNearby`. Requests and responses are raw distilled types |
| 13 | * (no marshalling). |
| 14 | * |
| 15 | * ### Searching Nearby Places |
| 16 | * Provide the `SearchNearbyHttp` implementation layer on the Function effect |
| 17 | * (`.pipe(Effect.provide(AWS.GeoPlaces.SearchNearbyHttp))`), bind in the |
| 18 | * init phase, then call the client at runtime. |
| 19 | * |
| 20 | * **Example:** Find places around a position |
| 21 | * ```typescript |
| 22 | * // init |
| 23 | * const searchNearby = yield* AWS.GeoPlaces.SearchNearby(); |
| 24 | * |
| 25 | * // runtime |
| 26 | * const result = yield* searchNearby({ |
| 27 | * QueryPosition: [-122.3493, 47.6205], // [lng, lat] |
| 28 | * QueryRadius: 1000, |
| 29 | * MaxResults: 5, |
| 30 | * }); |
| 31 | * const titles = result.ResultItems?.map((item) => item.Title); |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface SearchNearby extends Binding.Service< |
| 37 | SearchNearby, |
| 38 | "AWS.GeoPlaces.SearchNearby", |
| 39 | () => Effect.Effect< |
| 40 | ( |
| 41 | request: geoPlaces.SearchNearbyRequest, |
| 42 | ) => Effect.Effect< |
| 43 | geoPlaces.SearchNearbyResponse, |
| 44 | geoPlaces.SearchNearbyError |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | export const SearchNearby = Binding.Service<SearchNearby>( |
| 49 | "AWS.GeoPlaces.SearchNearby", |
| 50 | ); |