//native
/**
* Gets all updated employee IDs
* This API allows for efficient syncing of employee data. When you use this API you will provide a timestamp and the results will be limited to just the employees that have changed since the time you provided. This API operates on an employee-last-changed-timestamp, which means that a change in ANY individual field in the employee record, as well as any change to the employment status, job info, or compensation tables, will cause that employee to be returned via this API.
*/
export async function main(
auth: RT.BambooHr,
since: string | undefined,
_type?: string | undefined
) {
const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/employees/changed`)
for (const [k, v] of [
['since', since],
['type', _type]
]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago