0

Get Hourly Report Root Presets

by
Published Oct 17, 2025

Retrieve a list of hourly report root presets. **Token scopes**: `timesheets:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Get Hourly Report Root Presets
4
 * Retrieve a list of hourly report root presets.
5
 **Token scopes**: `timesheets:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	limit?: string | undefined,
10
	order_by?: 'created_at' | undefined,
11
	order_direction?: 'ASC' | 'DESC' | undefined,
12
	work_statement_statuses?: string | undefined,
13
	cursor?: string | undefined
14
) {
15
	const url = new URL(`https://api.letsdeel.com/rest/v2/timesheets/root-presets`)
16
	for (const [k, v] of [
17
		['limit', limit],
18
		['order_by', order_by],
19
		['order_direction', order_direction],
20
		['work_statement_statuses', work_statement_statuses],
21
		['cursor', cursor]
22
	]) {
23
		if (v !== undefined && v !== '') {
24
			url.searchParams.append(k, v)
25
		}
26
	}
27
	const response = await fetch(url, {
28
		method: 'GET',
29
		headers: {
30
			Authorization: 'Bearer ' + auth.apiKey
31
		},
32
		body: undefined
33
	})
34
	if (!response.ok) {
35
		const text = await response.text()
36
		throw new Error(`${response.status} ${text}`)
37
	}
38
	return await response.json()
39
}
40