Edits history of script submission #15526 for ' List all amendments for an EOR contract (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * List all amendments for an EOR contract
     * This endpoint retrieves all EOR contact amendments. It provides details such as the amendment type, effective date, and current status, allowing clients to understand the history and state of changes applied to the contract.
     **Token scopes**: `contracts: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}/amendments`)
    
    	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