//native
/**
* List gross-to-net report.
* Get a list of global payroll reports detailing gross-to-net calculations. Supports pagination through limit and offset query parameters.
**Token scopes**: `global-payroll:read`
*/
export async function main(
auth: RT.Deel,
id: string,
currency?: string | undefined,
limit?: string | undefined,
offset?: string | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/gp/reports/${id}/gross_to_net`)
for (const [k, v] of [
['currency', currency],
['limit', limit],
['offset', offset]
]) {
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