//native
/**
* Retrieve worker's actionable journeys
* Return list of ActionableJourneys for a given Worker. The concept of Actionable Journeys in the Public API corresponds directly to what is labeled as Courses in the user interface. Learn more about [Learning Management](https://www.deel.com/hr/engage/learning-management-software/)
**Token scopes**: `worker:read`
*/
export async function main(
auth: RT.Deel,
journey_ids?: string | undefined,
journey_assignment_ids?: string | undefined,
limit?: string | undefined,
cursor?: string | undefined
) {
const url = new URL(`https://api.letsdeel.com/rest/v2/engage/learning/actionable-journeys`)
for (const [k, v] of [
['journey_ids', journey_ids],
['journey_assignment_ids', journey_assignment_ids],
['limit', limit],
['cursor', cursor]
]) {
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