//native
/**
* Fetch EOR contract document
* Returns the document as a PDF
**Token scopes**: `contracts:read`
*/
export async function main(auth: RT.Deel, contract_id: string, _type: 'FRAMEWORK_AGREEMENT') {
const url = new URL(
`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/documents/${_type}`
)
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.text()
}
Submitted by hugo697 235 days ago