export type GetApiV1SameDayDeliveryArgs = {next_page_token?: string | undefined, status?: ('PENDING' | 'FAILED' | 'AWAITING_PICKUP' | 'IN_TRANSIT' | 'DELIVERED' | 'CANCELED' | 'INCOMPLETE') | undefined, limit?: number | undefined}; export type GetApiV1SameDayDeliveryOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get same day delivery orders * * GET /v1/same_day_delivery */ export const getApiV1SameDayDelivery = async (args: GetApiV1SameDayDeliveryArgs, options?: GetApiV1SameDayDeliveryOptions) => { const {baseUrl = "https://api.truepill.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.next_page_token != null) query.append("next_page_token", String(args.next_page_token)) if (args.status != null) query.append("status", String(args.status)) if (args.limit != null) query.append("limit", String(args.limit)) if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/same_day_delivery${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() };