//native
/**
* Add/Edit Timesheet Clock Entries
* Add or edit timesheet clock entries.
*/
export async function main(auth: RT.BambooHr, body?: Body) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/time_tracking/clock_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.
*/
/**
* Request body schema for operations involving multiple clock entries
*/
export interface Body {
/**
* Array of clock entries
*
* @minItems 1
*/
entries: {
/**
* Unique identifier for the employee.
*/
employeeId: number
/**
* Date for the timesheet entry. Must be in YYYY-MM-DD format.
*/
date: string
/**
* Start time for the timesheet entry. Local time for the employee. Must be in hh:mm 24 hour format.
*/
start: string
/**
* End time for the timesheet entry. Local time for the employee. Must be in hh:mm 24 hour format.
*/
end: string
/**
* 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 51 days ago