//native
/**
* Create Hourly Report Root Preset
* Create a new hourly report root preset.
**Token scopes**: `timesheets:write`
*/
export async function main(auth: RT.Deel, body: Body) {
const url = new URL(`https://api.letsdeel.com/rest/v2/timesheets/root-presets`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
/**
* Optional file attachment for the root preset
*/
file?: string
/**
* The type of preset, RATE – indicates a preset that overrides the default contract rate, TRACKING - used exclusively for tracking, applying the default contract rate
*/
type?: 'RATE' | 'TRACKING'
/**
* The title of the hourly report root preset (maximum 255 characters)
*/
title: string
/**
* Detailed description of the root preset's purpose and usage (maximum 30000 characters)
*/
description?: string
/**
* Array of preset configurations to be created along with the root preset
*/
hourly_report_presets?: {
/**
* Optional file attachment for this specific preset instance
*/
file?: string
/**
* The hourly rate for this preset (must be greater than 0)
*/
rate?: number
/**
* The title for this specific preset instance (maximum 255 characters)
*/
title?: string
/**
* The action to perform with this preset (currently only ADD is supported)
*/
action_type?: 'ADD'
/**
* The unique identifier of the contract this preset is associated with
*/
contract_id: string
/**
* Detailed description for this specific preset instance (maximum 30000 characters)
*/
description?: string
[k: string]: unknown
}[]
/**
* Determines whether presets should be processed synchronously or asynchronously
*/
hourly_report_presets_processing_type?: 'ASYNC' | 'SYNC'
[k: string]: unknown
}
Submitted by hugo697 235 days ago