Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the API call to hide communities #51

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions plemmy/lemmyhttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,22 @@ def get_unread_registration_application_count(self) -> requests.Response:
None, None
)

def hide_community(self, community_id: int, hidden: bool, reason: str = '') -> requests.Response:
""" hide_community: Hide a community from public / "All" view. Admins only.

Args:
community_id (int): ID of community to hide
hidden (bool): True if hidden, False otherwise
reason (str): reason for hiding community

Returns:
requests.Response: result of API call
"""

form = create_form(locals())
return put_handler(self._session, f"{self._api_url}/community/hide",
form)

def leave_admin(self) -> requests.Response:
""" leave_admin: current user leaves admin group

Expand Down