//native
/**
* List IT assets
* Retrieve a paginated list of all IT assets managed by the organization. This is useful for getting a complete overview of your equipment inventory and understanding the state of each asset. For more info, visit [Assets](https://developer.deel.com/docs/deel-it-api#assets).
**Token scopes**: `it-assets:read`
*/
export async function main(
auth: RT.Deel,
cursor?: string | undefined,
limit?: string | undefined,
hris_profile_id?: string | undefined,
location?:
| 'WITH_USER'
| 'AT_WAREHOUSE'
| 'DEEL_WAREHOUSE'
| 'ORGANIZATION_WAREHOUSE'
| 'CLEARANCE_WAREHOUSE'
| 'SUPPLIER'
| 'WITH_COURIER'
| 'WRITE_OFF'
| undefined,
category?:
| 'ADAPTER'
| 'CABLE'
| 'CHAIR'
| 'CHARGER'
| 'DESK'
| 'DESK_RISER'
| 'DESK_TIDY'
| 'DESKTOP'
| 'DOCKING_STATION'
| 'DONGLE'
| 'FOOTREST'
| 'HEADSET'
| 'KEYBOARD'
| 'LAPTOP'
| 'LAPTOP_STAND'
| 'MICE_TRACKPAD'
| 'MOBILE_DEVICE'
| 'MONITOR'
| 'MONITOR_ARM'
| 'OTHER'
| 'PRINTER'
| 'SHREDDER'
| 'STANDING_MAT'
| 'TABLET'
| 'TASK_LIGHT'
| 'WEBCAM'
| 'WIFI_RANGE_EXTENDER'
| 'WELCOME_PACK'
| undefined,
status?: 'ACTIVE' | 'ARCHIVED' | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/it/assets`)
for (const [k, v] of [
['cursor', cursor],
['limit', limit],
['hris_profile_id', hris_profile_id],
['location', location],
['category', category],
['status', status]
]) {
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