Skip to content

Commit

Permalink
zulip: Deprecate methods whose names don't match with OperationIDs an…
Browse files Browse the repository at this point in the history
…d add newer methods.
  • Loading branch information
MSurfer20 committed Aug 16, 2021
1 parent 285a946 commit 899889e
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions zulip/zulip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,12 @@ def remove_reaction(self, reaction_data: Dict[str, Any]) -> Dict[str, Any]:
)

def get_realm_emoji(self) -> Dict[str, Any]:
logger.warning(
"get_realm_emoji() is deprecated." " Please use get_custom_emoji() instead."
)
return self.get_custom_emoji()

def get_custom_emoji(self) -> Dict[str, Any]:
"""
See examples/realm-emoji for example usage.
"""
Expand Down Expand Up @@ -1000,6 +1006,12 @@ def get_realm_linkifiers(self) -> Dict[str, Any]:
)

def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
logger.warning(
"get_members() is deprecated." " Please use get_users() instead."
)
self.add_linkifier(pattern, url_format_string)

def add_linkifier(self, pattern: str, url_format_string: str) -> Dict[str, Any]:
"""
Example usage:
Expand Down Expand Up @@ -1078,6 +1090,12 @@ def reorder_realm_profile_fields(self, **request: Any) -> Dict[str, Any]:
)

def update_realm_profile_field(self, field_id: int, **request: Any) -> Dict[str, Any]:
logger.warning(
"update_realm_profile_field() is deprecated." " Please use update_linkifier() instead."
)
return self.update_linkifier(field_id)

def update_linkifier(self, field_id: int, **request: Any) -> Dict[str, Any]:
"""
Example usage:
Expand Down Expand Up @@ -1157,6 +1175,12 @@ def deregister(self, queue_id: str, timeout: Optional[float] = None) -> Dict[str
)

def get_profile(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
logger.warning(
"get_profile() is deprecated." " Please use get_own_user() instead."
)
self.get_own_user(request)

def get_own_user(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
"""
Example usage:
Expand Down Expand Up @@ -1321,8 +1345,9 @@ def get_users(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
def get_members(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
# This exists for backwards-compatibility; we renamed this
# function get_users for consistency with the rest of the API.
# Later, we may want to add a warning for clients using this
# legacy name.
logger.warning(
"get_members() is deprecated." " Please use get_users() instead."
)
return self.get_users(request=request)

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

def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
logger.warning(
"add_subscriptions() is deprecated." " Please use subscribe() instead."
)
return self.subscribe(streams)

def subscribe(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) -> Dict[str, Any]:
"""
See examples/subscribe for example usage.
"""
Expand All @@ -1376,6 +1407,14 @@ def add_subscriptions(self, streams: Iterable[Dict[str, Any]], **kwargs: Any) ->

def remove_subscriptions(
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
) -> Dict[str, Any]:
logger.warning(
"remove_subscriptions() is deprecated." " Please use unsubscribe() instead."
)
return self.unsubscribe(streams, principals)

def unsubscribe(
self, streams: Iterable[str], principals: Union[Sequence[str], Sequence[int]] = []
) -> Dict[str, Any]:
"""
See examples/unsubscribe for example usage.
Expand Down

0 comments on commit 899889e

Please sign in to comment.