export type AdjustTimeOffBalance = {date: string, timeOffTypeId: number, amount: number, note?: string | undefined}; export type UpdateApiApiV1EmployeesEmployeeIdTimeOffBalanceAdjustmentArgs = {employeeId: number, body: AdjustTimeOffBalance}; export type UpdateApiApiV1EmployeesEmployeeIdTimeOffBalanceAdjustmentOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Adjust Time Off Balance * * PUT /api/v1/employees/{employeeId}/time_off/balance_adjustment * * Also accepts auth: oauth */ export const updateApiApiV1EmployeesEmployeeIdTimeOffBalanceAdjustment = async (args: UpdateApiApiV1EmployeesEmployeeIdTimeOffBalanceAdjustmentArgs, options?: UpdateApiApiV1EmployeesEmployeeIdTimeOffBalanceAdjustmentOptions) => { const {baseUrl = "https://companySubDomain.bamboohr.com", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/employees/${encodeURIComponent(String(args.employeeId))}/time_off/balance_adjustment${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 (await res.json()) as unknown };