From 7fa07a3541040129ddc33811eb76fc0e053dbdd3 Mon Sep 17 00:00:00 2001 From: UlrikHD Date: Sun, 6 Oct 2024 19:10:36 +0200 Subject: [PATCH 1/2] Adds the API call to hide communities --- plemmy/lemmyhttp.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plemmy/lemmyhttp.py b/plemmy/lemmyhttp.py index e3b9915..5c4308f 100644 --- a/plemmy/lemmyhttp.py +++ b/plemmy/lemmyhttp.py @@ -1146,6 +1146,21 @@ 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 From b42dc90b9198c7752483590ae35e6bf67999a915 Mon Sep 17 00:00:00 2001 From: UlrikHD Date: Sun, 6 Oct 2024 19:15:32 +0200 Subject: [PATCH 2/2] Adds an empty line after the docstring in hide_community() --- plemmy/lemmyhttp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plemmy/lemmyhttp.py b/plemmy/lemmyhttp.py index 5c4308f..a7201fd 100644 --- a/plemmy/lemmyhttp.py +++ b/plemmy/lemmyhttp.py @@ -1157,6 +1157,7 @@ def hide_community(self, community_id: int, hidden: bool, reason: str = '') -> r Returns: requests.Response: result of API call """ + form = create_form(locals()) return put_handler(self._session, f"{self._api_url}/community/hide", form)