//native
/**
* List of job scope templates for EOR contracts
* Returns a list of predefined job scope templates for an EOR contract, which can be filtered by team. The list includes both predefined and custom job scope templates belonging to the user's teams.
**Token scopes**: `organizations:read`
*/
export async function main(auth: RT.Deel, team?: string | undefined) {
const url = new URL(`https://api.letsdeel.com/rest/v2/eor/job-scopes`)
for (const [k, v] of [['team', team]]) {
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