export type GetApiIndexUuidDataCollectionsRawArgs = {uuid: string, name: string}; export type GetApiIndexUuidDataCollectionsRawOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a presigned raw file redirect for s3 * * GET /index/{uuid}/data_collections/raw */ export const getApiIndexUuidDataCollectionsRaw = async (args: GetApiIndexUuidDataCollectionsRawArgs, options?: GetApiIndexUuidDataCollectionsRawOptions) => { const {baseUrl = "https://api.merqube.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.name != null) query.append("name", String(args.name)) const url = `${baseUrl.replace(/\/+$/, '')}/index/${encodeURIComponent(String(args.uuid))}/data_collections/raw${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 };