//native
/**
* Available Goal Sharing Options
* Provides a list of employees with whom the specified employee\'s goals may be shared.
*/
export async function main(
auth: RT.BambooHr,
employeeId: string,
search?: string | undefined,
limit?: string | undefined
) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals/shareOptions`
)
for (const [k, v] of [
['search', search],
['limit', limit]
]) {
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.json()
}
Submitted by hugo697 137 days ago