coarnotify.patterns.announce_endorsement

Pattern to represent an Announce Endorsement notification https://coar-notify.net/specification/1.0.0/announce-endorsement/

Classes

AnnounceEndorsement

Class to represent an Announce Endorsement pattern

AnnounceEndorsementContext

Announce Endorsement context object, which extends the base NotifyObject

AnnounceEndorsementItem

Announce Endorsement Item, which extends the base NotifyItem to provide

Module Contents

class coarnotify.patterns.announce_endorsement.AnnounceEndorsement(stream: coarnotify.core.activitystreams2.ActivityStream | dict = None, validate_stream_on_construct=True, validate_properties=True, validators=None, validation_context=None, properties_by_reference=True)

Bases: coarnotify.core.notify.NotifyPattern

Class to represent an Announce Endorsement pattern

validate() bool

Extends the base validation to make context required

Returns:

True if valid, otherwise raises coarnotify.exceptions.ValidationError

TYPE

Announce Endorsement type, consisting of Activity Streams Announce and Notify Endorsement Action

property context: AnnounceEndorsementContext | None

Get a context specific to Announce Endorsement

Returns:

The Announce Endorsement context object

class coarnotify.patterns.announce_endorsement.AnnounceEndorsementContext(stream: coarnotify.core.activitystreams2.ActivityStream | dict = None, validate_stream_on_construct=True, validate_properties=True, validators=None, validation_context=None, properties_by_reference=True)

Bases: coarnotify.core.notify.NotifyObject

Announce Endorsement context object, which extends the base NotifyObject to allow us to pass back a custom AnnounceEndorsementItem

property item: AnnounceEndorsementItem | None

Get a custom AnnounceEndorsementItem

Returns:

the Announce Endorsement Item

class coarnotify.patterns.announce_endorsement.AnnounceEndorsementItem(stream: coarnotify.core.activitystreams2.ActivityStream | dict = None, validate_stream_on_construct=True, validate_properties=True, validators=None, validation_context=None, properties_by_reference=True)

Bases: coarnotify.core.notify.NotifyItem

Announce Endorsement Item, which extends the base NotifyItem to provide additional validation

validate() bool

Extends the base validation with validation custom to Announce Endorsement notifications

  • Adds type validation, which the base NotifyItem does not apply

  • Requires the mediaType value

Returns:

True if valid, otherwise raises a ValidationError