Skip to content

Autocomplete

Source: src/AWS/GeoPlaces/Autocomplete.ts

Runtime binding for geo-places:Autocomplete — complete potential places and addresses as the user types, based on partial input.

geo-places is a standalone, pay-per-call Amazon Location API with no resource to manage: the binding takes no arguments and grants the function geo-places:Autocomplete. Requests and responses are raw distilled types (no marshalling).

Provide the AutocompleteHttp implementation layer on the Function effect (.pipe(Effect.provide(AWS.GeoPlaces.AutocompleteHttp))), bind in the init phase, then call the client at runtime.

// init
const autocomplete = yield* AWS.GeoPlaces.Autocomplete();
// runtime
const result = yield* autocomplete({
QueryText: "1600 Pennsylvania",
MaxResults: 5,
});
const first = result.ResultItems?.[0]?.Title;