export type GetApiPrecipApiV1CloudCoverHourlyArgs = {start: string, end: string, longitude: string, latitude: string, timeZoneId?: string | undefined, format?: string | undefined}; export type GetApiPrecipApiV1CloudCoverHourlyOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Hourly cloud cover fraction (0-1, where 0 is clear and 1 is overcast) * * GET /precip/api/v1/cloud-cover-hourly */ export const getApiPrecipApiV1CloudCoverHourly = async (args: GetApiPrecipApiV1CloudCoverHourlyArgs, options?: GetApiPrecipApiV1CloudCoverHourlyOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.start != null) query.append("start", String(args.start)) if (args.end != null) query.append("end", String(args.end)) if (args.longitude != null) query.append("longitude", String(args.longitude)) if (args.latitude != null) query.append("latitude", String(args.latitude)) if (args.timeZoneId != null) query.append("timeZoneId", String(args.timeZoneId)) if (args.format != null) query.append("format", String(args.format)) const url = `${baseUrl.replace(/\/+$/, '')}/precip/api/v1/cloud-cover-hourly${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 };