//native
type Telnyx = {
apiKey: string
}
/**
* Request Private Wireless Gateway assignment for SIM card group
* This action will asynchronously assign a provisioned Private Wireless Gateway to the SIM card group. Completing this operation defines that all SIM cards in the SIM card group will get their traffic controlled by the associated Private Wireless Gateway. This operation will also imply that new SIM cards assigned to a group will inherit its network definitions. If it's moved to a different group that doesn't have a Private Wireless Gateway, it'll use Telnyx's default mobile network configuration.
*/
export async function main(
auth: Telnyx,
id: string,
body: { private_wireless_gateway_id: string }
) {
const url = new URL(
`https://api.telnyx.com/v2/sim_card_groups/${id}/actions/set_private_wireless_gateway`
)
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