moviewyrm/bookwyrm/activitypub/ordered_collection.py

37 lines
946 B
Python
Raw Normal View History

''' defines activitypub collections (lists) '''
2021-02-02 17:37:46 +00:00
from dataclasses import dataclass, field
from typing import List
from .base_activity import ActivityObject
@dataclass(init=False)
class OrderedCollection(ActivityObject):
''' structure of an ordered collection activity '''
totalItems: int
first: str
2021-02-02 17:37:46 +00:00
last: str = None
name: str = None
owner: str = None
to: List[str] = field(default_factory=lambda: [])
cc: List[str] = field(default_factory=lambda: [])
type: str = 'OrderedCollection'
@dataclass(init=False)
class BookList(OrderedCollection):
''' structure of an ordered collection activity '''
summary: str = None
curation: str = 'closed'
type: str = 'List'
@dataclass(init=False)
class OrderedCollectionPage(ActivityObject):
''' structure of an ordered collection activity '''
partOf: str
orderedItems: List
next: str
prev: str
type: str = 'OrderedCollectionPage'