export type DataCollectionsSpec = {auto_persist?: boolean | undefined, compression?: ('NONE' | 'GZIP') | undefined, date_col?: string | undefined, format?: 'csv' | undefined, index_dc_subtype: string, layout_type?: ('SINGLE_FILE' | 'YEARLY_DIR_DAILY_FILE') | undefined, location: string, name: string, seed_file_path?: string | undefined, start_time?: string | undefined} | {[key: string]: unknown}; export type UpdateApiIndexUuidDataCollectionsArgs = {uuid: string, body: {data_collections?: Array | undefined}}; export type UpdateApiIndexUuidDataCollectionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * create or replace the data collection specification for this index * * PUT /index/{uuid}/data_collections */ export const updateApiIndexUuidDataCollections = async (args: UpdateApiIndexUuidDataCollectionsArgs, options?: UpdateApiIndexUuidDataCollectionsOptions) => { const {baseUrl = "https://api.merqube.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/index/${encodeURIComponent(String(args.uuid))}/data_collections${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };