export type CreateApiCgmPatientIdConvertZipArgs = {patient_id: number, date_since: string, date_until: string, body: BodyInit}; export type CreateApiCgmPatientIdConvertZipOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * [DEPRECATED] load CGM data and return a summarized zip file of the data * * POST /cgm/{patient_id}/convert/zip */ export const createApiCgmPatientIdConvertZip = async (args: CreateApiCgmPatientIdConvertZipArgs, options: CreateApiCgmPatientIdConvertZipOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (args.date_since != null) query.append("date_since", String(args.date_since)) if (args.date_until != null) query.append("date_until", String(args.date_until)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/cgm/${encodeURIComponent(String(args.patient_id))}/convert/zip${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: 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() };