//native
/**
* Delete Training Type
* Delete an existing training type. The owner of the API key used must have access to training settings. Deleting a training type will only be successful if all employee trainings for this type have been removed prior to this request.
*/
export async function main(auth: RT.BambooHr, trainingTypeId: string = '0') {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/training/type/${trainingTypeId}`
)
const response = await fetch(url, {
method: 'DELETE',
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 235 days ago