Edits history of script submission #13644 for ' Update the amount of allocatable global outbound channels allocated to a specific managed account. (telnyx)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Telnyx = {
    	apiKey: string
    }
    /**
     * Update the amount of allocatable global outbound channels allocated to a specific managed account.
     * Update the amount of allocatable global outbound channels allocated to a specific managed account.
     */
    export async function main(auth: Telnyx, id: string, body: { channel_limit?: number }) {
    	const url = new URL(
    		`https://api.telnyx.com/v2/managed_accounts/${id}/update_global_channel_limit`
    	)
    
    	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()
    }
    

    Submitted by hugo697 428 days ago