//native
/**
* Adds a table row
* Adds a table row. Fundamentally the same as version 1 so choose a version and stay with it unless other changes occur. Changes from version 1 are now minor with a few variations limited to ACA, payroll, terminated rehire, gusto, benetrac, and final pay date.
*/
export async function main(auth: RT.BambooHr, id: string, table: string, body: TableRowUpdate) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1_1/employees/${id}/tables/${table}`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface TableRowUpdate {
date?: string
location?: string
division?: string
department?: string
jobTitle?: string
reportsTo?: string
[k: string]: unknown
}
Submitted by hugo697 51 days ago