//native
type Telnyx = {
apiKey: string
}
/**
* Creates an Upload request
* Creates a new Upload request to Microsoft teams with the included phone numbers. Only one of civic_address_id or location_id must be provided, not both. The maximum allowed phone numbers for the numbers_ids array is 1000.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
number_ids?: string[]
usage?: 'calling_user_assignment' | 'first_party_app_assignment'
additional_usages?: 'calling_user_assignment' | 'first_party_app_assignment'[]
location_id?: string
civic_address_id?: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/external_connections/${id}/uploads`)
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