//native
/**
* Download payslip PDF
* Get a pre-signed download URL for a GP payslip PDF.
**Token scopes**: `payslips:read`
*/
export async function main(auth: RT.Deel, id: string, payslipId: string) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/gp/workers/${id}/payslips/${payslipId}/download`
)
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