export type CreateApiApiMetadataDictionaryPredictArgs = {sheetNum?: number | undefined, sheetName?: string | undefined, description?: string | undefined, standardizeNames?: boolean | undefined, primaryIndexCols?: Array | undefined, maxRowsToUse?: number | undefined, body: {file: string}}; export type CreateApiApiMetadataDictionaryPredictOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Allowed user roles:


uses a data file to predict a dictionary definition (uses Nostradamus * * POST /api/metadata/dictionary/predict */ export const createApiApiMetadataDictionaryPredict = async (args: CreateApiApiMetadataDictionaryPredictArgs, options?: CreateApiApiMetadataDictionaryPredictOptions) => { const {baseUrl = "https://api.burstiq.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.sheetNum != null) query.append("sheetNum", String(args.sheetNum)) if (args.sheetName != null) query.append("sheetName", String(args.sheetName)) if (args.description != null) query.append("description", String(args.description)) if (args.standardizeNames != null) query.append("standardizeNames", String(args.standardizeNames)) for (const item of args.primaryIndexCols ?? []) query.append("primaryIndexCols", String(item)) if (args.maxRowsToUse != null) query.append("maxRowsToUse", String(args.maxRowsToUse)) const url = `${baseUrl.replace(/\/+$/, '')}/api/metadata/dictionary/predict${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 res.blob() };