Edits history of script submission #15541 for ' List of tasks (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * List of tasks
     * Retrieve a list of tasks associated with a specific contract. Each task contains details such as its ID, amount, submission date, status, and description. This endpoint is useful for tracking the progress and status of tasks related to contracts.
     **Token scopes**: `contracts:read`
     */
    export async function main(auth: RT.Deel, contract_id: string) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/tasks`)
    
    	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