//native
type Telnyx = {
apiKey: string
}
/**
* Updates information for a SIM Card Data Usage Notification
* Updates information for a SIM Card Data Usage Notification.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
id?: string
sim_card_id?: string
record_type?: string
threshold?: { amount?: string; unit?: 'MB' | 'GB' }
created_at?: string
updated_at?: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/sim_card_data_usage_notifications/${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()
}
Submitted by hugo697 428 days ago