export type GetApiV4ExportsExportIdContentsArgs = {Accept: string, exportId: string, Range: string}; export type GetApiV4ExportsExportIdContentsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the binary contents of a processed export request. * * GET /v4/exports/{exportId}/contents * * Also accepts auth: oauth2_authorization_code */ export const getApiV4ExportsExportIdContents = async (args: GetApiV4ExportsExportIdContentsArgs, options?: GetApiV4ExportsExportIdContentsOptions) => { const {baseUrl = "https://platform.climate.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args.Range != null) headers.set("Range", String(args.Range)) if (apiKey !== undefined) headers.set("X-Api-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v4/exports/${encodeURIComponent(String(args.exportId))}/contents${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 undefined };