Skip to content
Prev Previous commit
Next Next commit
update to preview version, regenerate files with autorest
  • Loading branch information
ericasp16 committed Feb 29, 2024
commit 2b5da436a5b23066d11c6b412c828bc106a41d2b
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.2.0 (2024-03-01)
## 1.2.0b2 (2024-03-01)

### Features Added
- Add support for number lookup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
V2022_01_11_PREVIEW2 = "2022-01-11-preview2"
V2022_12_01 = "2022-12-01"
V2023_05_01_PREVIEW = "2023-05-01-preview"
V2024_03_01 = "2024-03-01"
V2024_03_01_PREVIEW = "2024-03-01-preview"


DEFAULT_VERSION = ApiVersion.V2024_03_01
DEFAULT_VERSION = ApiVersion.V2024_03_01_PREVIEW
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class PhoneNumbersClient: # pylint: disable=client-accepts-api-version-keyword
:param endpoint: The communication resource, for example
https://resourcename.communication.azure.com. Required.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class PhoneNumbersClientConfiguration: # pylint: disable=too-many-instance-attr
:param endpoint: The communication resource, for example
https://resourcename.communication.azure.com. Required.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01")
api_version: str = kwargs.pop("api_version", "2024-03-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
return None


try:
basestring # type: ignore
unicode_str = unicode # type: ignore
except NameError:
basestring = str
unicode_str = str

_LOGGER = logging.getLogger(__name__)

try:
Expand Down Expand Up @@ -545,7 +538,7 @@ class Serializer(object):
"multiple": lambda x, y: x % y != 0,
}

def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.serialize_type = {
"iso-8601": Serializer.serialize_iso,
"rfc-1123": Serializer.serialize_rfc,
Expand All @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
"[]": self.serialize_iter,
"{}": self.serialize_dict,
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_transformer = full_restapi_key_transformer
self.client_side_validation = True

Expand Down Expand Up @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
else: # That's a basic type
# Integrate namespace if necessary
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
local_node.text = unicode_str(new_attr)
local_node.text = str(new_attr)
serialized.append(local_node) # type: ignore
else: # JSON
for k in reversed(keys): # type: ignore
Expand Down Expand Up @@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs):
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
if obj_type is _long_type:
return self.serialize_long(attr)
if obj_type is unicode_str:
if obj_type is str:
return self.serialize_unicode(attr)
if obj_type is datetime.datetime:
return self.serialize_iso(attr)
Expand Down Expand Up @@ -1370,7 +1363,7 @@ class Deserializer(object):

valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?")

def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
def __init__(self, classes: Optional[Mapping[str, type]] = None):
self.deserialize_type = {
"iso-8601": Deserializer.deserialize_iso,
"rfc-1123": Deserializer.deserialize_rfc,
Expand All @@ -1390,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
"duration": (isodate.Duration, datetime.timedelta),
"iso-8601": (datetime.datetime),
}
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
self.key_extractors = [rest_key_extractor, xml_key_extractor]
# Additional properties only works if the "rest_key_extractor" is used to
# extract the keys. Making it to work whatever the key extractor is too much
Expand Down Expand Up @@ -1443,7 +1436,7 @@ def _deserialize(self, target_obj, data):

response, class_name = self._classify_target(target_obj, data)

if isinstance(response, basestring):
if isinstance(response, str):
return self.deserialize_data(data, response)
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)
Expand Down Expand Up @@ -1514,14 +1507,14 @@ def _classify_target(self, target, data):
if target is None:
return None, None

if isinstance(target, basestring):
if isinstance(target, str):
try:
target = self.dependencies[target]
except KeyError:
return target, target

try:
target = target._classify(data, self.dependencies)
target = target._classify(data, self.dependencies) # type: ignore
except AttributeError:
pass # Target is not a Model, no classify
return target, target.__class__.__name__ # type: ignore
Expand Down Expand Up @@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None):
if hasattr(raw_data, "_content_consumed"):
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)

if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
return raw_data

