Skip to content

Commit 632432e

Browse files
committed
zulip: Standardize the names of bindings with OperationIDs.
Some bindings had names that differed from the names that were used in the OperationID. This commit deprecates the older names, and changes the names of the bindings to match operationIDs.
1 parent 285a946 commit 632432e

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

zulip/zulip/__init__.py

+29-2
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,10 @@ 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("get_realm_emoji() is deprecated." " Please use get_custom_emoji() instead.")
955+
return self.get_custom_emoji()
956+
957+
def get_custom_emoji(self) -> Dict[str, Any]:
954958
"""
955959
See examples/realm-emoji for example usage.
956960
"""
@@ -1000,6 +1004,10 @@ def get_realm_linkifiers(self) -> Dict[str, Any]:
10001004
)
10011005

10021006
def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
1007+
logger.warning("get_members() is deprecated." " Please use get_users() instead.")
1008+
self.add_linkifier(pattern, url_format_string)
1009+
1010+
def add_linkifier(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
10031011
"""
10041012
Example usage:
10051013
@@ -1078,6 +1086,12 @@ def reorder_realm_profile_fields(self, **request: Any) -> Dict[str, Any]:
10781086
)
10791087

10801088
def update_realm_profile_field(self, field_id: int, **request: Any) -> Dict[str, Any]:
1089+
logger.warning(
1090+
"update_realm_profile_field() is deprecated." " Please use update_linkifier() instead."
1091+
)
1092+
return self.update_linkifier(field_id)
1093+
1094+
def update_linkifier(self, field_id: int, **request: Any) -> Dict[str, Any]:
10811095
"""
10821096
Example usage:
10831097
@@ -1157,6 +1171,10 @@ def deregister(self, queue_id: str, timeout: Optional[float] = None) -> Dict[str
11571171
)
11581172

11591173
def get_profile(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
1174+
logger.warning("get_profile() is deprecated." " Please use get_own_user() instead.")
1175+
self.get_own_user(request)
1176+
1177+
def get_own_user(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
11601178
"""
11611179
Example usage:
11621180
@@ -1321,8 +1339,7 @@ def get_users(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
13211339
def get_members(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
13221340
# This exists for backwards-compatibility; we renamed this
13231341
# 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.
1342+
logger.warning("get_members() is deprecated." " Please use get_users() instead.")
13261343
return self.get_users(request=request)
13271344

13281345
def get_alert_words(self) -> Dict[str, Any]:
@@ -1364,6 +1381,10 @@ def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[s
13641381
return self.get_subscriptions(request)
13651382

13661383
def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
1384+
logger.warning("add_subscriptions() is deprecated." " Please use subscribe() instead.")
1385+
return self.subscribe(streams)
1386+
1387+
def subscribe(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
13671388
"""
13681389
See examples/subscribe for example usage.
13691390
"""
@@ -1376,6 +1397,12 @@ def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) ->
13761397

13771398
def remove_subscriptions(
13781399
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
1400+
) -> Dict[str, Any]:
1401+
logger.warning("remove_subscriptions() is deprecated." " Please use unsubscribe() instead.")
1402+
return self.unsubscribe(streams, principals)
1403+
1404+
def unsubscribe(
1405+
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
13791406
) -> Dict[str, Any]:
13801407
"""
13811408
See examples/unsubscribe for example usage.

0 commit comments

Comments
 (0)