Add Question support

pull/20/head
Thomas Sileo 2019-04-09 20:54:28 +02:00
rodzic 6d6ec9cc54
commit 047c284f7a
1 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -106,6 +106,9 @@ class ActivityType(Enum):
# Others
MENTION = "Mention"
# Mastodon specific?
QUESTION = "Question"
ACTOR_TYPES = [
ActivityType.PERSON,
@ -115,7 +118,7 @@ ACTOR_TYPES = [
ActivityType.SERVICE,
]
CREATE_TYPES = [ActivityType.NOTE, ActivityType.ARTICLE, ActivityType.VIDEO]
CREATE_TYPES = [ActivityType.NOTE, ActivityType.ARTICLE, ActivityType.VIDEO, ActivityType.QUESTION]
COLLECTION_TYPES = [ActivityType.COLLECTION, ActivityType.ORDERED_COLLECTION]
@ -877,6 +880,15 @@ class Note(BaseActivity):
return False
class Question(Note):
ACTIVITY_TYPE = ActivityType.QUESTION
ACTOR_REQUIRED = True
OBJECT_REQURIED = False
def one_of(self) -> List[Dict[str, Any]]:
return self._data.get("oneOf", [])
class Article(Note):
ACTIVITY_TYPE = ActivityType.ARTICLE
ACTOR_REQUIRED = True