Skip to content

Commit

Permalink
[WebPubSub] Update 1.1.0 (#34552)
Browse files Browse the repository at this point in the history
* update

* handle default value

* resolve comment
  • Loading branch information
xingsy97 authored Mar 14, 2024
1 parent 65af272 commit b4a0143
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get_client_access_token(self, **kwargs: Any) -> JSON:

@distributed_trace
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 @@ -142,6 +142,8 @@ def send_to_all( # pylint: disable=inconsistent-return-statements
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
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
Expand All @@ -156,7 +158,7 @@ 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
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down Expand Up @@ -201,7 +203,7 @@ def send_to_all( # pylint: disable=inconsistent-return-statements

@distributed_trace
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 @@ -214,6 +216,8 @@ 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 @@ -229,7 +233,7 @@ 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
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down Expand Up @@ -280,6 +284,7 @@ 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 @@ -296,6 +301,8 @@ 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 @@ -311,7 +318,7 @@ 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
cls = kwargs.pop("cls", None) # type: ClsType[None]

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

@distributed_trace
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 @@ -367,6 +374,8 @@ 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 @@ -382,7 +391,7 @@ 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
cls = kwargs.pop("cls", None) # type: ClsType[None]

_json = None
Expand Down

0 comments on commit b4a0143

Please sign in to comment.