|
|
|
@ -9,16 +9,18 @@ from mipac.models.note import Note
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from mipac.manager.client import ClientActions
|
|
|
|
|
from mipac.manager.follow import FollowManager, FollowRequestManager
|
|
|
|
|
from mipac.types.notification import INotification, IUserNf, \
|
|
|
|
|
INoteNf, IPollEndNf, IReactionNf
|
|
|
|
|
from mipac.types.notification import (
|
|
|
|
|
INotification,
|
|
|
|
|
IUserNf,
|
|
|
|
|
INoteNf,
|
|
|
|
|
IPollEndNf,
|
|
|
|
|
IReactionNf,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Notification:
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
notification: INotification,
|
|
|
|
|
*,
|
|
|
|
|
client: ClientActions,
|
|
|
|
|
self, notification: INotification, *, client: ClientActions,
|
|
|
|
|
) -> None:
|
|
|
|
|
self.__notification: INotification = notification
|
|
|
|
|
self.__client: ClientActions = client
|
|
|
|
@ -44,10 +46,7 @@ class Notification:
|
|
|
|
|
|
|
|
|
|
class NotificationFollow(Notification):
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
notification: IUserNf,
|
|
|
|
|
*,
|
|
|
|
|
client: ClientActions,
|
|
|
|
|
self, notification: IUserNf, *, client: ClientActions,
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(notification, client=client)
|
|
|
|
|
self.__notification: IUserNf = notification
|
|
|
|
@ -55,9 +54,7 @@ class NotificationFollow(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user(self) -> LiteUser:
|
|
|
|
|
return LiteUser(
|
|
|
|
|
self.__notification['user'], client=self.__client,
|
|
|
|
|
)
|
|
|
|
|
return LiteUser(self.__notification['user'], client=self.__client,)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user_id(self) -> str:
|
|
|
|
@ -65,17 +62,12 @@ class NotificationFollow(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def api(self) -> FollowManager:
|
|
|
|
|
return self.__client._create_user_instance(
|
|
|
|
|
user=self.user
|
|
|
|
|
).follow
|
|
|
|
|
return self.__client._create_user_instance(user=self.user).follow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationFollowRequest(Notification):
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
notification: IUserNf,
|
|
|
|
|
*,
|
|
|
|
|
client: ClientActions,
|
|
|
|
|
self, notification: IUserNf, *, client: ClientActions,
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(notification, client=client)
|
|
|
|
|
self.__notification: IUserNf = notification
|
|
|
|
@ -83,9 +75,7 @@ class NotificationFollowRequest(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user(self) -> LiteUser:
|
|
|
|
|
return LiteUser(
|
|
|
|
|
self.__notification['user'], client=self.__client,
|
|
|
|
|
)
|
|
|
|
|
return LiteUser(self.__notification['user'], client=self.__client,)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user_id(self) -> str:
|
|
|
|
@ -100,10 +90,7 @@ class NotificationFollowRequest(Notification):
|
|
|
|
|
|
|
|
|
|
class NotificationNote(Notification):
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
notification: INoteNf,
|
|
|
|
|
*,
|
|
|
|
|
client: ClientActions,
|
|
|
|
|
self, notification: INoteNf, *, client: ClientActions,
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(notification, client=client)
|
|
|
|
|
self.__notification: INoteNf = notification
|
|
|
|
@ -111,9 +98,7 @@ class NotificationNote(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user(self) -> LiteUser:
|
|
|
|
|
return LiteUser(
|
|
|
|
|
self.__notification['user'], client=self.__client,
|
|
|
|
|
)
|
|
|
|
|
return LiteUser(self.__notification['user'], client=self.__client,)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def user_id(self) -> str:
|
|
|
|
@ -121,17 +106,12 @@ class NotificationNote(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def note(self) -> Note:
|
|
|
|
|
return Note(
|
|
|
|
|
self.__notification['note'], client=self.__client,
|
|
|
|
|
)
|
|
|
|
|
return Note(self.__notification['note'], client=self.__client,)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationPollEnd(Notification):
|
|
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
notification: IPollEndNf,
|
|
|
|
|
*,
|
|
|
|
|
client: ClientActions,
|
|
|
|
|
self, notification: IPollEndNf, *, client: ClientActions,
|
|
|
|
|
) -> None:
|
|
|
|
|
super().__init__(notification, client=client)
|
|
|
|
|
self.__notification: IPollEndNf = notification
|
|
|
|
@ -139,9 +119,7 @@ class NotificationPollEnd(Notification):
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def note(self) -> Note:
|
|
|
|
|
return Note(
|
|
|
|
|
self.__notification['note'], client=self.__client,
|
|
|
|
|
)
|
|
|
|
|
return Note(self.__notification['note'], client=self.__client,)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NotificationReaction(Notification):
|
|
|
|
|