Edits history of script submission #15451 for ' Edit a legal entity (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Edit a legal entity
     * Update the details of an existing legal entity.
     **Token scopes**: `legal-entity:read`, `legal-entity:write`
     */
    export async function main(auth: RT.Deel, id: string, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/legal-entities/${id}`)
    
    	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 {
    	/**
    	 * The name of the legal entity.
    	 */
    	name?: string
    	/**
    	 * The phone number of the legal entity.
    	 */
    	phone?: string
    	address?: {
    		/**
    		 * The city.
    		 */
    		city?: string
    		/**
    		 * The state.
    		 */
    		state?: string
    		/**
    		 * The street address.
    		 */
    		street?: string
    		/**
    		 * The ISO 2-letter country code.
    		 */
    		country?: string
    		[k: string]: unknown
    	}
    	/**
    	 * The SIC number of the legal entity.
    	 */
    	sic_number?: string
    	/**
    	 * The type of the legal entity.
    	 */
    	entity_type?: string
    	/**
    	 * The industry name of the legal entity.
    	 */
    	industry_name?: string
    	/**
    	 * Identifiers associated with the legal entity.
    	 */
    	company_identifiers?: {
    		/**
    		 * The tax identification number of the legal entity.
    		 */
    		tax_number?: string
    		/**
    		 * The registration number of the legal entity.
    		 */
    		registration_number?: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago