10
10
from typing import Any
11
11
12
12
from azure .core import PipelineClient
13
+ from azure .core .pipeline import policies
13
14
from azure .core .rest import HttpRequest , HttpResponse
14
15
15
16
from . import models as _models
@@ -27,8 +28,8 @@ class PhoneNumbersClient: # pylint: disable=client-accepts-api-version-keyword
27
28
:param endpoint: The communication resource, for example
28
29
https://resourcename.communication.azure.com. Required.
29
30
:type endpoint: str
30
- :keyword api_version: Api Version. Default value is "2022-12 -01". Note that overriding this
31
- default value may result in unsupported behavior.
31
+ :keyword api_version: Api Version. Default value is "2023-10 -01-preview ". Note that overriding
32
+ this default value may result in unsupported behavior.
32
33
:paramtype api_version: str
33
34
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
34
35
Retry-After header is present.
@@ -39,7 +40,24 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
39
40
) -> None :
40
41
_endpoint = "{endpoint}"
41
42
self ._config = PhoneNumbersClientConfiguration (endpoint = endpoint , ** kwargs )
42
- self ._client = PipelineClient (base_url = _endpoint , config = self ._config , ** kwargs )
43
+ _policies = kwargs .pop ("policies" , None )
44
+ if _policies is None :
45
+ _policies = [
46
+ policies .RequestIdPolicy (** kwargs ),
47
+ self ._config .headers_policy ,
48
+ self ._config .user_agent_policy ,
49
+ self ._config .proxy_policy ,
50
+ policies .ContentDecodePolicy (** kwargs ),
51
+ self ._config .redirect_policy ,
52
+ self ._config .retry_policy ,
53
+ self ._config .authentication_policy ,
54
+ self ._config .custom_hook_policy ,
55
+ self ._config .logging_policy ,
56
+ policies .DistributedTracingPolicy (** kwargs ),
57
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
58
+ self ._config .http_logging_policy ,
59
+ ]
60
+ self ._client : PipelineClient = PipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
43
61
44
62
client_models = {k : v for k , v in _models ._models .__dict__ .items () if isinstance (v , type )}
45
63
client_models .update ({k : v for k , v in _models .__dict__ .items () if isinstance (v , type )})
@@ -48,7 +66,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
48
66
self ._serialize .client_side_validation = False
49
67
self .phone_numbers = PhoneNumbersOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
50
68
51
- def send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
69
+ def send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
52
70
"""Runs the network request through the client's chained policies.
53
71
54
72
>>> from azure.core.rest import HttpRequest
@@ -72,7 +90,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
72
90
}
73
91
74
92
request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
75
- return self ._client .send_request (request_copy , ** kwargs )
93
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
76
94
77
95
def close (self ) -> None :
78
96
self ._client .close ()
@@ -81,5 +99,5 @@ def __enter__(self) -> "PhoneNumbersClient":
81
99
self ._client .__enter__ ()
82
100
return self
83
101
84
- def __exit__ (self , * exc_details ) -> None :
102
+ def __exit__ (self , * exc_details : Any ) -> None :
85
103
self ._client .__exit__ (* exc_details )
0 commit comments