//native
/**
* Retrieve Employee Time Off Data for Offboarding
* This endpoint provides detailed time off information for an employee, including accrued, used, and scheduled days across all tracking periods. It also includes policy details, tracking configurations, and additional metadata to support the offboarding request process. The data is used to display comprehensive time off information on the offboarding request page.
**Token scopes**: `contracts:read`
*/
export async function main(auth: RT.Deel, contract_id: string, end_date?: string | undefined) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/offboarding/time-offs`
)
for (const [k, v] of [['end_date', end_date]]) {
if (v !== undefined && v !== '') {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago