Skip to content

ActivityStreams Vocabulary Objects

vultron.as_vocab.base.objects

vultron.as_vocab.base.objects.base

file: base author: adh created_at: 2/15/23 2:01 PM

as_Object dataclass

Bases: as_Base

Base class for all ActivityPub objects. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#object

Source code in vultron/as_vocab/base/objects/base.py
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Object(as_Base):
    """Base class for all ActivityPub objects.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#object>
    """

    replies: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    url: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    generator: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    context: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    tag: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    in_reply_to: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    # time (aka Wibbly-Wobbly Time-Wimey Stuff)
    duration: Optional[timedelta] = field(
        metadata=config(
            exclude=exclude_if_none,
            encoder=to_isofmt,
            decoder=from_isofmt,
            mm_field=fields.TimeDelta(
                precision="seconds", serialization_type=int, allow_none=True
            ),
        ),
        default=None,
    )
    start_time: Optional[datetime] = field(
        metadata=config(
            exclude=exclude_if_none,
            encoder=to_isofmt,
            decoder=from_isofmt,
            mm_field=fields.DateTime(format="iso", allow_none=True),
        ),
        default=None,
    )
    end_time: Optional[datetime] = field(
        metadata=config(
            exclude=exclude_if_none,
            encoder=to_isofmt,
            decoder=from_isofmt,
            mm_field=fields.DateTime(format="iso", allow_none=True),
        ),
        default=None,
    )
    published: Optional[datetime] = field(
        metadata=config(
            exclude=exclude_if_none,
            encoder=to_isofmt,
            decoder=from_isofmt,
            mm_field=fields.DateTime(format="iso", allow_none=True),
        ),
        default_factory=now_utc,
    )
    updated: Optional[datetime] = field(
        metadata=config(
            exclude=exclude_if_none,
            encoder=to_isofmt,
            decoder=from_isofmt,
            mm_field=fields.DateTime(format="iso", allow_none=True),
        ),
        default_factory=now_utc,
    )

    # content
    content: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    summary: Optional[str] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    icon: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    image: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    attachment: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    # location
    location: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    # addressing
    to: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    cc: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    bto: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )
    bcc: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    audience: Optional[Any] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

    # Todo: replace camelCase with snake_case
    attributed_to: Optional[List[Any]] = field(
        metadata=config(exclude=exclude_if_none), default=None
    )

vultron.as_vocab.base.objects.actors

file: actors author: adh created_at: 12/8/22 3:57 PM

as_Actor dataclass

Bases: as_Object

Base class for all ActivityPub actors. Describes one or more entities that performed or are expected to perform an activity. Any single activity can have multiple actors. The actor may be specified using an indirect Link or as an embedded Object. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor

Source code in vultron/as_vocab/base/objects/actors.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Actor(as_Object):
    """Base class for all ActivityPub actors.
    Describes one or more entities that performed or are expected to perform an activity.
    Any single activity can have multiple actors.
    The actor may be specified using an indirect Link or as an embedded Object.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-actor>
    """

    # todo: collections should be internally represented as lists but dumped as collections
    inbox: as_OrderedCollection = field(default_factory=as_OrderedCollection)
    outbox: as_OrderedCollection = field(default_factory=as_OrderedCollection)
    following: Optional[as_Collection] = None
    followers: Optional[as_Collection] = None
    liked: Optional[as_Collection] = None
    streams: Optional[as_Collection] = None
    preferred_username: Optional[str] = None
    endpoints: Optional[Any] = None

as_Application dataclass

Bases: as_Actor

A special kind of actor representing a software application. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application

Source code in vultron/as_vocab/base/objects/actors.py
74
75
76
77
78
79
80
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Application(as_Actor):
    """A special kind of actor representing a software application.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application>
    """

as_Group dataclass

Bases: as_Actor

A special kind of actor representing a logical group of persons or other actors. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group

Source code in vultron/as_vocab/base/objects/actors.py
56
57
58
59
60
61
62
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Group(as_Actor):
    """A special kind of actor representing a logical group of persons or other actors.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group>
    """

as_Organization dataclass

Bases: as_Actor

A special kind of actor representing a logical group of persons or other actors. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization

Source code in vultron/as_vocab/base/objects/actors.py
65
66
67
68
69
70
71
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Organization(as_Actor):
    """A special kind of actor representing a logical group of persons or other actors.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization>
    """

as_Person dataclass

Bases: as_Actor

A special kind of actor representing an individual person. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person

Source code in vultron/as_vocab/base/objects/actors.py
93
94
95
96
97
98
99
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Person(as_Actor):
    """A special kind of actor representing an individual person.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person>
    """

as_Service dataclass

Bases: as_Actor

A special kind of actor representing a service. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service A service is a kind of actor that represents a non-human actor.

Source code in vultron/as_vocab/base/objects/actors.py
83
84
85
86
87
88
89
90
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class as_Service(as_Actor):
    """A special kind of actor representing a service.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service>
    A service is a kind of actor that represents a non-human actor.
    """

vultron.as_vocab.base.objects.object_types

file: object_types author: adh created_at: 12/8/22 4:11 PM

as_Article dataclass

Bases: as_Document

Base class for all ActivityPub articles. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article

Source code in vultron/as_vocab/base/objects/object_types.py
64
65
66
67
68
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Article(as_Document):
    """Base class for all ActivityPub articles. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article>"""

as_Audio dataclass

Bases: as_Document

Base class for all ActivityPub audio. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio

Source code in vultron/as_vocab/base/objects/object_types.py
50
51
52
53
54
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Audio(as_Document):
    """Base class for all ActivityPub audio. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio>"""

