export type CreateApiV1ReefersSamplesArgs = {body: {start_time: number, end_time?: number | undefined, asset_ids?: ({''?: Array | undefined}) | undefined}}; export type CreateApiV1ReefersSamplesOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * List sensor samples for reefers * * POST /v1/reefers/samples */ export const createApiV1ReefersSamples = async (args: CreateApiV1ReefersSamplesArgs, options?: CreateApiV1ReefersSamplesOptions) => { const {baseUrl = "https://api.gomotive.com", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (sec0 !== undefined) headers.set("x-api-key", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/v1/reefers/samples${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return (await res.json()) as unknown };