export type GetApiV4LayersAsAppliedActivityIdContentsArgs = {Accept: string, activityId: string, Range: string}; export type GetApiV4LayersAsAppliedActivityIdContentsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the raw application activity * * GET /v4/layers/asApplied/{activityId}/contents * * Also accepts auth: oauth2_authorization_code */ export const getApiV4LayersAsAppliedActivityIdContents = async (args: GetApiV4LayersAsAppliedActivityIdContentsArgs, options?: GetApiV4LayersAsAppliedActivityIdContentsOptions) => { const {baseUrl = "https://platform.climate.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") 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/layers/asApplied/${encodeURIComponent(String(args.activityId))}/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 res.blob() };