-
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.
- Loading branch information
Showing
2 changed files
with
92 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,72 @@ | ||
from __future__ import annotations | ||
from datetime import datetime | ||
|
||
from typing import TYPE_CHECKING | ||
from mipac.types.antenna import IAntenna, IAntennaReceiveSource | ||
from mipac.utils.format import str_to_datetime | ||
|
||
|
||
if TYPE_CHECKING: | ||
from mipac.manager.client import ClientManager | ||
|
||
|
||
class Antenna: | ||
def __init__(self, antenna: IAntenna, *, client: ClientManager) -> None: | ||
self.__antenna: IAntenna = antenna | ||
self.__client: ClientManager = client | ||
|
||
@property | ||
def case_sensitive(self) -> bool: | ||
return self.__antenna['case_sensitive'] | ||
|
||
@property | ||
def created_at(self) -> datetime: | ||
return str_to_datetime(self.__antenna['created_at']) | ||
|
||
@property | ||
def exclude_keywords(self) -> list[str]: | ||
return self.__antenna['exclude_keywords'] | ||
|
||
@property | ||
def has_unread_note(self) -> bool: | ||
return self.__antenna['has_unread_note'] | ||
|
||
@property | ||
def id(self) -> str: | ||
return self.__antenna['id'] | ||
|
||
@property | ||
def is_actor(self) -> bool: | ||
return self.__antenna['is_actor'] | ||
|
||
@property | ||
def keywords(self) -> list[str]: | ||
return self.__antenna['keywords'] | ||
|
||
@property | ||
def name(self) -> str: | ||
return self.__antenna['name'] | ||
|
||
@property | ||
def notify(self) -> bool: | ||
return self.__antenna['notify'] | ||
|
||
@property | ||
def src(self) -> IAntennaReceiveSource: | ||
return self.__antenna['src'] | ||
|
||
@property | ||
def user_list_id(self) -> str | None: | ||
return self.__antenna['user_list_id'] | ||
|
||
@property | ||
def users(self) -> list[str]: | ||
return self.__antenna['users'] | ||
|
||
@property | ||
def with_file(self) -> bool: | ||
return self.__antenna['with_file'] | ||
|
||
@property | ||
def with_replies(self) -> bool: | ||
return self.__antenna['with_replies'] |
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,20 @@ | ||
from typing import Literal, TypedDict | ||
|
||
IAntennaReceiveSource = Literal['home', 'all', 'users', 'list'] | ||
|
||
|
||
class IAntenna(TypedDict): | ||
case_sensitive: bool | ||
created_at: str | ||
exclude_keywords: list[str] | ||
has_unread_note: bool | ||
id: str | ||
is_actor: bool | ||
keywords: list[str] | ||
name: str | ||
notify: bool | ||
src: IAntennaReceiveSource | ||
user_list_id: str | None | ||
users: list[str] | ||
with_file: bool | ||
with_replies: bool |