Skip to content

Commit 899889e

Browse files
committed
zulip: Deprecate methods whose names don't match with OperationIDs and add newer methods.
1 parent 285a946 commit 899889e

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

zulip/zulip/__init__.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,12 @@ def remove_reaction(self, reaction_data: Dict[str, Any]) -> Dict[str, Any]:
951951
)
952952

953953
def get_realm_emoji(self) -> Dict[str, Any]:
954+
logger.warning(
955+
"get_realm_emoji() is deprecated." " Please use get_custom_emoji() instead."
956+
)
957+
return self.get_custom_emoji()
958+
959+
def get_custom_emoji(self) -> Dict[str, Any]:
954960
"""
955961
See examples/realm-emoji for example usage.
956962
"""
@@ -1000,6 +1006,12 @@ def get_realm_linkifiers(self) -> Dict[str, Any]:
10001006
)
10011007

10021008
def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
1009+
logger.warning(
1010+
"get_members() is deprecated." " Please use get_users() instead."
1011+
)
1012+
self.add_linkifier(pattern, url_format_string)
1013+
1014+
def add_linkifier(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
10031015
"""
10041016
Example usage:
10051017
@@ -1078,6 +1090,12 @@ def reorder_realm_profile_fields(self, **request: Any) -> Dict[str, Any]:
10781090
)
10791091

10801092
def update_realm_profile_field(self, field_id: int, **request: Any) -> Dict[str, Any]:
1093+
logger.warning(
1094+
"update_realm_profile_field() is deprecated." " Please use update_linkifier() instead."
1095+
)
1096+
return self.update_linkifier(field_id)
1097+
1098+
def update_linkifier(self, field_id: int, **request: Any) -> Dict[str, Any]:
10811099
"""
10821100
Example usage:
10831101
@@ -1157,6 +1175,12 @@ def deregister(self, queue_id: str, timeout: Optional[float] = None) -> Dict[str
11571175
)
11581176

11591177
def get_profile(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
1178+
logger.warning(
1179+
"get_profile() is deprecated." " Please use get_own_user() instead."
1180+
)
1181+
self.get_own_user(request)
1182+
1183+
def get_own_user(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
11601184
"""
11611185
Example usage:
11621186
@@ -1321,8 +1345,9 @@ def get_users(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
13211345
def get_members(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
13221346
# This exists for backwards-compatibility; we renamed this
13231347
# function get_users for consistency with the rest of the API.
1324-
# Later, we may want to add a warning for clients using this
1325-
# legacy name.
1348+
logger.warning(
1349+
"get_members() is deprecated." " Please use get_users() instead."
1350+
)
13261351
return self.get_users(request=request)
13271352

13281353
def get_alert_words(self) -> Dict[str, Any]:
@@ -1364,6 +1389,12 @@ def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[s
13641389
return self.get_subscriptions(request)
13651390

13661391
def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
1392+
logger.warning(
1393+
"add_subscriptions() is deprecated." " Please use subscribe() instead."
1394+
)
1395+
return self.subscribe(streams)
1396+
1397+
def subscribe(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
13671398
"""
13681399
See examples/subscribe for example usage.
13691400
"""
@@ -1376,6 +1407,14 @@ def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) ->
13761407

13771408
def remove_subscriptions(
13781409
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
1410+
) -> Dict[str, Any]:
1411+
logger.warning(
1412+
"remove_subscriptions() is deprecated." " Please use unsubscribe() instead."
1413+
)
1414+
return self.unsubscribe(streams, principals)
1415+
1416+
def unsubscribe(
1417+
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
13791418
) -> Dict[str, Any]:
13801419
"""
13811420
See examples/unsubscribe for example usage.

0 commit comments

Comments
 (0)