//native
/**
* Retrieve categories
* Get all categories for your organization.
**Token scopes**: `adjustments:read`
*/
export async function main(auth: RT.Deel, contract_types?: string | undefined) {
const url = new URL(`https://api.letsdeel.com/rest/v2/adjustments/categories`)
for (const [k, v] of [['contract_types', contract_types]]) {
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