Edits history of script submission #15577 for ' Retrieve Offboarding Request (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Retrieve Offboarding Request
     * Retrieve the offboarding request associated with a specific EOR contract (contract_id). Use it to review termination details, document review status, offboarding request data, and notifications required for the employee.
     **Token scopes**: `contracts:read`, `worker:read`
     */
    export async function main(auth: RT.Deel, contract_id: string) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/offboarding`)
    
    	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