Edits history of script submission #13586 for ' Update Brand (telnyx)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Telnyx = {
    	apiKey: string
    }
    /**
     * Update Brand
     * Update a brand's attributes by `brandId`.
     */
    export async function main(
    	auth: Telnyx,
    	brandId: string,
    	body: {
    		entityType: 'PRIVATE_PROFIT' | 'PUBLIC_PROFIT' | 'NON_PROFIT' | 'SOLE_PROPRIETOR' | 'GOVERNMENT'
    		displayName: string
    		companyName?: string
    		firstName?: string
    		lastName?: string
    		ein?: string
    		phone?: string
    		street?: string
    		city?: string
    		state?: string
    		postalCode?: string
    		country: string
    		email: string
    		stockSymbol?: string
    		stockExchange?:
    			| 'NONE'
    			| 'NASDAQ'
    			| 'NYSE'
    			| 'AMEX'
    			| 'AMX'
    			| 'ASX'
    			| 'B3'
    			| 'BME'
    			| 'BSE'
    			| 'FRA'
    			| 'ICEX'
    			| 'JPX'
    			| 'JSE'
    			| 'KRX'
    			| 'LON'
    			| 'NSE'
    			| 'OMX'
    			| 'SEHK'
    			| 'SSE'
    			| 'STO'
    			| 'SWX'
    			| 'SZSE'
    			| 'TSX'
    			| 'TWSE'
    			| 'VSE'
    		ipAddress?: string
    		website?: string
    		vertical:
    			| 'GOVERNMENT'
    			| 'REAL_ESTATE'
    			| 'HEALTHCARE'
    			| 'ENERGY'
    			| 'ENTERTAINMENT'
    			| 'RETAIL'
    			| 'AGRICULTURE'
    			| 'INSURANCE'
    			| 'EDUCATION'
    			| 'HOSPITALITY'
    			| 'FINANCIAL'
    			| 'GAMBLING'
    			| 'CONSTRUCTION'
    			| 'NGO'
    			| 'MANUFACTURING'
    			| 'TECHNOLOGY'
    			| 'COMMUNICATION'
    		altBusiness_id?: string
    		altBusinessIdType?: 'NONE' | 'DUNS' | 'GIIN' | 'LEI'
    		isReseller?: false | true
    		identityStatus?: 'VERIFIED' | 'UNVERIFIED' | 'SELF_DECLARED' | 'VETTED_VERIFIED'
    		businessContactEmail?: string
    		webhookURL?: string
    		webhookFailoverURL?: string
    	}
    ) {
    	const url = new URL(`https://api.telnyx.com/v2/brand/${brandId}`)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		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()
    }
    

    Submitted by hugo697 428 days ago