//native
/**
* List IT orders
* Retrieve a paginated list of all IT equipment orders for the organization. This is useful for reviewing both historical and current procurement requests to track overall equipment provisioning. For more info, visit [Orders](https://developer.deel.com/docs/deel-it-api#orders).
**Token scopes**: `it-orders:read`
*/
export async function main(auth: RT.Deel, cursor?: string | undefined, limit?: string | undefined) {
const url = new URL(`https://api.letsdeel.com/rest/v2/it/orders`)
for (const [k, v] of [
['cursor', cursor],
['limit', limit]
]) {
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