diff --git a/pythorhead/auth.py b/pythorhead/auth.py index e9cb29b..0e74992 100644 --- a/pythorhead/auth.py +++ b/pythorhead/auth.py @@ -7,9 +7,6 @@ class Authentication: def set_token(self, token: str) -> None: self.token = token - - def get_token(self) -> Optional[str]: - return self.token def set_api_base_url(self, base_url: str) -> None: self.api_url = f"{base_url}/api/v3" diff --git a/pythorhead/mention.py b/pythorhead/mention.py index b591a5b..0f42d77 100644 --- a/pythorhead/mention.py +++ b/pythorhead/mention.py @@ -26,9 +26,8 @@ def list( Returns: dict? mentions response """ - - params = {"auth": self._requestor.get_auth_token()} - json: dict[str, Any] = {key: value for key, value in locals( + unread_only = 'true' if unread_only else 'false' + + params: dict[str, Any] = {key: value for key, value in locals( ).items() if value is not None and key != "self"} - - return self._requestor.api(Request.GET, "/user/mention", params=params, json=json) + return self._requestor.api(Request.GET, "/user/mention", params=params) diff --git a/pythorhead/private_message.py b/pythorhead/private_message.py index a45c117..ed79edf 100644 --- a/pythorhead/private_message.py +++ b/pythorhead/private_message.py @@ -30,7 +30,7 @@ def list( self, unread_only: bool, page: int, - limit: int + limit: int = 20 ) -> Optional[dict]: """ List private messages @@ -38,12 +38,12 @@ def list( Args: unread_only (bool). page (int). - limit (int). + limit (int) with a max of 50. Returns: dict? private message response """ - json: dict[str, Any] = {key: value for key, value in locals().items() if value is not None and key != "self"} - params = {"auth": self._requestor.get_auth_token()} - - return self._requestor.api(Request.GET, "/private_message/list", params=params, json=json) + limit = 50 if limit > 50 else limit + unread_only = 'true' if unread_only else 'false' + params: dict[str, Any] = {key: value for key, value in locals().items() if value is not None and key != "self"} + return self._requestor.api(Request.GET, "/private_message/list", params=params) diff --git a/pythorhead/requestor.py b/pythorhead/requestor.py index 608c035..4d40503 100644 --- a/pythorhead/requestor.py +++ b/pythorhead/requestor.py @@ -97,9 +97,6 @@ def log_in(self, username_or_email: str, password: str) -> bool: if data := self.api(Request.POST, "/user/login", json=payload): self._auth.set_token(data["jwt"]) return self._auth.token is not None - - def get_auth_token(self) -> Optional[str]: - return self._auth.get_token() def log_out(self) -> None: self._auth.token = None