//native
/**
* Get an employee photo
* Get an employee photo
*/
export async function main(
auth: RT.BambooHr,
employeeId: string,
size: 'original' | 'large' | 'medium' | 'small' | 'xs' | 'tiny'
) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/employees/${employeeId}/photo/${size}`
)
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.json()
}
Submitted by hugo697 137 days ago