//native
/**
* Create Hourly Report Preset
* Create a new hourly report 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/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 {
data: {
/**
* Optional file attachment for the hourly report preset
*/
file?: string
/**
* The hourly rate for this preset (must be greater than 0)
*/
rate?: number
/**
* The title of the hourly report preset
*/
title?: string
/**
* A detailed description of the hourly report preset's purpose and contents
*/
description?: string
/**
* The unique identifier of the associated work statement
*/
work_statement_id: string
/**
* The unique identifier of the root preset this report is based on
*/
hourly_report_root_preset_id: string
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago