//native
/**
* Retrieve a single person
* Retrieve a single person in your organization.
**Token scopes**: `people:read`
*/
export async function main(
auth: RT.Deel,
hrisProfileOid: string,
include_custom_fields?: string | undefined,
include_worker_relations?: string | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/people/${hrisProfileOid}`)
for (const [k, v] of [
['include_custom_fields', include_custom_fields],
['include_worker_relations', include_worker_relations]
]) {
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