export type OptionsApiDataPackagesDataPackageIdArgs = {data_package_id: string}; export type OptionsApiDataPackagesDataPackageIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * OPTIONS /data-packages/{data_package_id} */ export const optionsApiDataPackagesDataPackageId = async (args: OptionsApiDataPackagesDataPackageIdArgs, options?: OptionsApiDataPackagesDataPackageIdOptions) => { const {baseUrl = "https://aggregator.smartcumulus.org", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("x-api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/data-packages/${encodeURIComponent(String(args.data_package_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "OPTIONS", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };