export type GetApiOgcCollectionsCollectionIdInstancesInstanceIdCubeArgs = {collectionId: string, instanceId: string, bbox: Array, z?: string | undefined, 'parameter-name'?: string | undefined, crs?: string | undefined, datetime?: string | undefined, f?: string | undefined}; export type GetApiOgcCollectionsCollectionIdInstancesInstanceIdCubeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Query end point for Cube queries of instance {instanceId} of collection {collectionId} defined by a cube * * GET /ogc/collections/{collectionId}/instances/{instanceId}/cube */ export const getApiOgcCollectionsCollectionIdInstancesInstanceIdCube = async (args: GetApiOgcCollectionsCollectionIdInstancesInstanceIdCubeArgs, options: GetApiOgcCollectionsCollectionIdInstancesInstanceIdCubeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.bbox ?? []) query.append("bbox", String(item)) if (args.z != null) query.append("z", String(args.z)) if (args['parameter-name'] != null) query.append("parameter-name", String(args['parameter-name'])) if (args.crs != null) query.append("crs", String(args.crs)) if (args.datetime != null) query.append("datetime", String(args.datetime)) if (args.f != null) query.append("f", String(args.f)) const url = `${baseUrl.replace(/\/+$/, '')}/ogc/collections/${encodeURIComponent(String(args.collectionId))}/instances/${encodeURIComponent(String(args.instanceId))}/cube${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 };