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.PhoneNumberAdministrativeDivision(*, localized_name: str, abbreviated_name: str, **kwargs: Any)[source]

Represents an administrative division. e.g. state or province.

All required parameters must be populated in order to send to Azure.

Variables
  • localized_name (str) – Represents the localized name of the administrative division of the locality. e.g. state or province localized name. Required.

  • abbreviated_name (str) – Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). Required.

Keyword Arguments
  • localized_name (str) – Represents the localized name of the administrative division of the locality. e.g. state or province localized name. Required.

  • abbreviated_name (str) – Represents the abbreviated name of the administrative division of the locality. e.g. state or province abbreviation such as WA (Washington). Required.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberAreaCode(*, area_code: Optional[str] = None, **kwargs: Any)[source]

Represents an Area Code.

Variables

area_code (str) – An area code.

Keyword Arguments

area_code (str) – An area code.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberAssignmentType(value)[source]

Represents the assignment type of the offering.

APPLICATION = 'application'
PERSON = 'person'
class azure.communication.phonenumbers.PhoneNumberCapabilities(*, calling: Union[str, _models.PhoneNumberCapabilityType], sms: Union[str, _models.PhoneNumberCapabilityType], **kwargs: Any)[source]

Capabilities of a phone number.

All required parameters must be populated in order to send to Azure.

Variables
  • calling (str or PhoneNumberCapabilityType) – Capability value for calling. Required. Known values are: “none”, “inbound”, “outbound”, and “inbound+outbound”.

  • sms (str or PhoneNumberCapabilityType) – Capability value for SMS. Required. Known values are: “none”, “inbound”, “outbound”, and “inbound+outbound”.

Keyword Arguments
  • calling (str or PhoneNumberCapabilityType) – Capability value for calling. Required. Known values are: “none”, “inbound”, “outbound”, and “inbound+outbound”.

  • sms (str or PhoneNumberCapabilityType) – Capability value for SMS. Required. Known values are: “none”, “inbound”, “outbound”, and “inbound+outbound”.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

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, _models.BillingFrequency], **kwargs: Any)[source]

The incurred cost for a single phone number.

All required parameters must be populated in order to send to Azure.

Variables
  • amount (float) – The cost amount. Required.

  • currency_code (str) – The ISO 4217 currency code for the cost amount, e.g. USD. Required.

  • billing_frequency (str or BillingFrequency) – The frequency with which the cost gets billed. Required. “monthly”

Keyword Arguments
  • amount (float) – The cost amount. Required.

  • currency_code (str) – The ISO 4217 currency code for the cost amount, e.g. USD. Required.

  • billing_frequency (str or BillingFrequency) – The frequency with which the cost gets billed. Required. “monthly”

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberCountry(*, localized_name: str, country_code: str, **kwargs: Any)[source]

Represents a country.

All required parameters must be populated in order to send to Azure.

Variables
  • localized_name (str) – Represents the name of the country. Required.

  • country_code (str) – Represents the abbreviated name of the country. Required.

Keyword Arguments
  • localized_name (str) – Represents the name of the country. Required.

  • country_code (str) – Represents the abbreviated name of the country. Required.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberLocality(*, localized_name: str, administrative_division: Optional[_models.PhoneNumberAdministrativeDivision] = None, **kwargs: Any)[source]

Represents a locality.

All required parameters must be populated in order to send to Azure.

Variables
  • localized_name (str) – Represents the localized name of the locality. Required.

  • administrative_division (PhoneNumberAdministrativeDivision) – Represents an administrative division. e.g. state or province.

Keyword Arguments
  • localized_name (str) – Represents the localized name of the locality. Required.

  • administrative_division (PhoneNumberAdministrativeDivision) – Represents an administrative division. e.g. state or province.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberOffering(*, cost: _models.PhoneNumberCost, phone_number_type: Optional[Union[str, _models.PhoneNumberType]] = None, assignment_type: Optional[Union[str, _models.PhoneNumberAssignmentType]] = None, available_capabilities: Optional[_models.PhoneNumberCapabilities] = None, **kwargs: Any)[source]

Represents a phone number capability offering.

All required parameters must be populated in order to send to Azure.

Variables
  • phone_number_type (str or PhoneNumberType) – Represents the number type of the offering. Known values are: “geographic” and “tollFree”.

  • assignment_type (str or PhoneNumberAssignmentType) – Represents the assignment type of the offering. Known values are: “person” and “application”.

  • available_capabilities (PhoneNumberCapabilities) – Capabilities of a phone number.

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

Keyword Arguments
  • phone_number_type (str or PhoneNumberType) – Represents the number type of the offering. Known values are: “geographic” and “tollFree”.

  • assignment_type (str or PhoneNumberAssignmentType) – Represents the assignment type of the offering. Known values are: “person” and “application”.

  • available_capabilities (PhoneNumberCapabilities) – Capabilities of a phone number.

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberSearchResult(*, search_id: str, phone_numbers: List[str], phone_number_type: Union[str, _models.PhoneNumberType], assignment_type: Union[str, _models.PhoneNumberAssignmentType], capabilities: _models.PhoneNumberCapabilities, cost: _models.PhoneNumberCost, search_expires_by: datetime.datetime, **kwargs: Any)[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) – The search id. Required.

  • phone_numbers (list[str]) – The phone numbers that are available. Can be fewer than the desired search quantity. Required.

  • phone_number_type (str or PhoneNumberType) – The phone number’s type, e.g. geographic, or tollFree. Required. Known values are: “geographic” and “tollFree”.

  • assignment_type (str or PhoneNumberAssignmentType) – Phone number’s assignment type. Required. Known values are: “person” and “application”.

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

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

  • search_expires_by (datetime) – 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. Required.

