2020-09-17 16:02:52 -04:00
|
|
|
''' note serializer and children thereof '''
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
from typing import Dict, List
|
|
|
|
|
2020-11-27 20:58:21 -05:00
|
|
|
from .base_activity import ActivityObject, Link
|
|
|
|
from .image import Image
|
2020-09-17 16:02:52 -04:00
|
|
|
|
2020-10-08 15:32:45 -04:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Tombstone(ActivityObject):
|
2020-10-16 22:13:18 -04:00
|
|
|
''' the placeholder for a deleted status '''
|
2020-10-08 15:32:45 -04:00
|
|
|
published: str
|
|
|
|
deleted: str
|
|
|
|
type: str = 'Tombstone'
|
|
|
|
|
|
|
|
|
2020-09-17 16:02:52 -04:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Note(ActivityObject):
|
|
|
|
''' Note activity '''
|
|
|
|
published: str
|
|
|
|
attributedTo: str
|
|
|
|
content: str
|
2020-11-30 17:24:31 -05:00
|
|
|
to: List[str] = field(default_factory=lambda: [])
|
|
|
|
cc: List[str] = field(default_factory=lambda: [])
|
|
|
|
replies: Dict = field(default_factory=lambda: {})
|
|
|
|
inReplyTo: str = ''
|
2020-12-12 21:00:39 -05:00
|
|
|
summary: str = ''
|
2020-11-25 13:44:49 -05:00
|
|
|
tag: List[Link] = field(default_factory=lambda: [])
|
|
|
|
attachment: List[Image] = field(default_factory=lambda: [])
|
2020-09-17 16:02:52 -04:00
|
|
|
sensitive: bool = False
|
|
|
|
type: str = 'Note'
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(init=False)
|
|
|
|
class Article(Note):
|
|
|
|
''' what's an article except a note with more fields '''
|
|
|
|
name: str
|
|
|
|
type: str = 'Article'
|
|
|
|
|
|
|
|
|
2020-09-28 20:26:15 -04:00
|
|
|
@dataclass(init=False)
|
|
|
|
class GeneratedNote(Note):
|
|
|
|
''' just a re-typed note '''
|
2020-09-28 20:27:37 -04:00
|
|
|
type: str = 'GeneratedNote'
|
2020-09-28 20:26:15 -04:00
|
|
|
|
|
|
|
|
2020-09-17 16:02:52 -04:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Comment(Note):
|
|
|
|
''' like a note but with a book '''
|
|
|
|
inReplyToBook: str
|
|
|
|
type: str = 'Comment'
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(init=False)
|
|
|
|
class Review(Comment):
|
|
|
|
''' a full book review '''
|
2020-12-17 16:21:21 -05:00
|
|
|
name: str = None
|
2020-12-16 23:10:50 -05:00
|
|
|
rating: int = None
|
2020-09-17 16:02:52 -04:00
|
|
|
type: str = 'Review'
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(init=False)
|
|
|
|
class Quotation(Comment):
|
|
|
|
''' a quote and commentary on a book '''
|
|
|
|
quote: str
|
|
|
|
type: str = 'Quotation'
|