66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
9- from copy import deepcopy
109from typing import TYPE_CHECKING
1110
1211from azure .core import PipelineClient
1312from msrest import Deserializer , Serializer
1413
15- from . import models
16- from ._configuration import AzureCommunicationCallingServerServiceConfiguration
17- from .operations import CallConnectionsOperations , ServerCallsOperations
18-
1914if TYPE_CHECKING :
2015 # pylint: disable=unused-import,ungrouped-imports
2116 from typing import Any
2217
23- from azure .core .rest import HttpRequest , HttpResponse
18+ from azure .core .pipeline .transport import HttpRequest , HttpResponse
19+
20+ from ._configuration import AzureCommunicationCallingServerServiceConfiguration
21+ from .operations import CallConnectionsOperations
22+ from .operations import ServerCallsOperations
23+ from . import models
24+
2425
2526class AzureCommunicationCallingServerService (object ):
2627 """Azure Communication Service Call Automation APIs.
2728
2829 :ivar call_connections: CallConnectionsOperations operations
29- :vartype call_connections:
30- azure.communication.callingserver.operations.CallConnectionsOperations
30+ :vartype call_connections: azure.communication.callingserver.operations.CallConnectionsOperations
3131 :ivar server_calls: ServerCallsOperations operations
3232 :vartype server_calls: azure.communication.callingserver.operations.ServerCallsOperations
3333 :param endpoint: The endpoint of the Azure Communication resource.
@@ -40,48 +40,37 @@ def __init__(
4040 ** kwargs # type: Any
4141 ):
4242 # type: (...) -> None
43- _base_url = '{endpoint}'
43+ base_url = '{endpoint}'
4444 self ._config = AzureCommunicationCallingServerServiceConfiguration (endpoint , ** kwargs )
45- self ._client = PipelineClient (base_url = _base_url , config = self ._config , ** kwargs )
45+ self ._client = PipelineClient (base_url = base_url , config = self ._config , ** kwargs )
4646
4747 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
4848 self ._serialize = Serializer (client_models )
49- self ._deserialize = Deserializer (client_models )
5049 self ._serialize .client_side_validation = False
51- self .call_connections = CallConnectionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
52- self .server_calls = ServerCallsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
50+ self ._deserialize = Deserializer (client_models )
5351
52+ self .call_connections = CallConnectionsOperations (
53+ self ._client , self ._config , self ._serialize , self ._deserialize )
54+ self .server_calls = ServerCallsOperations (
55+ self ._client , self ._config , self ._serialize , self ._deserialize )
5456
55- def _send_request (
56- self ,
57- request , # type: HttpRequest
58- ** kwargs # type: Any
59- ):
60- # type: (...) -> HttpResponse
57+ def _send_request (self , http_request , ** kwargs ):
58+ # type: (HttpRequest, Any) -> HttpResponse
6159 """Runs the network request through the client's chained policies.
6260
63- >>> from azure.core.rest import HttpRequest
64- >>> request = HttpRequest("GET", "https://www.example.org/")
65- <HttpRequest [GET], url: 'https://www.example.org/'>
66- >>> response = client._send_request(request)
67- <HttpResponse: 200 OK>
68-
69- For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
70-
71- :param request: The network request you want to make. Required.
72- :type request: ~azure.core.rest.HttpRequest
73- :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
61+ :param http_request: The network request you want to make. Required.
62+ :type http_request: ~azure.core.pipeline.transport.HttpRequest
63+ :keyword bool stream: Whether the response payload will be streamed. Defaults to True.
7464 :return: The response of your network call. Does not do error handling on your response.
75- :rtype: ~azure.core.rest .HttpResponse
65+ :rtype: ~azure.core.pipeline.transport .HttpResponse
7666 """
77-
78- request_copy = deepcopy (request )
7967 path_format_arguments = {
80- " endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , 'str' , skip_quote = True ),
68+ ' endpoint' : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , 'str' , skip_quote = True ),
8169 }
82-
83- request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
84- return self ._client .send_request (request_copy , ** kwargs )
70+ http_request .url = self ._client .format_url (http_request .url , ** path_format_arguments )
71+ stream = kwargs .pop ("stream" , True )
72+ pipeline_response = self ._client ._pipeline .run (http_request , stream = stream , ** kwargs )
73+ return pipeline_response .http_response
8574
8675 def close (self ):
8776 # type: () -> None
0 commit comments