export type GetApiV1NearbySameDayPickupLocationsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for nearby same day pickup locations using address details * * GET /v1/nearby_same_day_pickup_locations */ export const getApiV1NearbySameDayPickupLocations = async (options?: GetApiV1NearbySameDayPickupLocationsOptions) => { const {baseUrl = "https://api.truepill.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/nearby_same_day_pickup_locations${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 res.blob() };