export type GetApiAviatoGeocoderSearchArgs = {text: string}; export type GetApiAviatoGeocoderSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for a location and get geocoded matches. Use the geocoded ID with person/company search locationIDList filter. * * GET /aviato/geocoder/search */ export const getApiAviatoGeocoderSearch = async (args: GetApiAviatoGeocoderSearchArgs, options?: GetApiAviatoGeocoderSearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.text != null) query.append("text", String(args.text)) const url = `${baseUrl.replace(/\/+$/, '')}/aviato/geocoder/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };