azure.communication.phonenumbers.aio package

class azure.communication.phonenumbers.aio.PhoneNumbersClient(endpoint: str, credential: AsyncTokenCredential, **kwargs: Any)[source]

A client to interact with the AzureCommunicationService Phone Numbers gateway.

This client provides operations to interact with the phone numbers service :param str endpoint:

The endpoint url for Azure Communication Service resource.

Parameters

credential (AsyncTokenCredential) – The credentials with which to authenticate.

async begin_purchase_phone_numbers(search_id: str, **kwargs: Any)AsyncLROPoller[None][source]

Purchases phone numbers.

Parameters

search_id (str) – The search id.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – Pass in True if you’d like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

AsyncLROPoller[None]

async begin_release_phone_number(phone_number: str, **kwargs: Any)AsyncLROPoller[None][source]

Releases an purchased phone number.

Parameters

phone_number (str) – Phone number to be released, e.g. +11234567890.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – Pass in True if you’d like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

AsyncLROPoller[None]

async begin_search_available_phone_numbers(country_code: str, phone_number_type: str, assignment_type: str, capabilities, **kwargs)AsyncLROPoller[PhoneNumberSearchResult][source]

Search for available phone numbers to purchase.

Parameters
  • country_code (str) – The ISO 3166-2 country code, e.g. US.

  • phone_number_type (str or PhoneNumberType) – Required. The type of phone numbers to search for, e.g. geographic, or tollFree. Possible values include: “geographic”, “tollFree”.

  • assignment_type (str or PhoneNumberAssignmentType) – Required. The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. Possible values include: “user”, “application”.

  • capabilities (PhoneNumberCapabilities) – Required. Capabilities of a phone number.

Keyword Arguments
  • area_code (str) – The area code of the desired phone number, e.g. 425. If not set, any area code could be used in the final search.

  • quantity (int) – The quantity of phone numbers in the search. Default is 1.

  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – Pass in True if you’d like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

AsyncLROPoller[PhoneNumberSearchResult]

async begin_update_phone_number_capabilities(phone_number: str, sms: str = None, calling: str = None, **kwargs: Any)AsyncLROPoller[PurchasedPhoneNumber][source]

Updates the capabilities of a phone number.

Parameters
  • phone_number (str) – The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. +11234567890.

  • calling (str or PhoneNumberCapabilityType) – Capability value for calling.

  • sms (str or PhoneNumberCapabilityType) – Capability value for SMS.

Keyword Arguments
  • continuation_token (str) – A continuation token to restart a poller from a saved state.

  • polling (bool or PollingMethod) – Pass in True if you’d like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

  • polling_interval (int) – Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

AsyncLROPoller[PurchasedPhoneNumber]

async close()None[source]

Close the :class: ~azure.communication.phonenumbers.aio.PhoneNumbersClient session.

classmethod from_connection_string(conn_str: str, **kwargs: Any)PhoneNumbersClient[source]

Create PhoneNumbersClient from a Connection String. :param str conn_str:

A connection string to an Azure Communication Service resource.

Returns

Instance of PhoneNumbersClient.

Return type

PhoneNumbersClient

async get_purchased_phone_number(phone_number: str, **kwargs: Any)PurchasedPhoneNumber[source]

Gets the details of the given purchased phone number.

Parameters

phone_number (str) – The purchased phone number whose details are to be fetched in E.164 format, e.g. +11234567890.

Return type

PurchasedPhoneNumber

list_purchased_phone_numbers(**kwargs: Any)AsyncItemPaged[PurchasedPhoneNumber][source]

Gets the list of all purchased phone numbers.

Parameters
  • skip (int) – An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.

  • top (int) – An optional parameter for how many entries to return, for pagination purposes. The default value is 100.

Return type

AsyncItemPaged[PurchasedPhoneNumber]