//native
/**
* Can Create a Goal
* Determine if the API user has permission to create a goal for this employee.
*/
export async function main(auth: RT.BambooHr, employeeId: string) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals/canCreateGoals`
)
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 51 days ago