Expand Down Expand Up @@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs):
if isinstance(attr, ET.Element):
# Do no recurse on XML, just return the tree as-is
return attr
if isinstance(attr, basestring):
if isinstance(attr, str):
return self.deserialize_basic(attr, "str")
obj_type = type(attr)
if obj_type in self.basic_types:
Expand Down Expand Up @@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type):
if data_type == "bool":
if attr in [True, False, 1, 0]:
return bool(attr)
elif isinstance(attr, basestring):
elif isinstance(attr, str):
if attr.lower() in ["true", "1"]:
return True
elif attr.lower() in ["false", "0"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class PhoneNumbersClient: # pylint: disable=client-accepts-api-version-keyword
:param endpoint: The communication resource, for example
https://resourcename.communication.azure.com. Required.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class PhoneNumbersClientConfiguration: # pylint: disable=too-many-instance-attr
:param endpoint: The communication resource, for example
https://resourcename.communication.azure.com. Required.
:type endpoint: str
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
default value may result in unsupported behavior.
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2024-03-01")
api_version: str = kwargs.pop("api_version", "2024-03-01-preview")

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,6 @@ async def begin_search_available_phone_numbers(
:param body: The phone number search request. Is either a PhoneNumberSearchRequest type or a
IO[bytes] type. Required.
:type body: ~azure.communication.phonenumbers.models.PhoneNumberSearchRequest or IO[bytes]
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns PhoneNumberSearchResult
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.communication.phonenumbers.models.PhoneNumberSearchResult]
Expand Down Expand Up @@ -912,9 +909,6 @@ async def begin_purchase_phone_numbers(
:param body: The phone number purchase request. Is either a PhoneNumberPurchaseRequest type or
a IO[bytes] type. Required.
:type body: ~azure.communication.phonenumbers.models.PhoneNumberPurchaseRequest or IO[bytes]
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns None
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
Expand Down Expand Up @@ -1218,9 +1212,6 @@ async def begin_update_capabilities(
PhoneNumberCapabilitiesRequest type or a IO[bytes] type. Default value is None.
:type body: ~azure.communication.phonenumbers.models.PhoneNumberCapabilitiesRequest or
IO[bytes]
:keyword content_type: Body Parameter content-type. Known values are:
'application/merge-patch+json'. Default value is None.
:paramtype content_type: str
:return: An instance of AsyncLROPoller that returns PurchasedPhoneNumber
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.communication.phonenumbers.models.PurchasedPhoneNumber]
Expand Down Expand Up @@ -1599,9 +1590,6 @@ async def operator_information_search(
:param body: The phone number(s) whose number format and operator information should be
searched. Is either a OperatorInformationRequest type or a IO[bytes] type. Required.
:type body: ~azure.communication.phonenumbers.models.OperatorInformationRequest or IO[bytes]
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:return: OperatorInformationResult
:rtype: ~azure.communication.phonenumbers.models.OperatorInformationResult
:raises ~azure.core.exceptions.HttpResponseError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BillingFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
class OperatorNumberType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of service associated with the phone number."""

UNAVAILABLE = "unavailable"
UNKNOWN = "unknown"
OTHER = "other"
GEOGRAPHIC = "geographic"
MOBILE = "mobile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,20 @@ def __init__(
class OperatorDetails(_serialization.Model):
"""Represents metadata describing the operator of a phone number.

:ivar name: Name of the phone operator.
All required parameters must be populated in order to send to server.

:ivar name: Name of the phone operator. Required.
:vartype name: str
:ivar mobile_network_code: Mobile Network Code.
:vartype mobile_network_code: str
:ivar mobile_country_code: Mobile Country Code.
:vartype mobile_country_code: str
"""

_validation = {
"name": {"required": True},
}

_attribute_map = {
"name": {"key": "name", "type": "str"},
"mobile_network_code": {"key": "mobileNetworkCode", "type": "str"},
Expand All @@ -147,13 +153,13 @@ class OperatorDetails(_serialization.Model):
def __init__(
self,
*,
name: Optional[str] = None,
name: str,
mobile_network_code: Optional[str] = None,
mobile_country_code: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the phone operator.
:keyword name: Name of the phone operator. Required.
:paramtype name: str
:keyword mobile_network_code: Mobile Network Code.
:paramtype mobile_network_code: str
Expand All @@ -178,12 +184,12 @@ class OperatorInformation(_serialization.Model):
:vartype national_format: str
:ivar international_format: International format of the phone number.
:vartype international_format: str
:ivar number_type: Type of service associated with the phone number. Known values are:
"unavailable", "other", "geographic", and "mobile".
:vartype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
:ivar iso_country_code: ISO 3166-1 two character ('alpha-2') code associated with the phone
number.
:vartype iso_country_code: str
:ivar number_type: Type of service associated with the phone number. Known values are:
"unknown", "other", "geographic", and "mobile".
:vartype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
:ivar operator_details: Represents metadata describing the operator of a phone number.
:vartype operator_details: ~azure.communication.phonenumbers.models.OperatorDetails
"""
Expand All @@ -196,8 +202,8 @@ class OperatorInformation(_serialization.Model):
"phone_number": {"key": "phoneNumber", "type": "str"},
"national_format": {"key": "nationalFormat", "type": "str"},
"international_format": {"key": "internationalFormat", "type": "str"},
"number_type": {"key": "numberType", "type": "str"},
"iso_country_code": {"key": "isoCountryCode", "type": "str"},
"number_type": {"key": "numberType", "type": "str"},
"operator_details": {"key": "operatorDetails", "type": "OperatorDetails"},
}

Expand All @@ -207,8 +213,8 @@ def __init__(
phone_number: str,
national_format: Optional[str] = None,
international_format: Optional[str] = None,
number_type: Optional[Union[str, "_models.OperatorNumberType"]] = None,
iso_country_code: Optional[str] = None,
number_type: Optional[Union[str, "_models.OperatorNumberType"]] = None,
operator_details: Optional["_models.OperatorDetails"] = None,
**kwargs: Any
) -> None:
Expand All @@ -219,21 +225,21 @@ def __init__(
:paramtype national_format: str
:keyword international_format: International format of the phone number.
:paramtype international_format: str
:keyword number_type: Type of service associated with the phone number. Known values are:
"unavailable", "other", "geographic", and "mobile".
:paramtype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
:keyword iso_country_code: ISO 3166-1 two character ('alpha-2') code associated with the phone
number.
:paramtype iso_country_code: str
:keyword number_type: Type of service associated with the phone number. Known values are:
"unknown", "other", "geographic", and "mobile".
:paramtype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
:keyword operator_details: Represents metadata describing the operator of a phone number.
:paramtype operator_details: ~azure.communication.phonenumbers.models.OperatorDetails
"""
super().__init__(**kwargs)
self.phone_number = phone_number
self.national_format = national_format
self.international_format = international_format
self.number_type = number_type
self.iso_country_code = iso_country_code
self.number_type = number_type
self.operator_details = operator_details


Expand Down Expand Up @@ -264,26 +270,29 @@ def __init__(self, *, include_additional_operator_details: Optional[bool] = None
class OperatorInformationRequest(_serialization.Model):
"""Represents a search request for operator information for the given phone numbers.

:ivar phone_numbers: Phone number(s) whose operator information is being requested.
All required parameters must be populated in order to send to server.

:ivar phone_numbers: Phone number(s) whose operator information is being requested. Required.
:vartype phone_numbers: list[str]
:ivar options: Represents options to modify a search request for operator information.
:vartype options: ~azure.communication.phonenumbers.models.OperatorInformationOptions
"""

_validation = {
"phone_numbers": {"required": True},
}

_attribute_map = {
"phone_numbers": {"key": "phoneNumbers", "type": "[str]"},
"options": {"key": "options", "type": "OperatorInformationOptions"},
}

def __init__(
self,
*,
phone_numbers: Optional[List[str]] = None,
options: Optional["_models.OperatorInformationOptions"] = None,
**kwargs: Any
self, *, phone_numbers: List[str], options: Optional["_models.OperatorInformationOptions"] = None, **kwargs: Any
) -> None:
"""
:keyword phone_numbers: Phone number(s) whose operator information is being requested.
Required.
:paramtype phone_numbers: list[str]
:keyword options: Represents options to modify a search request for operator information.
:paramtype options: ~azure.communication.phonenumbers.models.OperatorInformationOptions
Expand Down
Loading