export type AuditReportRequest = {workflowName: string, recordId?: number | undefined}; export type CreateApiApiReportsAudittrialArgs = {body: AuditReportRequest}; export type CreateApiApiReportsAudittrialOptions = {baseUrl: string, ApiKey?: string | undefined, UserKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get all audit trial details of the given workflow. * * POST /api/Reports/audittrial */ export const createApiApiReportsAudittrial = async (args: CreateApiApiReportsAudittrialArgs, options: CreateApiApiReportsAudittrialOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey, UserKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) if (UserKey !== undefined) headers.set("X-User-Key", UserKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/Reports/audittrial${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 };