Skip to content

Commit

Permalink
Add content_type for aio (#34826)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingsy97 authored Mar 19, 2024
1 parent 6f5a43b commit 6cd9716
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def send_to_all( # pylint: disable=inconsistent-return-statements
:keyword filter: Following OData filter syntax to filter out the subscribers receiving the
messages. Default value is None.
:paramtype filter: str
:return: None
:keyword content_type: The content type of the payload. Default value is None. Allowed values are 'application/json', 'application/octet-stream' and 'text/plain'
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def get_client_access_token( # pylint: disable=arguments-differ

@distributed_trace_async
async def send_to_all( # pylint: disable=inconsistent-return-statements
self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, **kwargs: Any
self, message: IO, *, excluded: Optional[List[str]] = None, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any
) -> None:
"""Broadcast content inside request body to all the connected client connections.
Expand All @@ -115,6 +115,8 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements
:keyword filter: Following OData filter syntax to filter out the subscribers receiving the
messages. Default value is None.
:paramtype filter: str
:keyword content_type: The content type of the payload. Default value is None. Allowed values are 'application/json', 'application/octet-stream' and 'text/plain'
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -130,7 +132,7 @@ async def send_to_all( # pylint: disable=inconsistent-return-statements
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str
content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down Expand Up @@ -181,6 +183,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements
*,
excluded: Optional[List[str]] = None,
filter: Optional[str] = None,
content_type: Optional[str] = None,
**kwargs: Any
) -> None:
"""Send content inside request body to a group of connections.
Expand All @@ -197,6 +200,8 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements
:keyword filter: Following OData filter syntax to filter out the subscribers receiving the
messages. Default value is None.
:paramtype filter: str
:keyword content_type: The content type of the payload. Default value is None. Allowed values are 'application/json', 'application/octet-stream' and 'text/plain'
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -212,7 +217,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str
content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down Expand Up @@ -258,7 +263,7 @@ async def send_to_group( # pylint: disable=inconsistent-return-statements

@distributed_trace_async
async def send_to_connection( # pylint: disable=inconsistent-return-statements
self, connection_id: str, message: IO, **kwargs: Any
self, connection_id: str, message: IO, *, content_type: Optional[str] = None, **kwargs: Any
) -> None:
"""Send content inside request body to the specific connection.
Expand All @@ -268,6 +273,8 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements
:type connection_id: str
:param message: The payload body. Required.
:type message: IO
:keyword content_type: The content type of the payload. Default value is None. Allowed values are 'application/json', 'application/octet-stream' and 'text/plain'
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -283,7 +290,7 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str
content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down Expand Up @@ -327,7 +334,7 @@ async def send_to_connection( # pylint: disable=inconsistent-return-statements

@distributed_trace_async
async def send_to_user( # pylint: disable=inconsistent-return-statements
self, user_id: str, message: IO, *, filter: Optional[str] = None, **kwargs: Any
self, user_id: str, message: IO, *, filter: Optional[str] = None, content_type: Optional[str] = None, **kwargs: Any
) -> None:
"""Send content inside request body to the specific user.
Expand All @@ -340,6 +347,8 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements
:keyword filter: Following OData filter syntax to filter out the subscribers receiving the
messages. Default value is None.
:paramtype filter: str
:keyword content_type: The content type of the payload. Default value is None. Allowed values are 'application/json', 'application/octet-stream' and 'text/plain'
:paramtype content_type: str
:return: None
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -355,7 +364,7 @@ async def send_to_user( # pylint: disable=inconsistent-return-statements
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str
content_type = _headers.pop("Content-Type", "application/json") if content_type is None else content_type # type: str
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down

0 comments on commit 6cd9716

Please sign in to comment.