From 3f8b3303dce1ef2cd0f5ce901f6a0c8dd1cf1f30 Mon Sep 17 00:00:00 2001 From: yupix Date: Fri, 31 May 2024 10:36:03 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=82=A2=E3=83=97=E3=83=AA=E3=81=AB?= =?UTF-8?q?=E9=96=A2=E3=81=99=E3=82=8B=E5=9E=8B=E3=81=A8=E3=83=A2=E3=83=87?= =?UTF-8?q?=E3=83=AB=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mipac/models/app.py | 36 ++++++++++++++++++++++++++++++++++++ mipac/types/app.py | 10 ++++++++++ 2 files changed, 46 insertions(+) create mode 100644 mipac/models/app.py create mode 100644 mipac/types/app.py diff --git a/mipac/models/app.py b/mipac/models/app.py new file mode 100644 index 0000000..656ed89 --- /dev/null +++ b/mipac/models/app.py @@ -0,0 +1,36 @@ +from mipac.types.app import IApp + + +class App: + def __init__(self, raw_app: IApp) -> None: + self.__raw_app: IApp = raw_app + + @property + def id(self) -> str: + """The id of the app""" + return self.__raw_app["id"] + + @property + def name(self) -> str: + """The name of the app""" + return self.__raw_app["name"] + + @property + def callback_url(self) -> str | None: + """The callback url of the app""" + return self.__raw_app["callback_url"] + + @property + def permission(self) -> list[str]: + """The permissions the app has""" + return self.__raw_app["permission"] + + @property + def secret(self) -> str: + """The secret of the app""" + return self.__raw_app["secret"] + + @property + def is_authorized(self) -> bool: + """If the app is authorized or not""" + return self.__raw_app["is_authorized"] diff --git a/mipac/types/app.py b/mipac/types/app.py new file mode 100644 index 0000000..3a880dd --- /dev/null +++ b/mipac/types/app.py @@ -0,0 +1,10 @@ +from typing import TypedDict + + +class IApp(TypedDict): + id: str + name: str + callback_url: str | None + permission: list[str] + secret: str + is_authorized: bool