-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from i-be-snek/main
✨ Add list functions for Mentions and Private Messages
- Loading branch information
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from typing import Any, Optional | ||
from pythorhead.requestor import Request, Requestor | ||
from pythorhead.types import SortType | ||
|
||
|
||
class Mention: | ||
def __init__(self, _requestor: Requestor): | ||
self._requestor = _requestor | ||
|
||
def list( | ||
self, | ||
unread_only: bool, | ||
sort: Optional[SortType] = None, | ||
page: Optional[int] = None, | ||
limit: Optional[int] = None, | ||
) -> Optional[dict]: | ||
""" | ||
List all user mentions | ||
Args: | ||
unread_only (bool). | ||
sort? (SortType) | ||
page? (int). | ||
limit? (int) | ||
Returns: | ||
dict? mentions response | ||
""" | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters