0

Create Hourly Report Preset

by
Published Oct 17, 2025

Create a new hourly report preset. **Token scopes**: `timesheets:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create Hourly Report Preset
4
 * Create a new hourly report preset.
5
 **Token scopes**: `timesheets:write`
6
 */
7
export async function main(auth: RT.Deel, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/timesheets/presets`)
9

10
	const response = await fetch(url, {
11
		method: 'POST',
12
		headers: {
13
			'Content-Type': 'application/json',
14
			Authorization: 'Bearer ' + auth.apiKey
15
		},
16
		body: JSON.stringify(body)
17
	})
18
	if (!response.ok) {
19
		const text = await response.text()
20
		throw new Error(`${response.status} ${text}`)
21
	}
22
	return await response.json()
23
}
24

25
/* eslint-disable */
26
/**
27
 * This file was automatically generated by json-schema-to-typescript.
28
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
29
 * and run json-schema-to-typescript to regenerate this file.
30
 */
31

32
export interface Body {
33
	data: {
34
		/**
35
		 * Optional file attachment for the hourly report preset
36
		 */
37
		file?: string
38
		/**
39
		 * The hourly rate for this preset (must be greater than 0)
40
		 */
41
		rate?: number
42
		/**
43
		 * The title of the hourly report preset
44
		 */
45
		title?: string
46
		/**
47
		 * A detailed description of the hourly report preset's purpose and contents
48
		 */
49
		description?: string
50
		/**
51
		 * The unique identifier of the associated work statement
52
		 */
53
		work_statement_id: string
54
		/**
55
		 * The unique identifier of the root preset this report is based on
56
		 */
57
		hourly_report_root_preset_id: string
58
		[k: string]: unknown
59
	}
60
	[k: string]: unknown
61
}
62