as_Document dataclass

Bases: as_Object

Base class for all ActivityPub documents. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document

Source code in vultron/as_vocab/base/objects/object_types.py
29
30
31
32
33
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Document(as_Object):
    """Base class for all ActivityPub documents. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document>"""

as_Event dataclass

Bases: as_Object

Base class for all ActivityPub events. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event

Source code in vultron/as_vocab/base/objects/object_types.py
78
79
80
81
82
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Event(as_Object):
    """Base class for all ActivityPub events. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event>"""

as_Image dataclass

Bases: as_Document

Base class for all ActivityPub images. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image

Source code in vultron/as_vocab/base/objects/object_types.py
36
37
38
39
40
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Image(as_Document):
    """Base class for all ActivityPub images. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image>"""

as_Note dataclass

Bases: as_Object

Base class for all ActivityPub notes. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note

Source code in vultron/as_vocab/base/objects/object_types.py
71
72
73
74
75
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Note(as_Object):
    """Base class for all ActivityPub notes. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note>"""

as_Page dataclass

Bases: as_Document

Base class for all ActivityPub pages. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page

Source code in vultron/as_vocab/base/objects/object_types.py
57
58
59
60
61
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Page(as_Document):
    """Base class for all ActivityPub pages. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page>"""

as_Place dataclass

Bases: as_Object

Base class for all ActivityPub places. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place

Source code in vultron/as_vocab/base/objects/object_types.py
115
116
117
118
119
120
121
122
123
124
125
126
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Place(as_Object):
    """Base class for all ActivityPub places. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place>"""

    longitude: Optional[float] = None
    latitude: Optional[float] = None
    altitude: Optional[float] = None
    radius: Optional[float] = None
    accuracy: Optional[float] = None
    units: Optional[str] = None

as_Profile dataclass

Bases: as_Object

Base class for all ActivityPub profiles. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile

Source code in vultron/as_vocab/base/objects/object_types.py
85
86
87
88
89
90
91
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Profile(as_Object):
    """Base class for all ActivityPub profiles. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile>"""

    describes: Optional[Any] = None

as_Relationship dataclass

Bases: as_Object

Base class for all ActivityPub relationships. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship

Source code in vultron/as_vocab/base/objects/object_types.py
104
105
106
107
108
109
110
111
112
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Relationship(as_Object):
    """Base class for all ActivityPub relationships. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship>"""

    subject: Optional[Any] = None
    object: Optional[Any] = None
    relationship: Optional[Any] = None

as_Tombstone dataclass

Bases: as_Object

Base class for all ActivityPub tombstones. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone

Source code in vultron/as_vocab/base/objects/object_types.py
 94
 95
 96
 97
 98
 99
100
101
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Tombstone(as_Object):
    """Base class for all ActivityPub tombstones. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone>"""

    former_type: Optional[Any] = None
    deleted: Optional[datetime] = None

as_Video dataclass

Bases: as_Document

Base class for all ActivityPub videos. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video

Source code in vultron/as_vocab/base/objects/object_types.py
43
44
45
46
47
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Video(as_Document):
    """Base class for all ActivityPub videos. See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video>"""

vultron.as_vocab.base.objects.collections

file: collections author: adh created_at: 12/9/22 9:40 AM

as_Collection dataclass

Bases: as_Object

A collection is a list of objects. The items in the list MAY be ordered. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection

Source code in vultron/as_vocab/base/objects/collections.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_Collection(as_Object):
    """A collection is a list of objects. The items in the list MAY be ordered.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection>
    """

    items: Optional[List[as_Object]] = field(default_factory=list, repr=True)
    current: Optional[int] = field(default=0, repr=True)

    # # implement a way to ignore duplicates
    # _ids: Set[as_Object] = field(default_factory=set, repr=False)
    # _duplicates: bool = field(default=False, repr=False)

    @property
    def first(self):
        return self.items[0]

    @property
    def last(self):
        return self.items[-1]

    @property
    def totalItems(self):
        return len(self.items)

    def append(self, item: as_Object):
        if not self._duplicates and not item.as_id in self._ids:
            self.items.append(item)
            self._ids.add(item.as_id)

as_CollectionPage dataclass

Bases: as_Collection

A subset of items from a Collection. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage

Source code in vultron/as_vocab/base/objects/collections.py
70
71
72
73
74
75
76
77
78
79
80
81
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_CollectionPage(as_Collection):
    """A subset of items from a Collection.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage>
    """

    prev: Optional[as_Collection] = None
    next: Optional[as_Collection] = None
    partOf: Optional[as_Collection] = None
    startIndex = None

as_OrderedCollection dataclass

Bases: as_Collection

A collection that has its items explicitly ordered. The items in the list are assumed to always be in the same order. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection

Source code in vultron/as_vocab/base/objects/collections.py
61
62
63
64
65
66
67
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_OrderedCollection(as_Collection):
    """A collection that has its items explicitly ordered. The items in the list are assumed to always be in the same order.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection>
    """

as_OrderedCollectionPage dataclass

Bases: as_OrderedCollection, as_CollectionPage

A subset of items from an OrderedCollection. See definition in ActivityStreams Vocabulary https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionpage

Source code in vultron/as_vocab/base/objects/collections.py
84
85
86
87
88
89
90
@activitystreams_object
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class as_OrderedCollectionPage(as_OrderedCollection, as_CollectionPage):
    """A subset of items from an OrderedCollection.
    See definition in ActivityStreams Vocabulary <https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionpage>
    """