export type TimesheetStatus = 'unsigned' | 'signed' | 'queried' | 'rejected' | 'approved' | 'paid'; export type UpdateTimesheetModel = {startedAt?: string | undefined, endedAt?: (string | null) | undefined, status?: TimesheetStatus | undefined}; export type PatchApiV1ResourcesResourceIdTimesheetsTimesheetIdArgs = {'Customer-Id': number, resourceId: number, timesheetId: number, body: UpdateTimesheetModel}; export type PatchApiV1ResourcesResourceIdTimesheetsTimesheetIdOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a resource timesheet * * PATCH /v1/resources/{resourceId}/timesheets/{timesheetId} */ export const patchApiV1ResourcesResourceIdTimesheetsTimesheetId = async (args: PatchApiV1ResourcesResourceIdTimesheetsTimesheetIdArgs, options?: PatchApiV1ResourcesResourceIdTimesheetsTimesheetIdOptions) => { const {baseUrl = "https://api.bigchange.com", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Customer-Id'] != null) headers.set("Customer-Id", String(args['Customer-Id'])) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/resources/${encodeURIComponent(String(args.resourceId))}/timesheets/${encodeURIComponent(String(args.timesheetId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };