Edits history of script submission #15597 for ' Retrieve bank account guide (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Retrieve bank account guide
     * Retrieve bank account form guide for an EOR employee. This data can be used to add a new bank account for an employee.
     **Token scopes**: `worker:read`
     */
    export async function main(auth: RT.Deel, country: string, currency: string) {
    	const url = new URL(
    		`https://api.letsdeel.com/rest/v2/eor/workers/banks-guide/country/${country}/currency/${currency}`
    	)
    
    	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