export type UpdateApiTimmiTimesheetServicesTimeEntriesArgs = {startsOn: string, endsOn: string, ownerId: number, body: Array<{owner: {id?: number | undefined}, startsAt: string, unit: 'day' | 'duration' | 'time', duration: {iso?: unknown | undefined}, axisSections?: (Array<{id?: number | undefined}> | null) | undefined, timeType?: ({id?: number | undefined} | null) | undefined, timeSource?: ('manual' | 'import' | 'timer') | undefined, comment?: (string | null) | undefined}>}; export type UpdateApiTimmiTimesheetServicesTimeEntriesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * TimeEntries update service * * PUT /timmi-timesheet/services/time-entries */ export const updateApiTimmiTimesheetServicesTimeEntries = async (args: UpdateApiTimmiTimesheetServicesTimeEntriesArgs, options?: UpdateApiTimmiTimesheetServicesTimeEntriesOptions) => { const {baseUrl = "https://example.ilucca.net", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.startsOn != null) query.append("startsOn", String(args.startsOn)) if (args.endsOn != null) query.append("endsOn", String(args.endsOn)) if (args.ownerId != null) query.append("ownerId", String(args.ownerId)) const url = `${baseUrl.replace(/\/+$/, '')}/timmi-timesheet/services/time-entries${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };