Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit db95b96

Browse files
committedAug 16, 2021
zulip: Deprecate methods whose names don't match with OperationIDs and add newer methods.
1 parent 285a946 commit db95b96

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed
 

‎zulip/zulip/__init__.py

+32-2
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,9 @@ def remove_reaction(self, reaction_data: Dict[str, Any]) -> Dict[str, Any]:
951951
)
952952

953953
def get_realm_emoji(self) -> Dict[str, Any]:
954+
return self.get_custom_emoji()
955+
956+
def get_custom_emoji(self) -> Dict[str, Any]:
954957
"""
955958
See examples/realm-emoji for example usage.
956959
"""
@@ -998,8 +1001,14 @@ def get_realm_linkifiers(self) -> Dict[str, Any]:
9981001
url="realm/linkifiers",
9991002
method="GET",
10001003
)
1001-
1004+
10021005
def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
1006+
logger.warning(
1007+
"get_members() is deprecated." " Please use get_users() instead."
1008+
)
1009+
self.add_linkifier(pattern, url_format_string)
1010+
1011+
def add_linkifier(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
10031012
"""
10041013
Example usage:
10051014
@@ -1015,6 +1024,7 @@ def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, An
10151024
},
10161025
)
10171026

1027+
10181028
def remove_realm_filter(self, filter_id: int) -> Dict[str, Any]:
10191029
"""
10201030
Example usage:
@@ -1078,6 +1088,9 @@ def reorder_realm_profile_fields(self, **request: Any) -> Dict[str, Any]:
10781088
)
10791089

10801090
def update_realm_profile_field(self, field_id: int, **request: Any) -> Dict[str, Any]:
1091+
self.update_linkifier(field_id)
1092+
1093+
def update_linkifier(self, field_id: int, **request: Any) -> Dict[str, Any]:
10811094
"""
10821095
Example usage:
10831096
@@ -1157,6 +1170,9 @@ def deregister(self, queue_id: str, timeout: Optional[float] = None) -> Dict[str
11571170
)
11581171

11591172
def get_profile(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
1173+
self.get_own_user(request)
1174+
1175+
def get_own_user(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
11601176
"""
11611177
Example usage:
11621178
@@ -1323,6 +1339,9 @@ def get_members(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any
13231339
# function get_users for consistency with the rest of the API.
13241340
# Later, we may want to add a warning for clients using this
13251341
# legacy name.
1342+
logger.warning(
1343+
"get_members() is deprecated." " Please use get_users() instead."
1344+
)
13261345
return self.get_users(request=request)
13271346

13281347
def get_alert_words(self) -> Dict[str, Any]:
@@ -1362,8 +1381,14 @@ def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[s
13621381
"list_subscriptions() is deprecated." " Please use get_subscriptions() instead."
13631382
)
13641383
return self.get_subscriptions(request)
1365-
1384+
13661385
def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
1386+
logger.warning(
1387+
"add_subscriptions() is deprecated." " Please use subscribe() instead."
1388+
)
1389+
return self.subscribe(streams)
1390+
1391+
def subscribe(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
13671392
"""
13681393
See examples/subscribe for example usage.
13691394
"""
@@ -1376,6 +1401,11 @@ def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) ->
13761401

13771402
def remove_subscriptions(
13781403
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
1404+
) -> Dict[str, Any]:
1405+
return self.unsubscribe(streams, principals)
1406+
1407+
def unsubscribe(
1408+
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
13791409
) -> Dict[str, Any]:
13801410
"""
13811411
See examples/unsubscribe for example usage.

0 commit comments

Comments
 (0)
Please sign in to comment.