Edits history of script submission #15396 for ' Create a person without a contract (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Create a person without a contract
     * Create a person without a contract hired under your own entity to Deel's HRIS.
     **Token scopes**: `people:write`
     */
    export async function main(auth: RT.Deel, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/pwac`)
    
    	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: {
    		client: {
    			team: {
    				/**
    				 * The team that the person is part of
    				 */
    				id: string
    				/**
    				 * The direct manager of the person
    				 */
    				direct_manager_id?: string
    				/**
    				 * The direct reports of the person
    				 */
    				direct_reports_ids?: string[]
    				[k: string]: unknown
    			}
    			department?: {
    				/**
    				 * The department that the person is part of
    				 */
    				id: string
    				[k: string]: unknown
    			}
    			legal_entity: {
    				/**
    				 * The legal entity that the person is part of
    				 */
    				id: string
    				[k: string]: unknown
    			}
    			[k: string]: unknown
    		}
    		/**
    		 * The person that is being hired
    		 */
    		person: {
    			/**
    			 * The personal email of the person being hired
    			 */
    			email: string
    			/**
    			 * The state of the person being hired
    			 */
    			state?: string
    			/**
    			 * The country of the person being hired
    			 */
    			country?: string
    			/**
    			 * The end date of the person being hired
    			 */
    			end_date?: string
    			/**
    			 * The job title of the person being hired
    			 */
    			job_title?: string
    			/**
    			 * The last name of the person being hired
    			 */
    			last_name: string
    			/**
    			 * The seniority of the person being hired
    			 */
    			seniority?: string
    			/**
    			 * The first name of the person being hired
    			 */
    			first_name: string
    			/**
    			 * The start date of the person being hired
    			 */
    			start_date: string
    			/**
    			 * The work email of the person being hired
    			 */
    			work_email?: string
    			/**
    			 * An external identifier for the person being hired
    			 */
    			external_id?: string
    			/**
    			 * The nationality of the person being hired
    			 */
    			nationality?: string
    			/**
    			 * The preferred last name of the person being hired
    			 */
    			preferred_last_name?: string
    			/**
    			 * The preferred first name of the person being hired
    			 */
    			preferred_first_name?: string
    			[k: string]: unknown
    		}
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago