//native
/**
* Add a Time Off Request
* A time off request is an entity that describes the decision making process for approving time off. Once a request has been created, a history entry can be created documenting the actual use of time off.
*/
export async function main(auth: RT.BambooHr, employeeId: string, body: AddTimeOffRequest) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/employees/${employeeId}/time_off/request`
)
const response = await fetch(url, {
method: 'PUT',
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.
*/
export interface AddTimeOffRequest {
status?: string
start?: string
end?: string
timeOffTypeId?: number
amount?: number
notes?: {
from?: string
note?: string
[k: string]: unknown
}[]
dates?: {
ymd?: string
amount?: number
[k: string]: unknown
}[]
[k: string]: unknown
}
Submitted by hugo697 51 days ago