//native
/**
* List onboarding employees
* List all onboarding
**Token scopes**: `contracts:read`, `people:read`
*/
export async function main(
auth: RT.Deel,
search?: string | undefined,
contractOid?: string | undefined,
hiringTypes?: string | undefined,
progressStatuses?: string | undefined,
countries?: string | undefined,
teams?: string | undefined,
legalEntities?: string | undefined,
hrisDirectManagers?: string | undefined,
fromDate?: string | undefined,
toDate?: string | undefined,
actions?: string | undefined,
limit?: string | undefined,
sort_by?: 'progressStatusWeight' | undefined,
sort_order?: 'ASC' | 'DESC' | undefined,
pagination?: string | undefined,
include_overview?: string | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/onboarding/tracker`)
for (const [k, v] of [
['search', search],
['contractOid', contractOid],
['hiringTypes', hiringTypes],
['progressStatuses', progressStatuses],
['countries', countries],
['teams', teams],
['legalEntities', legalEntities],
['hrisDirectManagers', hrisDirectManagers],
['fromDate', fromDate],
['toDate', toDate],
['actions', actions],
['limit', limit],
['sort_by', sort_by],
['sort_order', sort_order],
['pagination', pagination],
['include_overview', include_overview]
]) {
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