export type GetApiV4LayersScoutingObservationsScoutingObservationIdAttachmentsAttachmentIdContentsArgs = {Accept: string, scoutingObservationId: string, attachmentId: string, Range: string}; export type GetApiV4LayersScoutingObservationsScoutingObservationIdAttachmentsAttachmentIdContentsOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve the binary contents of a scouting observation’s attachment. * * GET /v4/layers/scoutingObservations/{scoutingObservationId}/attachments/{attachmentId}/contents * * Also accepts auth: oauth2_authorization_code */ export const getApiV4LayersScoutingObservationsScoutingObservationIdAttachmentsAttachmentIdContents = async (args: GetApiV4LayersScoutingObservationsScoutingObservationIdAttachmentsAttachmentIdContentsArgs, options?: GetApiV4LayersScoutingObservationsScoutingObservationIdAttachmentsAttachmentIdContentsOptions) => { const {baseUrl = "https://platform.climate.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/jpeg") 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/scoutingObservations/${encodeURIComponent(String(args.scoutingObservationId))}/attachments/${encodeURIComponent(String(args.attachmentId))}/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() };