Edits history of script submission #15364 for ' Calculate Employee Costs Globally (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Calculate Employee Costs Globally
     * Determine the total employment costs for an Employee of Record (EOR) arrangement across different countries, including salary, employer costs, benefits, and additional fees.
     */
    export async function main(auth: RT.Deel, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/employment_cost`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    export interface Body {
    	data?: {
    		/**
    		 * The state or region within the country, if applicable.
    		 */
    		state?: string
    		/**
    		 * The base salary for the employee.
    		 */
    		salary: number
    		/**
    		 * The country where the employee is based.
    		 */
    		country: string
    		/**
    		 * A list of selected benefit plans for the employee.
    		 */
    		benefits?: {
    			/**
    			 * The ID of the benefits plan, if applicable.
    			 */
    			plan_id?: string
    			/**
    			 * The ID of the benefits provider.
    			 */
    			provider_id: string
    			[k: string]: unknown
    		}[]
    		/**
    		 * The currency in which the costs are calculated.
    		 */
    		currency: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago