Delete a company file
1
//native
2
/**
3
* Delete Company File
4
* Delete a company file
5
*/
6
export async function main(auth: RT.BambooHr, fileId: string) {
7
const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/files/${fileId}`)
8
9
const response = await fetch(url, {
10
method: 'DELETE',
11
headers: {
12
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
13
},
14
body: undefined
15
})
16
if (!response.ok) {
17
const text = await response.text()
18
throw new Error(`${response.status} ${text}`)
19
}
20
return await response.json()
21
22