export type CreateApiCallReportsIdArgs = {id: string, body: {name?: string | undefined, email?: string | undefined, format?: ('CSV' | 'HTML') | undefined, range?: ('TODAY' | 'YESTERDAY' | 'LAST_WEEK' | 'LAST_SEVEN_DAYS' | 'LAST_MONTH' | 'LAST_THIRTY_DAYS' | 'CUSTOM') | undefined, started_at?: unknown | undefined, ended_at?: unknown | undefined, cron_expr?: string | undefined, filter?: ({from?: ('ANY' | 'EXTENSION_OR_EXTENSION_RANGE' | 'NUMBER' | 'NUMBERS_START_WITH' | 'NUMBERS_CONTAIN' | 'INTERNAL_EXTENSIONS' | 'EXTERNAL_NUMBERS') | undefined, from_value?: string | undefined, to?: ('ANY' | 'EXTENSION_OR_EXTENSION_RANGE' | 'NUMBER' | 'NUMBERS_START_WITH' | 'NUMBERS_CONTAIN' | 'INTERNAL_EXTENSIONS' | 'EXTERNAL_NUMBERS') | undefined, to_value?: string | undefined, answer_state?: ('ANY' | 'ANSWERED' | 'NOT_ANSWERED') | undefined, duration?: ('ANY' | 'RING_DURATION' | 'TALK_DURATION') | undefined, duration_from?: number | undefined, duration_to?: number | undefined} | {extension?: ('ANY' | 'EXTENSION_OR_EXTENSION_RANGE') | undefined, extension_value?: string | undefined, type?: ('ANY' | 'INTERNAL' | 'EXTERNAL') | undefined} | {type?: ('ANY' | 'LOCAL' | 'NATIONAL' | 'INTERNATIONAL' | 'MOBILE') | undefined, groups?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {call_queues?: Array | undefined} | {enable_exclude_calls_dropped_before_seconds?: boolean | undefined, exclude_calls_dropped_before_seconds?: number | undefined, call_queues?: Array | undefined} | {ring_groups?: Array | undefined}) | undefined}}; export type CreateApiCallReportsIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update call report * * POST /call_reports/{id} */ export const createApiCallReportsId = async (args: CreateApiCallReportsIdArgs, options?: CreateApiCallReportsIdOptions) => { const {baseUrl = "https://HOSTNAME:8887/api", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/call_reports/${encodeURIComponent(String(args.id))}${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 };