export type TableName = string; export type TableRowUpdate = {date?: string | undefined, location?: string | undefined, division?: string | undefined, department?: string | undefined, jobTitle?: string | undefined, reportsTo?: string | undefined, teams?: Array | undefined} | {[key: string]: string | number | boolean | number | Array | {[key: string]: unknown} | null}; export type CreateApiApiV1EmployeesIdTablesTableArgs = {id: string, table: TableName, body: TableRowUpdate}; export type CreateApiApiV1EmployeesIdTablesTableOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create Table Row (v1) * * POST /api/v1/employees/{id}/tables/{table} * * Also accepts auth: oauth, oauth, oauth, oauth, oauth, oauth, oauth, oauth, oauth, oauth, oauth */ export const createApiApiV1EmployeesIdTablesTable = async (args: CreateApiApiV1EmployeesIdTablesTableArgs, options?: CreateApiApiV1EmployeesIdTablesTableOptions) => { 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") if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/employees/${encodeURIComponent(String(args.id))}/tables/${encodeURIComponent(String(args.table))}${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 };