Keyword Arguments
  • search_id (str) – The search id. Required.

  • phone_numbers (list[str]) – The phone numbers that are available. Can be fewer than the desired search quantity. Required.

  • phone_number_type (str or PhoneNumberType) – The phone number’s type, e.g. geographic, or tollFree. Required. Known values are: “geographic” and “tollFree”.

  • assignment_type (str or PhoneNumberAssignmentType) – Phone number’s assignment type. Required. Known values are: “person” and “application”.

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

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

  • search_expires_by (datetime) – 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. Required.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

class azure.communication.phonenumbers.PhoneNumberType(value)[source]

Represents the number type of the offering.

GEOGRAPHIC = 'geographic'
TOLL_FREE = 'tollFree'
class azure.communication.phonenumbers.PhoneNumbersClient(endpoint: str, credential: Union[TokenCredential, AzureKeyCredential], accepted_language: str = 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[TokenCredential,) – 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.

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 (seconds) between two polls for LRO operations if no Retry-After header is present.

Return type

LROPoller[None]

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 (seconds) between two polls for LRO operations if no Retry-After header is present.

Return type

LROPoller[None]

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 (seconds) 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
  • phone_number (str) – The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. +55534567890.

  • 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 (seconds) 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

PhoneNumbersClient

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)ItemPaged[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

ItemPaged[PhoneNumberCountry]

Raises

HttpResponseError

list_available_localities(country_code: str, **kwargs: Any)ItemPaged[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
  • country_code (str) – The ISO 3166-2 country/region two letter code, e.g. US. Required.

  • administrative_division (str) – An optional parameter for the name of the state or province in which to search for the area code. e.g. California. 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 PhoneNumberLocality

Return type

ItemPaged[PhoneNumberLocality]

Raises

HttpResponseError

list_available_offerings(country_code: str, **kwargs)ItemPaged[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 two letter 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

ItemPaged[PhoneNumberOffering]

Raises

HttpResponseError

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

Gets the list of all purchased phone numbers.

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.

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

Return type

ItemPaged[PurchasedPhoneNumber]

class azure.communication.phonenumbers.PurchasedPhoneNumber(*, id: str, phone_number: str, country_code: str, phone_number_type: Union[str, _models.PhoneNumberType], capabilities: _models.PhoneNumberCapabilities, assignment_type: Union[str, _models.PhoneNumberAssignmentType], purchase_date: datetime.datetime, cost: _models.PhoneNumberCost, **kwargs: Any)[source]

Represents a purchased phone number.

All required parameters must be populated in order to send to Azure.

Variables
  • id (str) – The id of the phone number, e.g. 11234567890. Required.

  • phone_number (str) – String of the E.164 format of the phone number, e.g. +11234567890. Required.

  • country_code (str) – The ISO 3166-2 code of the phone number’s country, e.g. US. Required.

  • phone_number_type (str or PhoneNumberType) – The phone number’s type, e.g. geographic, tollFree. Required. Known values are: “geographic” and “tollFree”.

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

  • assignment_type (str or PhoneNumberAssignmentType) – The assignment type of the phone number. A phone number can be assigned to a person, or to an application. Required. Known values are: “person” and “application”.

  • purchase_date (datetime) – The date and time that the phone number was purchased. Required.

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

Keyword Arguments
  • id (str) – The id of the phone number, e.g. 11234567890. Required.

  • phone_number (str) – String of the E.164 format of the phone number, e.g. +11234567890. Required.

  • country_code (str) – The ISO 3166-2 code of the phone number’s country, e.g. US. Required.

  • phone_number_type (str or PhoneNumberType) – The phone number’s type, e.g. geographic, tollFree. Required. Known values are: “geographic” and “tollFree”.

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

  • assignment_type (str or PhoneNumberAssignmentType) – The assignment type of the phone number. A phone number can be assigned to a person, or to an application. Required. Known values are: “person” and “application”.

  • purchase_date (datetime) – The date and time that the phone number was purchased. Required.

  • cost (PhoneNumberCost) – The incurred cost for a single phone number. Required.

as_dict(keep_readonly: bool = True, key_transformer: Callable[[str, Dict[str, Any], Any], Any] = <function attribute_transformer>, **kwargs: Any)MutableMapping[str, Any]

Return a dict that can be JSONify using json.dump.

Advanced usage might optionally 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

dict

classmethod deserialize(data: Any, content_type: Optional[str] = None)ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()None
classmethod from_dict(data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None)ModelType

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)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()bool
serialize(keep_readonly: bool = False, **kwargs: Any)MutableMapping[str, Any]

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.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict