-
Notifications
You must be signed in to change notification settings - Fork 4
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 yupix/refactory/meta
Refactory/meta
- Loading branch information
Showing
61 changed files
with
1,132 additions
and
655 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .admin import * | ||
from .admins import * | ||
from .chart import * | ||
from .chat import * | ||
from .drive import * | ||
|
File renamed without changes.
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,31 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from mipac.abstract.action import AbstractAction | ||
from mipac.http import HTTPClient, Route | ||
from mipac.models.meta import AdminMeta | ||
from mipac.types.meta import IAdminMeta | ||
|
||
if TYPE_CHECKING: | ||
from mipac.manager.client import ClientManager | ||
|
||
|
||
class AdminActions(AbstractAction): | ||
def __init__(self, *, session: HTTPClient, client: ClientManager): | ||
self.__session = session | ||
self.__client = client | ||
|
||
async def get_meta(self, detail: bool = False) -> AdminMeta: | ||
res: IAdminMeta = await self.__session.request( | ||
Route('POST', '/api/admin/meta'), | ||
json={'detail': detail}, | ||
auth=True, | ||
lower=True, | ||
) | ||
return AdminMeta(res, client=self.__client) | ||
|
||
async def get_invite(self) -> bool: | ||
return bool( | ||
await self.__session.request(Route('POST', '/api/admin/invite')) | ||
) |
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
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
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,39 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Literal, overload | ||
|
||
from mipac.abstract.action import AbstractAction | ||
from mipac.http import HTTPClient, Route | ||
from mipac.models.lite.meta import LiteMeta | ||
from mipac.models.meta import Meta | ||
from mipac.types.meta import ILiteMeta, IMeta | ||
|
||
if TYPE_CHECKING: | ||
from mipac.manager.client import ClientManager | ||
|
||
|
||
class ClientActions(AbstractAction): | ||
def __init__(self, *, session: HTTPClient, client: ClientManager) -> None: | ||
self.__session: HTTPClient = session | ||
self.__client: ClientManager = client | ||
|
||
@overload | ||
async def get_meta(self, detail: Literal[False] = ...) -> LiteMeta: | ||
... | ||
|
||
@overload | ||
async def get_meta(self, detail: Literal[True] = ...) -> Meta: | ||
... | ||
|
||
async def get_meta(self, detail: bool = False): | ||
params = { | ||
'route': Route('POST', '/api/meta'), | ||
'json': {'detail': detail}, | ||
'auth': True, | ||
'lower': True, | ||
} | ||
if detail is True: | ||
meta: IMeta = await self.__session.request(**params) | ||
return Meta(meta, client=self.__client) | ||
lite_meta: ILiteMeta = await self.__session.request(**params) | ||
return LiteMeta(lite_meta, client=self.__client) |
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
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
Oops, something went wrong.