//native
type Telnyx = {
apiKey: string
}
/**
* List SIM card actions
* This API lists a paginated collection of SIM card actions. It enables exploring a collection of existing asynchronous operations using specific filters.
*/
export async function main(
auth: Telnyx,
page_number_: string | undefined,
page_size_: string | undefined,
filter_sim_card_id_: string | undefined,
filter_status_: 'in-progress' | 'completed' | 'failed' | undefined,
filter_bulk_sim_card_action_id_: string | undefined,
filter_action_type_:
| 'enable'
| 'enable_standby_sim_card'
| 'disable'
| 'set_standby'
| 'remove_public_ip'
| 'set_public_ip'
| undefined
) {
const url = new URL(`https://api.telnyx.com/v2/sim_card_actions`)
for (const [k, v] of [
['page[number]', page_number_],
['page[size]', page_size_],
['filter[sim_card_id]', filter_sim_card_id_],
['filter[status]', filter_status_],
['filter[bulk_sim_card_action_id]', filter_bulk_sim_card_action_id_],
['filter[action_type]', filter_action_type_]
]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
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