Edits history of script submission #15403 for ' Create an EOR contract amendment (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Create an EOR contract amendment
     * This endpoint allows you to create a new amendment for a EOR contract. Amendments may include changes to salary, currency, effective date, or other contract terms, and all requests are validated against business and regulatory rules.
     **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}/amendments`)
    
    	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?: {
    		/**
    		 * Scope of the amendment.
    		 */
    		scope?: string
    		/**
    		 * An optional array of custom objects.
    		 */
    		custom?: {
    			/**
    			 * An optional identifier for the custom object.
    			 */
    			id?: string
    			/**
    			 * The type of the custom object. Must be one of the valid custom types.
    			 */
    			type: string
    			/**
    			 * A required description for the custom object.
    			 */
    			description: string
    			[k: string]: unknown
    		}[]
    		/**
    		 * Salary for the amendment.
    		 */
    		salary?: number
    		/**
    		 * End date of the employment.
    		 */
    		end_date?: string
    		/**
    		 * Number of holidays.
    		 */
    		holidays?: number
    		/**
    		 * Job title associated with the amendment.
    		 */
    		job_title?: string
    		/**
    		 * Start date of the employment.
    		 */
    		start_date?: string
    		/**
    		 * Hourly rate of the amendment. The max value supported is 1e19
    		 */
    		hourly_rate?: number
    		/**
    		 * Seniority level identifier.
    		 */
    		seniority_id?: number
    		/**
    		 * Type of time off.
    		 */
    		time_off_type?: 'STANDARD' | 'SPECIFIC' | 'PRORATED'
    		/**
    		 * Effective date for the amendment.
    		 */
    		effective_date?: string
    		/**
    		 * The seniority date represents the employee’s original start date with a previous employer. It is used to preserve employment tenure when the employee transfers to this company. Can be null if not applicable.
    		 */
    		seniority_date?: string
    		/**
    		 * Additional metadata related to job validation and categorisation
    		 */
    		additional_info?: {
    			/**
    			 * Identifier or flag for AI scope validation check
    			 */
    			ai_scope_check_public_id?: string | boolean
    			/**
    			 * Identifier for job categorisation log
    			 */
    			job_categorization_log_id?: string
    			[k: string]: unknown
    		}
    		/**
    		 * Type of employment.
    		 */
    		employment_type?: 'FULL_TIME' | 'PART_TIME'
    		/**
    		 * State of employment.
    		 */
    		employment_state?: string
    		/**
    		 * Duration of the probation period.
    		 */
    		probation_period?: number
    		/**
    		 * Type of notice period.
    		 */
    		notice_period_type?: 'STANDARD' | 'CUSTOM'
    		/**
    		 * Number of work hours per week.
    		 */
    		work_hours_per_week?: number
    		/**
    		 * Notice period after probation.
    		 */
    		notice_period_after_probation?: number
    		/**
    		 * Notice period during probation.
    		 */
    		notice_period_during_probation?: number
    		/**
    		 * Type of probation period for definite contracts.
    		 */
    		probation_period_type_for_definite?: 'STANDARD' | 'CUSTOM'
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago