-
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.
Feat: Add admin class & list applications admin function (#54)
* Add admin class & list applications admin function * Update admin.py
- Loading branch information
1 parent
8304e8d
commit e8d28a3
Showing
2 changed files
with
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Any, List, Literal, Optional | ||
from pythorhead.requestor import Request, Requestor | ||
|
||
class Admin: | ||
def __init__(self, _requestor: Requestor): | ||
self._requestor = _requestor | ||
|
||
def list_applications( | ||
self, | ||
limit: Optional[int] = None, | ||
page: Optional[int] = None, | ||
unread_only: Optional[str] = None, | ||
) -> Optional[dict]: | ||
""" | ||
Pull applications from site. Note user must be admin. | ||
Args: | ||
limit (Optional[int], optional): Defaults to None. | ||
page (Optional[int], optional): Defaults to None. | ||
undread_only (Optional[str], optional): Must be "true" or "false". Defaults to false | ||
Returns: | ||
dict: list applications | ||
""" | ||
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, "/admin/registration_application/list", 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