Edits history of script submission #15644 for ' Update Employee Information for EOR Contract (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update Employee Information for EOR Contract
     * Updates employee information related to an EOR Contract. This endpoint supports partial updates. Attempting to update any undocumented fields will result in a validation error. This endpoint will only work for contracts with status `new`, `under_review`, `waiting_for_client_sign`, `waiting_for_eor_sign`, `waiting_for_employee_contract`, `waiting_for_employee_sign`, `awaiting_deposit_payment`, or `rejected`.
     **Token scopes**: `contracts:write`
     */
    export async function main(auth: RT.Deel, contract_id: string, body: Body) {
    	const url = new URL(
    		`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/employee-information`
    	)
    
    	const response = await fetch(url, {
    		method: 'PATCH',
    		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 last name of the employee.
    		 */
    		employee_last_name?: string
    		/**
    		 * The first name of the employee.
    		 */
    		employee_first_name?: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago