Skip to content

Commit 2b5da43

Browse files
committed
update to preview version, regenerate files with autorest
1 parent 2b3c060 commit 2b5da43

File tree

13 files changed

+70
-92
lines changed

13 files changed

+70
-92
lines changed

sdk/communication/azure-communication-phonenumbers/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.2.0 (2024-03-01)
3+
## 1.2.0b2 (2024-03-01)
44

55
### Features Added
66
- Add support for number lookup

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_api_versions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1111
V2022_01_11_PREVIEW2 = "2022-01-11-preview2"
1212
V2022_12_01 = "2022-12-01"
1313
V2023_05_01_PREVIEW = "2023-05-01-preview"
14-
V2024_03_01 = "2024-03-01"
14+
V2024_03_01_PREVIEW = "2024-03-01-preview"
1515

1616

17-
DEFAULT_VERSION = ApiVersion.V2024_03_01
17+
DEFAULT_VERSION = ApiVersion.V2024_03_01_PREVIEW

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class PhoneNumbersClient: # pylint: disable=client-accepts-api-version-keyword
2828
:param endpoint: The communication resource, for example
2929
https://resourcename.communication.azure.com. Required.
3030
:type endpoint: str
31-
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
3535
Retry-After header is present.

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class PhoneNumbersClientConfiguration: # pylint: disable=too-many-instance-attr
2222
:param endpoint: The communication resource, for example
2323
https://resourcename.communication.azure.com. Required.
2424
:type endpoint: str
25-
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
26-
default value may result in unsupported behavior.
25+
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
26+
this default value may result in unsupported behavior.
2727
:paramtype api_version: str
2828
"""
2929

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

3333
if endpoint is None:
3434
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/_serialization.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
170170
return None
171171

172172

173-
try:
174-
basestring # type: ignore
175-
unicode_str = unicode # type: ignore
176-
except NameError:
177-
basestring = str
178-
unicode_str = str
179-
180173
_LOGGER = logging.getLogger(__name__)
181174

182175
try:
@@ -545,7 +538,7 @@ class Serializer(object):
545538
"multiple": lambda x, y: x % y != 0,
546539
}
547540

548-
def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
541+
def __init__(self, classes: Optional[Mapping[str, type]] = None):
549542
self.serialize_type = {
550543
"iso-8601": Serializer.serialize_iso,
551544
"rfc-1123": Serializer.serialize_rfc,
@@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None):
561554
"[]": self.serialize_iter,
562555
"{}": self.serialize_dict,
563556
}
564-
self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {}
557+
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
565558
self.key_transformer = full_restapi_key_transformer
566559
self.client_side_validation = True
567560

@@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
649642
else: # That's a basic type
650643
# Integrate namespace if necessary
651644
local_node = _create_xml_node(xml_name, xml_prefix, xml_ns)
652-
local_node.text = unicode_str(new_attr)
645+
local_node.text = str(new_attr)
653646
serialized.append(local_node) # type: ignore
654647
else: # JSON
655648
for k in reversed(keys): # type: ignore
@@ -994,7 +987,7 @@ def serialize_object(self, attr, **kwargs):
994987
return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs)
995988
if obj_type is _long_type:
996989
return self.serialize_long(attr)
997-
if obj_type is unicode_str:
990+
if obj_type is str:
998991
return self.serialize_unicode(attr)
999992
if obj_type is datetime.datetime:
1000993
return self.serialize_iso(attr)
@@ -1370,7 +1363,7 @@ class Deserializer(object):
13701363

13711364
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}]?")
13721365

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

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

1446-
if isinstance(response, basestring):
1439+
if isinstance(response, str):
14471440
return self.deserialize_data(data, response)
14481441
elif isinstance(response, type) and issubclass(response, Enum):
14491442
return self.deserialize_enum(data, response)
@@ -1514,14 +1507,14 @@ def _classify_target(self, target, data):
15141507
if target is None:
15151508
return None, None
15161509

1517-
if isinstance(target, basestring):
1510+
if isinstance(target, str):
15181511
try:
15191512
target = self.dependencies[target]
15201513
except KeyError:
15211514
return target, target
15221515

15231516
try:
1524-
target = target._classify(data, self.dependencies)
1517+
target = target._classify(data, self.dependencies) # type: ignore
15251518
except AttributeError:
15261519
pass # Target is not a Model, no classify
15271520
return target, target.__class__.__name__ # type: ignore
@@ -1577,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None):
15771570
if hasattr(raw_data, "_content_consumed"):
15781571
return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers)
15791572

1580-
if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"):
1573+
if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"):
15811574
return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore
15821575
return raw_data
15831576

@@ -1699,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs):
16991692
if isinstance(attr, ET.Element):
17001693
# Do no recurse on XML, just return the tree as-is
17011694
return attr
1702-
if isinstance(attr, basestring):
1695+
if isinstance(attr, str):
17031696
return self.deserialize_basic(attr, "str")
17041697
obj_type = type(attr)
17051698
if obj_type in self.basic_types:
@@ -1756,7 +1749,7 @@ def deserialize_basic(self, attr, data_type):
17561749
if data_type == "bool":
17571750
if attr in [True, False, 1, 0]:
17581751
return bool(attr)
1759-
elif isinstance(attr, basestring):
1752+
elif isinstance(attr, str):
17601753
if attr.lower() in ["true", "1"]:
17611754
return True
17621755
elif attr.lower() in ["false", "0"]:

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/aio/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class PhoneNumbersClient: # pylint: disable=client-accepts-api-version-keyword
2828
:param endpoint: The communication resource, for example
2929
https://resourcename.communication.azure.com. Required.
3030
:type endpoint: str
31-
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
32-
default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
32+
this default value may result in unsupported behavior.
3333
:paramtype api_version: str
3434
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
3535
Retry-After header is present.

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class PhoneNumbersClientConfiguration: # pylint: disable=too-many-instance-attr
2222
:param endpoint: The communication resource, for example
2323
https://resourcename.communication.azure.com. Required.
2424
:type endpoint: str
25-
:keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this
26-
default value may result in unsupported behavior.
25+
:keyword api_version: Api Version. Default value is "2024-03-01-preview". Note that overriding
26+
this default value may result in unsupported behavior.
2727
:paramtype api_version: str
2828
"""
2929

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

