Edits history of script submission #15563 for ' Request job scope validation (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Request job scope validation
     * This endpoint allows client to validate job scope description.
     **Token scopes**: `contracts:write`
     */
    export async function main(auth: RT.Deel, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/job-scopes/validate`)
    
    	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 {
    	/**
    	 * details of job scope
    	 */
    	data: {
    		/**
    		 * The ID of the team.
    		 */
    		team_id: string
    		/**
    		 * The scope of the job.
    		 */
    		job_scope: string
    		/**
    		 * The title of the job.
    		 */
    		job_title: string
    		/**
    		 * Indicates if a work visa is required.
    		 */
    		work_visa?: boolean
    		/**
    		 * Optional client name. The validation refuses a job scope if it includes the client name. If not provided, it will be inferred from the legal entity instead.
    		 */
    		client_name?: string
    		/**
    		 * The name of the employee.
    		 */
    		employee_name: string
    		/**
    		 * The ID of the special job.
    		 */
    		special_job_id?: string
    		/**
    		 * The state of employment.
    		 */
    		employment_state?: string
    		/**
    		 * The country of employment.
    		 */
    		employment_country: string
    		/**
    		 * The nationality of the employee.
    		 */
    		employee_nationality?: string
    		/**
    		 * The ID of the client's legal entity.
    		 */
    		client_legal_entity_id: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago