export type GetApiV1ConfigdumpConfigdumpZipArgs = {ignoreerrors?: boolean | undefined, defaults?: boolean | undefined, externalcas?: boolean | undefined, exportCasForPeerImport?: boolean | undefined, include?: Array | undefined, exclude?: Array | undefined}; export type GetApiV1ConfigdumpConfigdumpZipOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get the configuration as a ZIP file. * * GET /v1/configdump/configdump.zip */ export const getApiV1ConfigdumpConfigdumpZip = async (args: GetApiV1ConfigdumpConfigdumpZipArgs, options: GetApiV1ConfigdumpConfigdumpZipOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (args.ignoreerrors != null) query.append("ignoreerrors", String(args.ignoreerrors)) if (args.defaults != null) query.append("defaults", String(args.defaults)) if (args.externalcas != null) query.append("externalcas", String(args.externalcas)) if (args.exportCasForPeerImport != null) query.append("exportCasForPeerImport", String(args.exportCasForPeerImport)) for (const item of args.include ?? []) query.append("include", String(item)) for (const item of args.exclude ?? []) query.append("exclude", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/configdump/configdump.zip${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() };