3333
if endpoint is None:
3434
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/aio/operations/_operations.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,6 @@ async def begin_search_available_phone_numbers(
676676
:param body: The phone number search request. Is either a PhoneNumberSearchRequest type or a
677677
IO[bytes] type. Required.
678678
:type body: ~azure.communication.phonenumbers.models.PhoneNumberSearchRequest or IO[bytes]
679-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
680-
Default value is None.
681-
:paramtype content_type: str
682679
:return: An instance of AsyncLROPoller that returns PhoneNumberSearchResult
683680
:rtype:
684681
~azure.core.polling.AsyncLROPoller[~azure.communication.phonenumbers.models.PhoneNumberSearchResult]
@@ -912,9 +909,6 @@ async def begin_purchase_phone_numbers(
912909
:param body: The phone number purchase request. Is either a PhoneNumberPurchaseRequest type or
913910
a IO[bytes] type. Required.
914911
:type body: ~azure.communication.phonenumbers.models.PhoneNumberPurchaseRequest or IO[bytes]
915-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
916-
Default value is None.
917-
:paramtype content_type: str
918912
:return: An instance of AsyncLROPoller that returns None
919913
:rtype: ~azure.core.polling.AsyncLROPoller[None]
920914
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1218,9 +1212,6 @@ async def begin_update_capabilities(
12181212
PhoneNumberCapabilitiesRequest type or a IO[bytes] type. Default value is None.
12191213
:type body: ~azure.communication.phonenumbers.models.PhoneNumberCapabilitiesRequest or
12201214
IO[bytes]
1221-
:keyword content_type: Body Parameter content-type. Known values are:
1222-
'application/merge-patch+json'. Default value is None.
1223-
:paramtype content_type: str
12241215
:return: An instance of AsyncLROPoller that returns PurchasedPhoneNumber
12251216
:rtype:
12261217
~azure.core.polling.AsyncLROPoller[~azure.communication.phonenumbers.models.PurchasedPhoneNumber]
@@ -1599,9 +1590,6 @@ async def operator_information_search(
15991590
:param body: The phone number(s) whose number format and operator information should be
16001591
searched. Is either a OperatorInformationRequest type or a IO[bytes] type. Required.
16011592
:type body: ~azure.communication.phonenumbers.models.OperatorInformationRequest or IO[bytes]
1602-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1603-
Default value is None.
1604-
:paramtype content_type: str
16051593
:return: OperatorInformationResult
16061594
:rtype: ~azure.communication.phonenumbers.models.OperatorInformationResult
16071595
:raises ~azure.core.exceptions.HttpResponseError:

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/models/_enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BillingFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1919
class OperatorNumberType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
2020
"""Type of service associated with the phone number."""
2121

22-
UNAVAILABLE = "unavailable"
22+
UNKNOWN = "unknown"
2323
OTHER = "other"
2424
GEOGRAPHIC = "geographic"
2525
MOBILE = "mobile"

sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_generated/models/_models.py

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,20 @@ def __init__(
130130
class OperatorDetails(_serialization.Model):
131131
"""Represents metadata describing the operator of a phone number.
132132
133-
:ivar name: Name of the phone operator.
133+
All required parameters must be populated in order to send to server.
134+
135+
:ivar name: Name of the phone operator. Required.
134136
:vartype name: str
135137
:ivar mobile_network_code: Mobile Network Code.
136138
:vartype mobile_network_code: str
137139
:ivar mobile_country_code: Mobile Country Code.
138140
:vartype mobile_country_code: str
139141
"""
140142

143+
_validation = {
144+
"name": {"required": True},
145+
}
146+
141147
_attribute_map = {
142148
"name": {"key": "name", "type": "str"},
143149
"mobile_network_code": {"key": "mobileNetworkCode", "type": "str"},
@@ -147,13 +153,13 @@ class OperatorDetails(_serialization.Model):
147153
def __init__(
148154
self,
149155
*,
150-
name: Optional[str] = None,
156+
name: str,
151157
mobile_network_code: Optional[str] = None,
152158
mobile_country_code: Optional[str] = None,
153159
**kwargs: Any
154160
) -> None:
155161
"""
156-
:keyword name: Name of the phone operator.
162+
:keyword name: Name of the phone operator. Required.
157163
:paramtype name: str
158164
:keyword mobile_network_code: Mobile Network Code.
159165
:paramtype mobile_network_code: str
@@ -178,12 +184,12 @@ class OperatorInformation(_serialization.Model):
178184
:vartype national_format: str
179185
:ivar international_format: International format of the phone number.
180186
:vartype international_format: str
181-
:ivar number_type: Type of service associated with the phone number. Known values are:
182-
"unavailable", "other", "geographic", and "mobile".
183-
:vartype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
184187
:ivar iso_country_code: ISO 3166-1 two character ('alpha-2') code associated with the phone
185188
number.
186189
:vartype iso_country_code: str
190+
:ivar number_type: Type of service associated with the phone number. Known values are:
191+
"unknown", "other", "geographic", and "mobile".
192+
:vartype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
187193
:ivar operator_details: Represents metadata describing the operator of a phone number.
188194
:vartype operator_details: ~azure.communication.phonenumbers.models.OperatorDetails
189195
"""
@@ -196,8 +202,8 @@ class OperatorInformation(_serialization.Model):
196202
"phone_number": {"key": "phoneNumber", "type": "str"},
197203
"national_format": {"key": "nationalFormat", "type": "str"},
198204
"international_format": {"key": "internationalFormat", "type": "str"},
199-
"number_type": {"key": "numberType", "type": "str"},
200205
"iso_country_code": {"key": "isoCountryCode", "type": "str"},
206+
"number_type": {"key": "numberType", "type": "str"},
201207
"operator_details": {"key": "operatorDetails", "type": "OperatorDetails"},
202208
}
203209

@@ -207,8 +213,8 @@ def __init__(
207213
phone_number: str,
208214
national_format: Optional[str] = None,
209215
international_format: Optional[str] = None,
210-
number_type: Optional[Union[str, "_models.OperatorNumberType"]] = None,
211216
iso_country_code: Optional[str] = None,
217+
number_type: Optional[Union[str, "_models.OperatorNumberType"]] = None,
212218
operator_details: Optional["_models.OperatorDetails"] = None,
213219
**kwargs: Any
214220
) -> None:
@@ -219,21 +225,21 @@ def __init__(
219225
:paramtype national_format: str
220226
:keyword international_format: International format of the phone number.
221227
:paramtype international_format: str
222-
:keyword number_type: Type of service associated with the phone number. Known values are:
223-
"unavailable", "other", "geographic", and "mobile".
224-
:paramtype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
225228
:keyword iso_country_code: ISO 3166-1 two character ('alpha-2') code associated with the phone
226229
number.
227230
:paramtype iso_country_code: str
231+
:keyword number_type: Type of service associated with the phone number. Known values are:
232+
"unknown", "other", "geographic", and "mobile".
233+
:paramtype number_type: str or ~azure.communication.phonenumbers.models.OperatorNumberType
228234
:keyword operator_details: Represents metadata describing the operator of a phone number.
229235
:paramtype operator_details: ~azure.communication.phonenumbers.models.OperatorDetails
230236
"""
231237
super().__init__(**kwargs)
232238
self.phone_number = phone_number
233239
self.national_format = national_format
234240
self.international_format = international_format
235-
self.number_type = number_type
236241
self.iso_country_code = iso_country_code
242+
self.number_type = number_type
237243
self.operator_details = operator_details
238244

239245

@@ -264,26 +270,29 @@ def __init__(self, *, include_additional_operator_details: Optional[bool] = None
264270
class OperatorInformationRequest(_serialization.Model):
265271
"""Represents a search request for operator information for the given phone numbers.
266272
267-
:ivar phone_numbers: Phone number(s) whose operator information is being requested.
273+
All required parameters must be populated in order to send to server.
274+
275+
:ivar phone_numbers: Phone number(s) whose operator information is being requested. Required.
268276
:vartype phone_numbers: list[str]
269277
:ivar options: Represents options to modify a search request for operator information.
270278
:vartype options: ~azure.communication.phonenumbers.models.OperatorInformationOptions
271279
"""
272280

281+
_validation = {
282+
"phone_numbers": {"required": True},
283+
}
284+
273285
_attribute_map = {
274286
"phone_numbers": {"key": "phoneNumbers", "type": "[str]"},
275287
"options": {"key": "options", "type": "OperatorInformationOptions"},
276288
}
277289

278290
def __init__(
279-
self,
280-
*,
281-
phone_numbers: Optional[List[str]] = None,
282-
options: Optional["_models.OperatorInformationOptions"] = None,
283-
**kwargs: Any
291+
self, *, phone_numbers: List[str], options: Optional["_models.OperatorInformationOptions"] = None, **kwargs: Any
284292
) -> None:
285293
"""
286294
:keyword phone_numbers: Phone number(s) whose operator information is being requested.
295+
Required.
287296
:paramtype phone_numbers: list[str]
288297
:keyword options: Represents options to modify a search request for operator information.
289298
:paramtype options: ~azure.communication.phonenumbers.models.OperatorInformationOptions

0 commit comments

Comments
 (0)