Skip to content

Commit

Permalink
Sync with the lastest swagger.
Browse files Browse the repository at this point in the history
  • Loading branch information
zihzhan-msft committed Sep 27, 2021
1 parent d6455f2 commit 720ef1b
Show file tree
Hide file tree
Showing 11 changed files with 3,967 additions and 4,622 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import TYPE_CHECKING

from azure.core import PipelineClient
from msrest import Deserializer, Serializer

from . import models
from ._configuration import AzureCommunicationCallingServerServiceConfiguration
from .operations import CallConnectionsOperations, ServerCallsOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.rest import HttpRequest, HttpResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import AzureCommunicationCallingServerServiceConfiguration
from .operations import CallConnectionsOperations
from .operations import ServerCallsOperations
from . import models


class AzureCommunicationCallingServerService(object):
"""Azure Communication Service Call Automation APIs.
:ivar call_connections: CallConnectionsOperations operations
:vartype call_connections:
azure.communication.callingserver.operations.CallConnectionsOperations
:vartype call_connections: azure.communication.callingserver.operations.CallConnectionsOperations
:ivar server_calls: ServerCallsOperations operations
:vartype server_calls: azure.communication.callingserver.operations.ServerCallsOperations
:param endpoint: The endpoint of the Azure Communication resource.
Expand All @@ -40,48 +40,37 @@ def __init__(
**kwargs # type: Any
):
# type: (...) -> None
_base_url = '{endpoint}'
base_url = '{endpoint}'
self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint, **kwargs)
self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs)
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.call_connections = CallConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.server_calls = ServerCallsOperations(self._client, self._config, self._serialize, self._deserialize)
self._deserialize = Deserializer(client_models)

self.call_connections = CallConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.server_calls = ServerCallsOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(
self,
request, # type: HttpRequest
**kwargs # type: Any
):
# type: (...) -> HttpResponse
def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, **kwargs)
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Awaitable
from typing import Any

from azure.core import AsyncPipelineClient
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from msrest import Deserializer, Serializer

from .. import models
from ._configuration import AzureCommunicationCallingServerServiceConfiguration
from .operations import CallConnectionsOperations, ServerCallsOperations
from .operations import CallConnectionsOperations
from .operations import ServerCallsOperations
from .. import models


class AzureCommunicationCallingServerService:
class AzureCommunicationCallingServerService(object):
"""Azure Communication Service Call Automation APIs.
:ivar call_connections: CallConnectionsOperations operations
:vartype call_connections:
azure.communication.callingserver.aio.operations.CallConnectionsOperations
:vartype call_connections: azure.communication.callingserver.aio.operations.CallConnectionsOperations
:ivar server_calls: ServerCallsOperations operations
:vartype server_calls: azure.communication.callingserver.aio.operations.ServerCallsOperations
:param endpoint: The endpoint of the Azure Communication resource.
Expand All @@ -34,47 +34,36 @@ def __init__(
endpoint: str,
**kwargs: Any
) -> None:
_base_url = '{endpoint}'
base_url = '{endpoint}'
self._config = AzureCommunicationCallingServerServiceConfiguration(endpoint, **kwargs)
self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs)
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.call_connections = CallConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.server_calls = ServerCallsOperations(self._client, self._config, self._serialize, self._deserialize)
self._deserialize = Deserializer(client_models)

self.call_connections = CallConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.server_calls = ServerCallsOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.AsyncHttpResponse
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""

request_copy = deepcopy(request)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}

request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
return self._client.send_request(request_copy, **kwargs)
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()
Expand Down
Loading

0 comments on commit 720ef1b

Please sign in to comment.