//native
/**
* Retrieve contract PDF download link
* Use this endpoint to retrieve a secure URL for downloading the PDF version of a specific contract. Provide the contract_id in the path to get the download link. This link can be used by the authenticated worker to access the contract document.
**Token scopes**: `worker:read`
*/
export async function main(auth: RT.Deel, contract_id: string) {
const url = new URL(`https://api.letsdeel.com/rest/v2/workers/contracts/${contract_id}/pdf`)
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