Skip to content

Commit 88fcfbe

Browse files
use CommunicationError instead of AvailablePhoneNumberError
1 parent 0bd0ff7 commit 88fcfbe

File tree

5 files changed

+11
-113
lines changed

5 files changed

+11
-113
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
OperatorInformationResult,
2626
PhoneNumbersBrowseResult,
2727
AvailablePhoneNumber,
28-
PhoneNumbersReservation,
29-
ErrorDetail
28+
PhoneNumbersReservation
3029
)
3130

3231
from ._generated.models._enums import (
@@ -56,6 +55,5 @@
5655
'PhoneNumbersBrowseResult',
5756
'AvailablePhoneNumber',
5857
'ReservationStatus',
59-
'PhoneNumberAvailabilityStatus',
60-
'ErrorDetail'
58+
'PhoneNumberAvailabilityStatus'
6159
]

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
AvailablePhoneNumberError,
1919
CommunicationError,
2020
CommunicationErrorResponse,
21-
ErrorAdditionalInfo,
22-
ErrorDetail,
23-
ErrorResponse,
2421
OperatorDetails,
2522
OperatorInformation,
2623
OperatorInformationOptions,
@@ -67,9 +64,6 @@
6764
"AvailablePhoneNumberError",
6865
"CommunicationError",
6966
"CommunicationErrorResponse",
70-
"ErrorAdditionalInfo",
71-
"ErrorDetail",
72-
"ErrorResponse",
7367
"OperatorDetails",
7468
"OperatorInformation",
7569
"OperatorInformationOptions",

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

