2021-03-08 16:49:10 +00:00
|
|
|
""" defines activitypub collections (lists) """
|
2021-02-02 17:37:46 +00:00
|
|
|
from dataclasses import dataclass, field
|
2020-09-17 20:02:52 +00:00
|
|
|
from typing import List
|
|
|
|
|
|
|
|
from .base_activity import ActivityObject
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass(init=False)
|
|
|
|
class OrderedCollection(ActivityObject):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" structure of an ordered collection activity """
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
totalItems: int
|
|
|
|
first: str
|
2021-02-02 17:37:46 +00:00
|
|
|
last: str = None
|
|
|
|
name: str = None
|
|
|
|
owner: str = None
|
2021-03-08 16:49:10 +00:00
|
|
|
type: str = "OrderedCollection"
|
|
|
|
|
2021-02-02 19:17:31 +00:00
|
|
|
|
|
|
|
@dataclass(init=False)
|
|
|
|
class OrderedCollectionPrivate(OrderedCollection):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" an ordered collection with privacy settings """
|
|
|
|
|
2021-02-02 17:37:46 +00:00
|
|
|
to: List[str] = field(default_factory=lambda: [])
|
|
|
|
cc: List[str] = field(default_factory=lambda: [])
|
2020-09-17 20:02:52 +00:00
|
|
|
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2021-02-02 19:17:31 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class Shelf(OrderedCollectionPrivate):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" structure of an ordered collection activity """
|
|
|
|
|
|
|
|
type: str = "Shelf"
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
|
2021-02-02 19:05:47 +00:00
|
|
|
@dataclass(init=False)
|
2021-02-02 19:17:31 +00:00
|
|
|
class BookList(OrderedCollectionPrivate):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" structure of an ordered collection activity """
|
|
|
|
|
2021-02-02 19:05:47 +00:00
|
|
|
summary: str = None
|
2021-03-08 16:49:10 +00:00
|
|
|
curation: str = "closed"
|
|
|
|
type: str = "BookList"
|
2021-02-02 19:05:47 +00:00
|
|
|
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
@dataclass(init=False)
|
|
|
|
class OrderedCollectionPage(ActivityObject):
|
2021-03-08 16:49:10 +00:00
|
|
|
""" structure of an ordered collection activity """
|
|
|
|
|
2020-09-17 20:02:52 +00:00
|
|
|
partOf: str
|
|
|
|
orderedItems: List
|
2021-02-17 21:33:48 +00:00
|
|
|
next: str = None
|
|
|
|
prev: str = None
|
2021-03-08 16:49:10 +00:00
|
|
|
type: str = "OrderedCollectionPage"
|