Edits history of script submission #14109 for ' Add/Edit Timesheet Hour Entries (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Add/Edit Timesheet Hour Entries
     * Add or edit timesheet hour entries.
     */
    export async function main(auth: RT.BambooHr, body?: Body) {
    	const url = new URL(
    		`https://${auth.companyDomain}.bamboohr.com/api/v1/time_tracking/hour_entries/store`
    	)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
    		},
    		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.
     */
    
    /**
     * Schema for timesheet hour entries request
     */
    export interface Body {
    	/**
    	 * Array of hour entries to add or update
    	 */
    	hours: {
    		/**
    		 * Unique identifier for the employee
    		 */
    		employeeId?: number
    		/**
    		 * Date for the timesheet entry. Must be in YYYY-MM-DD format
    		 */
    		date?: string
    		/**
    		 * Hours worked for this timesheet entry
    		 */
    		hours?: number
    		/**
    		 * The ID of an existing timesheet entry. This can be specified to edit an existing entry
    		 */
    		id?: number
    		/**
    		 * The ID of the project to associate with the timesheet entry
    		 */
    		projectId?: number
    		/**
    		 * The ID of the task to associate with the timesheet entry
    		 */
    		taskId?: number
    		/**
    		 * Optional note to associate with the timesheet entry
    		 */
    		note?: string
    		[k: string]: unknown
    	}[]
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago