Skip to content

muck_out.sub_types

ActorAttachment module-attribute

ActorAttachment = Annotated[
    Annotated[PropertyValue, Tag("PropertyValue")]
    | Annotated[dict, Tag("unknown")],
    Discriminator(discriminator_actor_attachment),
]

Discriminates between the possible values of an attachment to an actor

Hashtag

Bases: BaseModel

Represents a hashtag

>>> m = Hashtag(name="#cow")
>>> m.model_dump(exclude_none=True)
{'type': 'Hashtag', 'name': '#cow'}

Parameters:

Name Type Description Default
type Literal['Hashtag']
'Hashtag'
href str | None

A location related to the hashtag

None
name str

The actual hashtag

required
Source code in muck_out/sub_types/tag.py
class Hashtag(BaseModel):
    """Represents a hashtag

    ```python
    >>> m = Hashtag(name="#cow")
    >>> m.model_dump(exclude_none=True)
    {'type': 'Hashtag', 'name': '#cow'}

    ```
    """

    type: Literal["Hashtag"] = Field(default="Hashtag")
    href: str | None = Field(
        default=None, description="A location related to the hashtag"
    )
    name: str = Field(description="The actual hashtag", examples=["#cow"])

Mention

Bases: BaseModel

Represents a mention

>>> m = Mention(href="http://actor.example/alice", name="@alice@actor.example")
>>> m.model_dump()
{'type': 'Mention',
    'href': 'http://actor.example/alice',
    'name': '@alice@actor.example'}

Parameters:

Name Type Description Default
type Literal['Mention']
'Mention'
href str

The location the mentioned party can be retrieved at. In the Fediverse usually an actor URI

required
name str | None
None
Source code in muck_out/sub_types/tag.py
class Mention(BaseModel):
    """Represents a mention

    ```python
    >>> m = Mention(href="http://actor.example/alice", name="@alice@actor.example")
    >>> m.model_dump()
    {'type': 'Mention',
        'href': 'http://actor.example/alice',
        'name': '@alice@actor.example'}

    ```
    """

    type: Literal["Mention"] = Field(default="Mention")
    href: str = Field(
        description="The location the mentioned party can be retrieved at. In the Fediverse usually an actor URI"
    )
    name: str | None = Field(default=None)

Bases: BaseModel

Represents a FEP-e232: Object Link

Parameters:

Name Type Description Default
type Literal['Link']
'Link'
href str

The location of the object

required
mediaType str

The media type of the object

required
name str | None

The microsyntax used to represent the object

None
rel str | None

Relation to the object

None
Source code in muck_out/sub_types/tag.py
class ObjectLink(BaseModel):
    """Represents a [FEP-e232: Object Link](https://fediverse.codeberg.page/fep/fep/e232/)"""

    type: Literal["Link"] = Field(default="Link")
    href: str = Field(
        examples=["http://remote.example/object/12345"],
        description="The location of the object",
    )
    mediaType: str = Field(
        examples=[
            '''application/ld+json; profile="https://www.w3.org/ns/activitystreams"''',
            "application/activity+json",
        ],
        description="The media type of the object",
    )
    name: str | None = Field(
        default=None,
        examples=["RE http://remote.example/object/12345"],
        description="The microsyntax used to represent the object",
    )
    rel: str | None = Field(default=None, description="Relation to the object")

PropertyValue

Bases: BaseModel

Key value pairs in the attachment of an actor as used by Mastodon

Parameters:

Name Type Description Default
type str

Fixed type for serialization

'PropertyValue'
name str

Key of the value

required
value str

Value

required
Source code in muck_out/sub_types/attachment.py
class PropertyValue(BaseModel):
    """
    Key value pairs in the attachment of an actor
    as used by Mastodon
    """

    type: str = Field("PropertyValue", description="""Fixed type for serialization""")

    name: PlainText = Field(
        examples=["Pronouns"],
        description="Key of the value",
    )

    value: PlainText = Field(
        examples=["They/them"],
        description="Value",
    )