azure.communication.phonenumbers package¶
-
class
azure.communication.phonenumbers.
BillingFrequency
(value)[source]¶ The frequency with which the cost gets billed.
-
MONTHLY
= 'monthly'¶
-
-
class
azure.communication.phonenumbers.
PhoneNumberAssignmentType
(value)[source]¶ The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application.
-
APPLICATION
= 'application'¶
-
PERSON
= 'person'¶
-
-
class
azure.communication.phonenumbers.
PhoneNumberCapabilities
(*, calling: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberCapabilityType], sms: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberCapabilityType], **kwargs)[source]¶ Capabilities of a phone number.
All required parameters must be populated in order to send to Azure.
- Variables
calling (str or PhoneNumberCapabilityType) – Required. Capability value for calling. Possible values include: “none”, “inbound”, “outbound”, “inbound+outbound”.
sms (str or PhoneNumberCapabilityType) – Required. Capability value for SMS. Possible values include: “none”, “inbound”, “outbound”, “inbound+outbound”.
- Keyword Arguments
calling (str or PhoneNumberCapabilityType) – Required. Capability value for calling. Possible values include: “none”, “inbound”, “outbound”, “inbound+outbound”.
sms (str or PhoneNumberCapabilityType) – Required. Capability value for SMS. Possible values include: “none”, “inbound”, “outbound”, “inbound+outbound”.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.communication.phonenumbers.
PhoneNumberCapabilityType
(value)[source]¶ Capability value for calling.
-
INBOUND
= 'inbound'¶
-
INBOUND_OUTBOUND
= 'inbound+outbound'¶
-
NONE
= 'none'¶
-
OUTBOUND
= 'outbound'¶
-
-
class
azure.communication.phonenumbers.
PhoneNumberCost
(*, amount: float, currency_code: str, billing_frequency: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.BillingFrequency], **kwargs)[source]¶ The incurred cost for a single phone number.
All required parameters must be populated in order to send to Azure.
- Variables
- Keyword Arguments
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.communication.phonenumbers.
PhoneNumberSearchResult
(*, search_id: str, phone_numbers: List[str], phone_number_type: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberType], assignment_type: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberAssignmentType], capabilities: azure.communication.phonenumbers._generated.models._models_py3.PhoneNumberCapabilities, cost: azure.communication.phonenumbers._generated.models._models_py3.PhoneNumberCost, search_expires_by: datetime.datetime, **kwargs)[source]¶ The result of a phone number search operation.
All required parameters must be populated in order to send to Azure.
- Variables
search_id (str) – Required. The search id.
phone_numbers (list[str]) – Required. The phone numbers that are available. Can be fewer than the desired search quantity.
phone_number_type (str or PhoneNumberType) – Required. The phone number’s type, e.g. geographic, or tollFree. Possible values include: “geographic”, “tollFree”.
assignment_type (str or PhoneNumberAssignmentType) – Required. Phone number’s assignment type. Possible values include: “person”, “application”.
capabilities (PhoneNumberCapabilities) – Required. Capabilities of a phone number.
cost (PhoneNumberCost) – Required. The incurred cost for a single phone number.
search_expires_by (datetime) – Required. The date that this search result expires and phone numbers are no longer on hold. A search result expires in less than 15min, e.g. 2020-11-19T16:31:49.048Z.
- Keyword Arguments
search_id (str) – Required. The search id.
phone_numbers (list[str]) – Required. The phone numbers that are available. Can be fewer than the desired search quantity.
phone_number_type (str or PhoneNumberType) – Required. The phone number’s type, e.g. geographic, or tollFree. Possible values include: “geographic”, “tollFree”.
assignment_type (str or PhoneNumberAssignmentType) – Required. Phone number’s assignment type. Possible values include: “person”, “application”.
capabilities (PhoneNumberCapabilities) – Required. Capabilities of a phone number.
cost (PhoneNumberCost) – Required. The incurred cost for a single phone number.
search_expires_by (datetime) – Required. The date that this search result expires and phone numbers are no longer on hold. A search result expires in less than 15min, e.g. 2020-11-19T16:31:49.048Z.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.communication.phonenumbers.
PhoneNumberType
(value)[source]¶ The type of phone numbers to search for, e.g. geographic, or tollFree.
-
GEOGRAPHIC
= 'geographic'¶
-
TOLL_FREE
= 'tollFree'¶
-
-
class
azure.communication.phonenumbers.
PhoneNumbersClient
(endpoint: str, credential: TokenCredential, **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 (TokenCredential) – The credentials with which to authenticate.
-
begin_purchase_phone_numbers
(search_id: str, **kwargs: Any) → LROPoller[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
-
begin_release_phone_number
(phone_number: str, **kwargs: Any) → LROPoller[None][source]¶ Releases an purchased phone number.
- Parameters
phone_number (str) – Phone number to be released, e.g. +55534567890.
- 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
-
begin_search_available_phone_numbers
(country_code: str, phone_number_type: str, assignment_type: str, capabilities: PhoneNumberCapabilities, **kwargs: Any) → LROPoller[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
LROPoller[PhoneNumberSearchResult]
-
begin_update_phone_number_capabilities
(phone_number: str, sms: str or PhoneNumberCapabilityType = None, calling: str or PhoneNumberCapabilityType = None, **kwargs: Any) → LROPoller[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 between two polls for LRO operations if no Retry-After header is present.
- Return type
LROPoller[PurchasedPhoneNumber]
-
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
-
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) → ItemPaged[PurchasedPhoneNumber][source]¶ Gets the list of all purchased phone numbers.
-
class
azure.communication.phonenumbers.
PurchasedPhoneNumber
(*, id: str, phone_number: str, country_code: str, phone_number_type: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberType], capabilities: azure.communication.phonenumbers._generated.models._models_py3.PhoneNumberCapabilities, assignment_type: Union[str, azure.communication.phonenumbers._generated.models._phone_numbers_client_enums.PhoneNumberAssignmentType], purchase_date: datetime.datetime, cost: azure.communication.phonenumbers._generated.models._models_py3.PhoneNumberCost, **kwargs)[source]¶ Represents a purchased phone number.
All required parameters must be populated in order to send to Azure.
- Variables
id (str) – Required. The id of the phone number, e.g. 11234567890.
phone_number (str) – Required. String of the E.164 format of the phone number, e.g. +11234567890.
country_code (str) – Required. The ISO 3166-2 code of the phone number’s country, e.g. US.
phone_number_type (str or PhoneNumberType) – Required. The phone number’s type, e.g. Geographic, TollFree. Possible values include: “geographic”, “tollFree”.
capabilities (PhoneNumberCapabilities) – Required. Capabilities of a phone number.
assignment_type (str or PhoneNumberAssignmentType) – Required. The assignment type of the phone number. A phone number can be assigned to a person, or to an application. Possible values include: “person”, “application”.
purchase_date (datetime) – Required. The date and time that the phone number was purchased.
cost (PhoneNumberCost) – Required. The incurred cost for a single phone number.
- Keyword Arguments
id (str) – Required. The id of the phone number, e.g. 11234567890.
phone_number (str) – Required. String of the E.164 format of the phone number, e.g. +11234567890.
country_code (str) – Required. The ISO 3166-2 code of the phone number’s country, e.g. US.
phone_number_type (str or PhoneNumberType) – Required. The phone number’s type, e.g. Geographic, TollFree. Possible values include: “geographic”, “tollFree”.
capabilities (PhoneNumberCapabilities) – Required. Capabilities of a phone number.
assignment_type (str or PhoneNumberAssignmentType) – Required. The assignment type of the phone number. A phone number can be assigned to a person, or to an application. Possible values include: “person”, “application”.
purchase_date (datetime) – Required. The date and time that the phone number was purchased.
cost (PhoneNumberCost) – Required. The incurred cost for a single phone number.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.