Edits history of script submission #15538 for ' List of off-cycle payments (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * List of off-cycle payments
     * Retrieve a list of off-cycle payments for the specified contract ID. Off-cycle payments are payments made outside the regular payment schedule, often for exceptional or one-time expenses.
     **Token scopes**: `off-cycle-payments:read`
     */
    export async function main(auth: RT.Deel, contract_id: string) {
    	const url = new URL(
    		`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/off-cycle-payments`
    	)
    
    	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