Edits history of script submission #15507 for ' Get the auto-withdrawal setting (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Get the auto-withdrawal setting
     * Get whether auto-withdrawal is turned on and which method is selected to withdraw to
     **Token scopes**: `worker:read`
     */
    export async function main(auth: RT.Deel) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/payouts/auto-withdrawal-setting`)
    
    	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