//native
/**
* Get Time Off Types
* This endpoint gets a list of time off types.
*/
export async function main(
auth: RT.BambooHr,
mode?: string | undefined,
AcceptHeaderParameter?: string
) {
const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/meta/time_off/types`)
for (const [k, v] of [['mode', mode]]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
...(AcceptHeaderParameter ? { AcceptHeaderParameter: AcceptHeaderParameter } : {}),
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.json()
}
Submitted by hugo697 235 days ago