0

Retrieve offboarding list

by
Published Oct 17, 2025

Retrieve offboarding list **Token scopes**: `contracts:read`, `people:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Retrieve offboarding list
4
 * Retrieve offboarding list
5
 **Token scopes**: `contracts:read`, `people:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	search?: string | undefined,
10
	hiring_types?: string | undefined,
11
	progress_statuses?: string | undefined,
12
	limit?: string | undefined,
13
	sort_by?: 'progressStatusWeight' | undefined,
14
	sort_order?: 'ASC' | 'DESC' | undefined,
15
	pagination?: string | undefined,
16
	include_overview?: string | undefined
17
) {
18
	const url = new URL(`https://api.letsdeel.com/rest/v2/offboarding/tracker`)
19
	for (const [k, v] of [
20
		['search', search],
21
		['hiring_types', hiring_types],
22
		['progress_statuses', progress_statuses],
23
		['limit', limit],
24
		['sort_by', sort_by],
25
		['sort_order', sort_order],
26
		['pagination', pagination],
27
		['include_overview', include_overview]
28
	]) {
29
		if (v !== undefined && v !== '') {
30
			url.searchParams.append(k, v)
31
		}
32
	}
33
	const response = await fetch(url, {
34
		method: 'GET',
35
		headers: {
36
			Authorization: 'Bearer ' + auth.apiKey
37
		},
38
		body: undefined
39
	})
40
	if (!response.ok) {
41
		const text = await response.text()
42
		throw new Error(`${response.status} ${text}`)
43
	}
44
	return await response.json()
45
}
46