//native
type Telnyx = {
apiKey: string
}
/**
* List SIM card group actions
* This API allows listing a paginated collection a SIM card group actions. It allows to explore a collection of existing asynchronous operation using specific filters.
*/
export async function main(
auth: Telnyx,
page_number_: string | undefined,
page_size_: string | undefined,
filter_sim_card_group_id_: string | undefined,
filter_status_: 'in-progress' | 'completed' | 'failed' | undefined,
filter_type_: 'set_private_wireless_gateway' | 'remove_private_wireless_gateway' | undefined
) {
const url = new URL(`https://api.telnyx.com/v2/sim_card_group_actions`)
for (const [k, v] of [
['page[number]', page_number_],
['page[size]', page_size_],
['filter[sim_card_group_id]', filter_sim_card_group_id_],
['filter[status]', filter_status_],
['filter[type]', filter_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