Edits history of script submission #15379 for ' Create Veriff session (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Create Veriff session
     * Create Veriff session
     **Token scopes**: `screenings:write`, `worker:write`
     */
    export async function main(auth: RT.Deel, body: Body) {
    	const url = new URL(`https://api.letsdeel.com/rest/v2/veriff/session`)
    
    	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: {
    		/**
    		 * Input data for the name change KYC operation
    		 */
    		user_input?: {
    			/**
    			 * The desired last name of the user
    			 */
    			last_name: string
    			/**
    			 * The desired first name of the user
    			 */
    			first_name: string
    			/**
    			 * The desired middle name of the user
    			 */
    			middle_name?: string
    			[k: string]: unknown
    		}
    		/**
    		 * The type of KYC operation to perform
    		 */
    		operation_type:
    			| 'IDENTITY_RESUBMISSION_KYC'
    			| 'IDENTITY_VERIFICATION_KYC'
    			| 'NAME_CHANGE_KYC'
    			| 'EMAIL_CHANGE_KYC'
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago