export type WorkbookReportFormatType = 'Csv' | 'Excel' | 'Png'; export type GenerateWorkbookReportRequestV1 = {elementId?: (string | null) | undefined, reportFormat?: WorkbookReportFormatType | undefined, rowLimit?: (number | null) | undefined, offset?: (number | null) | undefined, parameters?: ({[key: string]: string | null} | null) | undefined}; export type CreateApiApiV1ReportsWorkbooksWorkbookIdGenerateArgs = {workbookId: string, body: GenerateWorkbookReportRequestV1}; export type CreateApiApiV1ReportsWorkbooksWorkbookIdGenerateOptions = {baseUrl: string, APIToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start a workbook report generation. Use the returned URL to check the status of the report generation. * * POST /api/v1/Reports/Workbooks/{workbookId}/Generate */ export const createApiApiV1ReportsWorkbooksWorkbookIdGenerate = async (args: CreateApiApiV1ReportsWorkbooksWorkbookIdGenerateArgs, options: CreateApiApiV1ReportsWorkbooksWorkbookIdGenerateOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIToken !== undefined) headers.set('authorization', `Bearer ${APIToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/Reports/Workbooks/${encodeURIComponent(String(args.workbookId))}/Generate${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 };