Retrieve a list of predefined time-off types that can be registered in the Deel platform.
1
//native
2
/**
3
* Retrieve Time-Off Types
4
* Retrieve a list of predefined time-off types that can be registered in the Deel platform.
5
*/
6
export async function main(auth: RT.Deel) {
7
const url = new URL(`https://api.letsdeel.com/rest/v2/lookups/time-off-types`)
8
9
const response = await fetch(url, {
10
method: 'GET',
11
headers: {
12
Authorization: 'Bearer ' + auth.apiKey
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