Edits history of script submission #13453 for ' Request a SIM card disable (telnyx)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Telnyx = {
    	apiKey: string
    }
    /**
     * Request a SIM card disable
     * This API disables a SIM card, disconnecting it from the network and making it impossible to consume data.
    The API will trigger an asynchronous operation called a SIM Card Action. Transitioning to the disabled state may take a period of time. The status of the SIM Card Action can be followed through the [List SIM Card Action](https://developersdev.telnyx.com/docs/api/v2/wireless/SIM-Card-Actions#ListSIMCardActions) API.
    
     */
    export async function main(auth: Telnyx, id: string) {
    	const url = new URL(`https://api.telnyx.com/v2/sim_cards/${id}/actions/disable`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 428 days ago