Lines changed: 6 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ class AvailablePhoneNumber(_serialization.Model):
4848
true, the phone number cannot be acquired unless the customer provides explicit agreement to
4949
not resell it.
5050
:vartype is_agreement_to_not_resell_required: bool
51-
:ivar error: The error detail.
52-
:vartype error: ~azure.communication.phonenumbers.models.ErrorDetail
51+
:ivar error: The Communication Services error.
52+
:vartype error: ~azure.communication.phonenumbers.models.CommunicationError
5353
"""
5454

5555
_validation = {
@@ -74,7 +74,7 @@ class AvailablePhoneNumber(_serialization.Model):
7474
"cost": {"key": "cost", "type": "PhoneNumberCost"},
7575
"status": {"key": "status", "type": "str"},
7676
"is_agreement_to_not_resell_required": {"key": "isAgreementToNotResellRequired", "type": "bool"},
77-
"error": {"key": "error", "type": "ErrorDetail"},
77+
"error": {"key": "error", "type": "CommunicationError"},
7878
}
7979

8080
def __init__(
@@ -84,7 +84,7 @@ def __init__(
8484
capabilities: "_models.PhoneNumberCapabilities",
8585
phone_number_type: Union[str, "_models.PhoneNumberType"],
8686
assignment_type: Union[str, "_models.PhoneNumberAssignmentType"],
87-
error: Optional["_models.ErrorDetail"] = None,
87+
error: Optional["_models.CommunicationError"] = None,
8888
**kwargs: Any
8989
) -> None:
9090
"""
@@ -99,8 +99,8 @@ def __init__(
9999
case. Required. Known values are: "person" and "application".
100100
:paramtype assignment_type: str or
101101
~azure.communication.phonenumbers.models.PhoneNumberAssignmentType
102-
:keyword error: The error detail.
103-
:paramtype error: ~azure.communication.phonenumbers.models.ErrorDetail
102+
:keyword error: The Communication Services error.
103+
:paramtype error: ~azure.communication.phonenumbers.models.CommunicationError
104104
"""
105105
super().__init__(**kwargs)
106106
self.id: Optional[str] = None
@@ -221,98 +221,6 @@ def __init__(self, *, error: "_models.CommunicationError", **kwargs: Any) -> Non
221221
self.error = error
222222

223223

224-
class ErrorAdditionalInfo(_serialization.Model):
225-
"""The resource management error additional info.
226-
227-
Variables are only populated by the server, and will be ignored when sending a request.
228-
229-
:ivar type: The additional info type.
230-
:vartype type: str
231-
:ivar info: The additional info.
232-
:vartype info: JSON
233-
"""
234-
235-
_validation = {
236-
"type": {"readonly": True},
237-
"info": {"readonly": True},
238-
}
239-
240-
_attribute_map = {
241-
"type": {"key": "type", "type": "str"},
242-
"info": {"key": "info", "type": "object"},
243-
}
244-
245-
def __init__(self, **kwargs: Any) -> None:
246-
""" """
247-
super().__init__(**kwargs)
248-
self.type: Optional[str] = None
249-
self.info: Optional[JSON] = None
250-
251-
252-
class ErrorDetail(_serialization.Model):
253-
"""The error detail.
254-
255-
Variables are only populated by the server, and will be ignored when sending a request.
256-
257-
:ivar code: The error code.
258-
:vartype code: str
259-
:ivar message: The error message.
260-
:vartype message: str
261-
:ivar target: The error target.
262-
:vartype target: str
263-
:ivar details: The error details.
264-
:vartype details: list[~azure.communication.phonenumbers.models.ErrorDetail]
265-
:ivar additional_info: The error additional info.
266-
:vartype additional_info: list[~azure.communication.phonenumbers.models.ErrorAdditionalInfo]
267-
"""
268-
269-
_validation = {
270-
"code": {"readonly": True},
271-
"message": {"readonly": True},
272-
"target": {"readonly": True},
273-
"details": {"readonly": True},
274-
"additional_info": {"readonly": True},
275-
}
276-
277-
_attribute_map = {
278-
"code": {"key": "code", "type": "str"},
279-
"message": {"key": "message", "type": "str"},
280-
"target": {"key": "target", "type": "str"},
281-
"details": {"key": "details", "type": "[ErrorDetail]"},
282-
"additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"},
283-
}
284-
285-
def __init__(self, **kwargs: Any) -> None:
286-
""" """
287-
super().__init__(**kwargs)
288-
self.code: Optional[str] = None
289-
self.message: Optional[str] = None
290-
self.target: Optional[str] = None
291-
self.details: Optional[List["_models.ErrorDetail"]] = None
292-
self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None
293-
294-
295-
class ErrorResponse(_serialization.Model):
296-
"""Common error response for all Azure Resource Manager APIs to return error details for failed
297-
operations. (This also follows the OData error response format.).
298-
299-
:ivar error: The error object.
300-
:vartype error: ~azure.communication.phonenumbers.models.ErrorDetail
301-
"""
302-
303-
_attribute_map = {
304-
"error": {"key": "error", "type": "ErrorDetail"},
305-
}
306-
307-
def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
308-
"""
309-
:keyword error: The error object.
310-
:paramtype error: ~azure.communication.phonenumbers.models.ErrorDetail
311-
"""
312-
super().__init__(**kwargs)
313-
self.error = error
314-
315-
316224
class OfferingsResponse(_serialization.Model):
317225
"""Represents a wrapper around a list of offerings.
318226

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ class PhoneNumbersOperations: # pylint: disable=too-many-public-methods
632632

633633
models = _models
634634

635-
def __init__(self, *args, **kwargs):
635+
def __init__(self, *args, **kwargs) -> None:
636636
input_args = list(args)
637637
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
638638
self._config: PhoneNumbersClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config")

sdk/communication/azure-communication-phonenumbers/swagger/PHONE_NUMBER_SWAGGER.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ autorest ./PHONE_NUMBER_SWAGGER.md
1212
``` yaml
1313
tag: package-phonenumber-2025-04-01
1414
require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/de9cb12d2840ca0915849ce6a3bf8c956a32c022/specification/communication/data-plane/PhoneNumbers/readme.md
15-
input-file:
16-
- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/main/specification/common-types/data-plane/v1/types.json
1715
output-folder: ../azure/communication/phonenumbers/_generated
1816
namespace: azure.communication.phonenumbers
1917
license-header: MICROSOFT_MIT_NO_VERSION
@@ -57,12 +55,12 @@ directive:
5755
$["name"] = "PhoneNumberAvailabilityStatus";
5856
```
5957
60-
### Replace type from AvailablePhoneNumberError to ResponseError
58+
### Replace type from AvailablePhoneNumberError to CommunicationError
6159
```yaml
6260
directive:
6361
- from: swagger-document
6462
where: $.definitions.AvailablePhoneNumber.properties.error
6563
transform: >
6664
$.type = "object";
67-
$.$ref = "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/main/specification/common-types/data-plane/v1/types.json#/definitions/ErrorDetail";
65+
$.$ref = "../../../Common/stable/2021-03-07/common.json#/definitions/CommunicationError";
6866
```

0 commit comments

Comments
 (0)