export type ApiKeyField = string; export type ChannelTimeRange = {apikey: ApiKeyField, channel: number, start_time: string, end_time: string}; export type CreateApiSiebatchdV1SiebatchChfetchArgs = {body: ChannelTimeRange}; export type CreateApiSiebatchdV1SiebatchChfetchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch Channel Data * * POST /siebatchd/v1/siebatch/chfetch */ export const createApiSiebatchdV1SiebatchChfetch = async (args: CreateApiSiebatchdV1SiebatchChfetchArgs, options?: CreateApiSiebatchdV1SiebatchChfetchOptions) => { const {baseUrl = "https://batch.sie-remote.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/x-ndjson") const url = `${baseUrl.replace(/\/+$/, '')}/siebatchd/v1/siebatch/chfetch${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 res.blob() };