Edits history of script submission #15358 for ' Amend contract (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Amend contract
     * Amend the details of a contract. Please note that if the contract is already signed or active, then the update will have to be approved and re-signed for to take effect.
     **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/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 {
    	/**
    	 * You can specify any combination of data points that need changing.
    	 */
    	data: {
    		/**
    		 * Defines the scale at which the amount is paid. For example, enter 'hourly' to define the amount per hour. This field can be excluded when creating a Pay-as-you-go task-based or Milestone contracts.
    		 */
    		scale?: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'biweekly' | 'semimonthly' | 'custom'
    		/**
    		 * Amount to be paid per scale.
    		 */
    		amount?: number
    		/**
    		 * Day of the month when the cycle ends.
    		 */
    		cycle_end?: number
    		/**
    		 * Scale of the invoice cycle.
    		 */
    		frequency?: 'weekly' | 'monthly' | 'biweekly' | 'semimonthly' | 'calendar-month'
    		job_title_id?: string | number
    		seniority_id?: string | number
    		/**
    		 * Currency code in ISO 4217 format.
    		 */
    		currency_code?: string
    		/**
    		 * Amount to be paid as the first payment.
    		 */
    		first_payment?: number
    		/**
    		 * Text to describe the scope of work of the contract.
    		 */
    		scope_of_work?: string
    		/**
    		 * Cycle end can be weekly 1-7 (Monday = 1) or monthly 1-31.
    		 */
    		cycle_end_type?: 'DAY_OF_WEEK' | 'DAY_OF_LAST_WEEK' | 'DAY_OF_MONTH'
    		/**
    		 * Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    		 */
    		effective_date?: string
    		/**
    		 * You can enter new job title.
    		 */
    		job_title_name?: string
    		/**
    		 * Text to describe any special clause in contract.
    		 */
    		special_clause?: string
    		/**
    		 * Number of days after the invoice is sent that the payment is due.
    		 */
    		payment_due_days?: number
    		/**
    		 * Type of payment due. If the payment is due on the last day of month, enter 'WITHIN_MONTH'.
    		 */
    		payment_due_type?: 'REGULAR' | 'WITHIN_MONTH'
    		/**
    		 * Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
    		 */
    		first_payment_date?: string
    		/**
    		 * If the payment due is on a weekend, pay on Friday.
    		 */
    		pay_before_weekends?: boolean
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago