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 db95b96
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions zulip/zulip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,9 @@ def remove_reaction(self, reaction_data: Dict[str, Any]) -> Dict[str, Any]:
)

def get_realm_emoji(self) -> Dict[str, Any]:
return self.get_custom_emoji()

def get_custom_emoji(self) -> Dict[str, Any]:
"""
See examples/realm-emoji for example usage.
"""
Expand Down Expand Up @@ -998,8 +1001,14 @@ def get_realm_linkifiers(self) -> Dict[str, Any]:
url="realm/linkifiers",
method="GET",
)

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 All @@ -1015,6 +1024,7 @@ def add_realm_filter(self, pattern: str, url_format_string: str) -> Dict[str, An
},
)


def remove_realm_filter(self, filter_id: int) -> Dict[str, Any]:
"""
Example usage:
Expand Down Expand Up @@ -1078,6 +1088,9 @@ 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]:
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 +1170,9 @@ 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]:
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 @@ -1323,6 +1339,9 @@ def get_members(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any
# 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 @@ -1362,8 +1381,14 @@ def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[s
"list_subscriptions() is deprecated." " Please use get_subscriptions() instead."
)
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 +1401,11 @@ 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]:
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 db95b96

Please sign in to comment.