export type CreateApiTakoV1BetaVisualizeArgs = {body: {csv: Array, query?: string | undefined, viz_component_type?: string | undefined}}; export type CreateApiTakoV1BetaVisualizeOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Turn your own data into interactive Tako Knowledge Card visualizations. Provide data as CSV strings and a natural language query describing what to visualize. Tako auto-selects the best chart type or you can specify one. Returns a knowledge card with chart image, interactive webpage, and embed URLs. Example: {"csv": ["quarter,revenue\nQ1,100\nQ2,200\nQ3,300"], "query": "Show revenue growth as a bar chart"} * * POST /tako/v1/beta/visualize */ export const createApiTakoV1BetaVisualize = async (args: CreateApiTakoV1BetaVisualizeArgs, options?: CreateApiTakoV1BetaVisualizeOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tako/v1/beta/visualize${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 undefined };