From d6cf54549c25643083ea09b06d96297e9467d6fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Jul 2026 08:31:23 +0000 Subject: [PATCH] [typespec-python] Regenerate tests from microsoft/typespec PR #11233 --- .../requestbody/aio/operations/_operations.py | 111 +++++++++++++-- .../requestbody/operations/_operations.py | 128 +++++++++++++++--- .../test_bytes_request_body_operations.py | 3 - ...est_bytes_request_body_operations_async.py | 3 - .../test_jsonl_basic_operations.py | 1 - .../test_jsonl_basic_operations_async.py | 1 - .../jsonl/basic/aio/operations/_operations.py | 37 ++++- .../jsonl/basic/operations/_operations.py | 44 +++++- .../requestbody/aio/operations/_operations.py | 105 +++++++++++++- .../requestbody/operations/_operations.py | 124 +++++++++++++++-- .../jsonl/basic/aio/operations/_operations.py | 35 ++++- .../jsonl/basic/operations/_operations.py | 42 +++++- 12 files changed, 559 insertions(+), 75 deletions(-) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py index 1c8f98d8c6f9..f0cdbd76d63b 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping import json -from typing import Any, Callable, Optional, TypeVar +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -55,12 +55,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def default(self, value: bytes, **kwargs: Any) -> None: + @overload + async def default(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """default. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def default(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """default. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def default(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """default. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -76,9 +104,10 @@ async def default(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_default_request( @@ -106,12 +135,44 @@ async def default(self, value: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def octet_stream(self, value: bytes, **kwargs: Any) -> None: + @overload + async def octet_stream( + self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any + ) -> None: """octet_stream. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def octet_stream( + self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any + ) -> None: + """octet_stream. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def octet_stream(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """octet_stream. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -127,9 +188,10 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_octet_stream_request( @@ -157,12 +219,40 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace_async - async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: + @overload + async def custom_content_type(self, value: bytes, *, content_type: str = "image/png", **kwargs: Any) -> None: """custom_content_type. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def custom_content_type(self, value: IO[bytes], *, content_type: str = "image/png", **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def custom_content_type(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """custom_content_type. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -178,9 +268,10 @@ async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "image/png" _content = value _request = build_request_body_custom_content_type_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_operations.py index 60a6c9f815e9..7ae8dbdb835f 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping import json -from typing import Any, Callable, Optional, TypeVar +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -37,12 +37,13 @@ def build_request_body_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = "/encode/bytes/body/request/default" # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -50,12 +51,13 @@ def build_request_body_default_request(**kwargs: Any) -> HttpRequest: def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/encode/bytes/body/request/octet-stream" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -63,12 +65,13 @@ def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/encode/bytes/body/request/custom-content-type" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -116,12 +119,42 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def default(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """default. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def default(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """default. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def default( # pylint: disable=inconsistent-return-statements + self, value: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """default. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -137,9 +170,10 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_default_request( @@ -167,12 +201,42 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - @distributed_trace - def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def octet_stream(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """octet_stream. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def octet_stream(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """octet_stream. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def octet_stream( # pylint: disable=inconsistent-return-statements + self, value: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """octet_stream. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -188,9 +252,10 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_octet_stream_request( @@ -218,14 +283,42 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + def custom_content_type(self, value: bytes, *, content_type: str = "image/png", **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def custom_content_type(self, value: IO[bytes], *, content_type: str = "image/png", **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace def custom_content_type( # pylint: disable=inconsistent-return-statements - self, value: bytes, **kwargs: Any + self, value: Union[bytes, IO[bytes]], **kwargs: Any ) -> None: """custom_content_type. - :param value: Required. - :type value: bytes + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -241,9 +334,10 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "image/png" _content = value _request = build_request_body_custom_content_type_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations.py index 1d083b7c7b3b..8e01de1695f3 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations.py @@ -18,7 +18,6 @@ def test_request_body_default(self, bytes_endpoint): client = self.create_client(endpoint=bytes_endpoint) response = client.request_body.default( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself @@ -30,7 +29,6 @@ def test_request_body_octet_stream(self, bytes_endpoint): client = self.create_client(endpoint=bytes_endpoint) response = client.request_body.octet_stream( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself @@ -42,7 +40,6 @@ def test_request_body_custom_content_type(self, bytes_endpoint): client = self.create_client(endpoint=bytes_endpoint) response = client.request_body.custom_content_type( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations_async.py index a02a0e071e2c..4eb031e1e3ab 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations_async.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/encode-bytes/generated_tests/test_bytes_request_body_operations_async.py @@ -19,7 +19,6 @@ async def test_request_body_default(self, bytes_endpoint): client = self.create_async_client(endpoint=bytes_endpoint) response = await client.request_body.default( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself @@ -31,7 +30,6 @@ async def test_request_body_octet_stream(self, bytes_endpoint): client = self.create_async_client(endpoint=bytes_endpoint) response = await client.request_body.octet_stream( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself @@ -43,7 +41,6 @@ async def test_request_body_custom_content_type(self, bytes_endpoint): client = self.create_async_client(endpoint=bytes_endpoint) response = await client.request_body.custom_content_type( value=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations.py index 45c586dfb8aa..d11911352558 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations.py @@ -18,7 +18,6 @@ def test_basic_send(self, jsonl_endpoint): client = self.create_client(endpoint=jsonl_endpoint) response = client.basic.send( body=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations_async.py index 7ed2974d2466..75cf3dc811bc 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations_async.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/generated_tests/test_jsonl_basic_operations_async.py @@ -19,7 +19,6 @@ async def test_basic_send(self, jsonl_endpoint): client = self.create_async_client(endpoint=jsonl_endpoint) response = await client.basic.send( body=bytes("bytes", encoding="utf-8"), - content_type="str", ) # please add some check logic here by yourself diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py index ffa6174f5d0b..4cafccff9069 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -49,12 +49,40 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def send(self, body: bytes, **kwargs: Any) -> None: + @overload + async def send(self, body: bytes, *, content_type: str = "application/jsonl", **kwargs: Any) -> None: """send. :param body: Required. :type body: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def send(self, body: IO[bytes], *, content_type: str = "application/jsonl", **kwargs: Any) -> None: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def send(self, body: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """send. + + :param body: Is either a bytes type or a IO[bytes] type. Required. + :type body: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -70,9 +98,10 @@ async def send(self, body: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/jsonl")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/jsonl" _content = body _request = build_basic_send_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py index e98fa18feb96..d28e4834bb3f 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -37,12 +37,13 @@ def build_basic_send_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/streaming/jsonl/basic/send" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -78,12 +79,42 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def send(self, body: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def send(self, body: bytes, *, content_type: str = "application/jsonl", **kwargs: Any) -> None: """send. :param body: Required. :type body: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def send(self, body: IO[bytes], *, content_type: str = "application/jsonl", **kwargs: Any) -> None: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def send( # pylint: disable=inconsistent-return-statements + self, body: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """send. + + :param body: Is either a bytes type or a IO[bytes] type. Required. + :type body: bytes or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -99,9 +130,10 @@ def send(self, body: bytes, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/jsonl")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/jsonl" _content = body _request = build_basic_send_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py index 0e560e511178..25994243742f 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_operations.py @@ -1,7 +1,7 @@ # coding=utf-8 from collections.abc import MutableMapping import json -from typing import Any, Callable, Optional, TypeVar +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -48,11 +48,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def default(self, value: bytes, **kwargs: Any) -> None: + @overload + async def default(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """default. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + async def default(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """default. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + async def default(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """default. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -68,9 +96,10 @@ async def default(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_default_request( @@ -96,11 +125,43 @@ async def default(self, value: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - async def octet_stream(self, value: bytes, **kwargs: Any) -> None: + @overload + async def octet_stream( + self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any + ) -> None: """octet_stream. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + async def octet_stream( + self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any + ) -> None: + """octet_stream. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + async def octet_stream(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """octet_stream. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -116,9 +177,10 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_octet_stream_request( @@ -144,11 +206,39 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore - async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: + @overload + async def custom_content_type(self, value: bytes, *, content_type: str = "image/png", **kwargs: Any) -> None: """custom_content_type. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + async def custom_content_type(self, value: IO[bytes], *, content_type: str = "image/png", **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + async def custom_content_type(self, value: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """custom_content_type. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -164,9 +254,10 @@ async def custom_content_type(self, value: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "image/png" _content = value _request = build_request_body_custom_content_type_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_operations.py index 5368758c6b1b..edb24cc61888 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_operations.py @@ -1,7 +1,7 @@ # coding=utf-8 from collections.abc import MutableMapping import json -from typing import Any, Callable, Optional, TypeVar +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -30,12 +30,13 @@ def build_request_body_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = "/encode/bytes/body/request/default" # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -43,12 +44,13 @@ def build_request_body_default_request(**kwargs: Any) -> HttpRequest: def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/encode/bytes/body/request/octet-stream" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -56,12 +58,13 @@ def build_request_body_octet_stream_request(**kwargs: Any) -> HttpRequest: def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/encode/bytes/body/request/custom-content-type" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -109,11 +112,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def default(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """default. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + def default(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """default. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + def default( # pylint: disable=inconsistent-return-statements + self, value: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """default. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -129,9 +162,10 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_default_request( @@ -157,11 +191,41 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon if cls: return cls(pipeline_response, None, {}) # type: ignore - def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def octet_stream(self, value: bytes, *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: """octet_stream. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + def octet_stream(self, value: IO[bytes], *, content_type: str = "application/octet-stream", **kwargs: Any) -> None: + """octet_stream. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/octet-stream". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + def octet_stream( # pylint: disable=inconsistent-return-statements + self, value: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """octet_stream. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -177,9 +241,10 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = value _request = build_request_body_octet_stream_request( @@ -205,13 +270,41 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= if cls: return cls(pipeline_response, None, {}) # type: ignore - def custom_content_type( # pylint: disable=inconsistent-return-statements - self, value: bytes, **kwargs: Any - ) -> None: + @overload + def custom_content_type(self, value: bytes, *, content_type: str = "image/png", **kwargs: Any) -> None: """custom_content_type. :param value: Required. :type value: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + def custom_content_type(self, value: IO[bytes], *, content_type: str = "image/png", **kwargs: Any) -> None: + """custom_content_type. + + :param value: Required. + :type value: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "image/png". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + def custom_content_type( # pylint: disable=inconsistent-return-statements + self, value: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """custom_content_type. + + :param value: Is either a bytes type or a IO[bytes] type. Required. + :type value: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -227,9 +320,10 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "image/png")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "image/png" _content = value _request = build_request_body_custom_content_type_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py index 41a07fa10eae..f6b33e1b91d8 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_operations.py @@ -1,6 +1,6 @@ # coding=utf-8 from collections.abc import MutableMapping -from typing import Any, AsyncIterator, Callable, Optional, TypeVar +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -42,11 +42,39 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def send(self, body: bytes, **kwargs: Any) -> None: + @overload + async def send(self, body: bytes, *, content_type: str = "application/jsonl", **kwargs: Any) -> None: """send. :param body: Required. :type body: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + async def send(self, body: IO[bytes], *, content_type: str = "application/jsonl", **kwargs: Any) -> None: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + async def send(self, body: Union[bytes, IO[bytes]], **kwargs: Any) -> None: + """send. + + :param body: Is either a bytes type or a IO[bytes] type. Required. + :type body: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -62,9 +90,10 @@ async def send(self, body: bytes, **kwargs: Any) -> None: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/jsonl")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/jsonl" _content = body _request = build_basic_send_request( diff --git a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py index e5a6a95d6f3c..ad45bcd8059a 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_operations.py @@ -1,6 +1,6 @@ # coding=utf-8 from collections.abc import MutableMapping -from typing import Any, Callable, Iterator, Optional, TypeVar +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -30,12 +30,13 @@ def build_basic_send_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: str = kwargs.pop("content_type") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) # Construct URL _url = "/streaming/jsonl/basic/send" # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @@ -71,11 +72,41 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - def send(self, body: bytes, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + @overload + def send(self, body: bytes, *, content_type: str = "application/jsonl", **kwargs: Any) -> None: """send. :param body: Required. :type body: bytes + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + def send(self, body: IO[bytes], *, content_type: str = "application/jsonl", **kwargs: Any) -> None: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/jsonl". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + def send( # pylint: disable=inconsistent-return-statements + self, body: Union[bytes, IO[bytes]], **kwargs: Any + ) -> None: + """send. + + :param body: Is either a bytes type or a IO[bytes] type. Required. + :type body: bytes or IO[bytes] :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -91,9 +122,10 @@ def send(self, body: bytes, **kwargs: Any) -> None: # pylint: disable=inconsist _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/jsonl")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[None] = kwargs.pop("cls", None) + content_type = content_type or "application/jsonl" _content = body _request = build_basic_send_request(