azure.communication.phonenumbers.aio package¶
-
class
azure.communication.phonenumbers.aio.
PhoneNumbersClient
(endpoint: str, credential: AsyncTokenCredential, accepted_language=None, **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
AzureKeyCredential] credential (Union[AsyncTokenCredential,) – The credential we use to authenticate against the service.
- Keyword Arguments
api_version (str) – Azure Communication Phone Number API version. The default value is “2022-01-11-preview2”. Note that overriding this default value may result in unsupported behavior.
-
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 (seconds) between two polls for LRO operations if no Retry-After header is present.
- Return type
-
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 (seconds) between two polls for LRO operations if no Retry-After header is present.
- Return type
-
async
begin_search_available_phone_numbers
(country_code: str, phone_number_type: str, assignment_type: str, capabilities: PhoneNumberCapabilities, **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 (seconds) 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
- 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 (seconds) 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
-
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_available_area_codes
(country_code: str, phone_number_type: PhoneNumberType, assignment_type: PhoneNumberAssignmentType = None, locality: str = None, **kwargs: Any) → ItemPaged[PhoneNumberAreaCode][source]¶ Gets the list of available area codes.
- Parameters
country_code (str) – The ISO 3166-2 country/region two letter code, e.g. US. Required.
phone_number_type – Filter by phone number type, e.g. Geographic, TollFree. Known values are:
“geographic” and “tollFree”. Required. :type phone_number_type: ~azure.communication.phonenumbers.models.PhoneNumberType :param assignment_type: Filter by assignmentType, e.g. User, Application. Known values are: “person” and “application”. Default value is None. :type assignment_type: ~azure.communication.phonenumbers.models.PhoneNumberAssignmentType :param locality: The name of locality in which to search for the area code. e.g. Seattle. This is required if the phone number type is Geographic. Default value is None. :type locality: str :keyword administrative_division: The name of the state or province in which to search for the area code. e.g. California. Default value is None. :type administrative_division: str :keyword skip: An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. Default value is 0. :paramtype skip: int :return: An iterator like instance of PhoneNumberAreaCode :rtype: ~azure.core.paging.ItemPaged[~azure.communication.phonenumbers.models.PhoneNumberAreaCode] :raises ~azure.core.exceptions.HttpResponseError:
-
list_available_countries
(**kwargs: Any) → AsyncItemPaged[PhoneNumberCountry][source]¶ Gets the list of supported countries.
Gets the list of supported countries.
- Keyword Arguments
skip (int) – An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. Default value is 0.
- Returns
An iterator like instance of PhoneNumberCountry
- Return type
AsyncItemPaged[PhoneNumberCountry]
- Raises
-
list_available_localities
(country_code: str, **kwargs: Any) → AsyncItemPaged[PhoneNumberLocality][source]¶ Gets the list of cities or towns with available phone numbers.
Gets the list of cities or towns with available phone numbers.
- Parameters
- Keyword Arguments
skip (int) – An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. Default value is 0.
- Returns
An iterator like instance of PhoneNumberLocality
- Return type
AsyncItemPaged[PhoneNumberLocality]
- Raises
-
list_available_offerings
(country_code: str, **kwargs) → AsyncItemPaged[PhoneNumberOffering][source]¶ List available offerings of capabilities with rates for the given country/region.
List available offerings of capabilities with rates for the given country/region.
- Parameters
country_code (str) – The ISO 3166-2 country/region code, e.g. US. Required.
phone_number_type (PhoneNumberType) – Filter by phoneNumberType, e.g. Geographic, TollFree. Known values are: “geographic” and “tollFree”. Default value is None.
assignment_type (PhoneNumberAssignmentType) – Filter by assignmentType, e.g. User, Application. Known values are: “person” and “application”. Default value is None.
- Keyword Arguments
skip (int) – An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. Default value is 0.
- Returns
An iterator like instance of PhoneNumberOffering
- Return type
AsyncItemPaged[PhoneNumberOffering]
- Raises
-
list_purchased_phone_numbers
(**kwargs: Any) → AsyncItemPaged[PurchasedPhoneNumber][source]¶ Gets the list of all purchased phone numbers.
Gets the list of all purchased phone numbers.
- Keyword Arguments
- Returns
An iterator like instance of PurchasedPhoneNumber
- Return type
AsyncItemPaged[PurchasedPhoneNumber]
- Raises