//native
type Telnyx = {
apiKey: string
}
/**
* Register SIM cards
* Register the SIM cards associated with the provided registration codes to the current user's account.
If sim_card_group_id is provided, the SIM cards will be associated with that group. Otherwise, the default group for the current user will be used.
*/
export async function main(
auth: Telnyx,
body: {
sim_card_group_id?: string
tags?: string[]
registration_codes: string[]
status?: 'enabled' | 'disabled' | 'standby'
}
) {
const url = new URL(`https://api.telnyx.com/v2/actions/register/sim_cards`)
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()
}
Submitted by hugo697 428 days ago