export type GetApiV1AuthoritiesIdAttachmentsArgs = {id: string}; export type GetApiV1AuthoritiesIdAttachmentsOptions = {baseUrl?: string | undefined, apikey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a compressed file that contains all files attached to an authority. * * GET /v1/authorities/{id}/attachments * * Also accepts auth: oauth2 */ export const getApiV1AuthoritiesIdAttachments = async (args: GetApiV1AuthoritiesIdAttachmentsArgs, options?: GetApiV1AuthoritiesIdAttachmentsOptions) => { const {baseUrl = "https://api.domain.com.au", fetch: fetchFn = fetch, apikey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "multipart/form-data") if (apikey !== undefined) headers.set("x-api-key", apikey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/authorities/${encodeURIComponent(String(args.id))}/attachments${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() };