Edits history of script submission #15646 for ' Update Hourly Report Preset (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update Hourly Report Preset
     * Update an existing hourly report preset.
     **Token scopes**: `timesheets:write`
     */
    export async function main(auth: RT.Deel, id: string, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/timesheets/presets/${id}`)
    
    	const response = await fetch(url, {
    		method: 'PATCH',
    		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: {
    		/**
    		 * The file to be attached to this hourly report preset (optional)
    		 */
    		file?: string
    		/**
    		 * The hourly rate for this preset (must be greater than 0)
    		 */
    		rate?: number
    		/**
    		 * The title of the hourly report preset (maximum 255 characters)
    		 */
    		title?: string
    		/**
    		 * A detailed description of the hourly report preset's purpose and contents (maximum 30000 characters)
    		 */
    		description?: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago