export type CreateApiTakoV1ThinVizCreateArgs = {body: {components: Array, title?: string | undefined, description?: string | undefined, source?: string | undefined}}; export type CreateApiTakoV1ThinVizCreateOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a custom embeddable knowledge card from your own data by specifying chart components directly. Returns card_id, image_url, webpage_url, and embed_url. Use List Default Schemas first to see available chart types and their required fields. Example body for a bar chart: {"components": [{"component_type": "header", "config": {"title": "Sales by Region"}}, {"component_type": "categorical_bar", "config": {"datasets": [{"label": "Revenue", "data": [{"x": "US", "y": 500}, {"x": "EU", "y": 300}]}]}}], "title": "Sales by Region", "source": "Internal Data"} * * POST /tako/v1/thin_viz/create/ */ export const createApiTakoV1ThinVizCreate = async (args: CreateApiTakoV1ThinVizCreateArgs, options?: CreateApiTakoV1ThinVizCreateOptions) => { 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/thin_viz/create/${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 };