Skip to content

Headers

hololinked.server.zmq.message.RequestHeader

Bases: Struct

Header of a request message.

Source code in repo/hololinked/hololinked/server/zmq/message.py
class RequestHeader(msgspec.Struct):
    """Header of a request message."""

    messageType: str
    messageID: str
    senderID: str
    receiverID: str
    serverExecutionContext: SchedulerExecutionContext = msgspec.field(
        default_factory=lambda: default_scheduler_execution_context
    )
    thingExecutionContext: ThingExecutionContext = msgspec.field(
        default_factory=lambda: default_thing_execution_context
    )
    thingID: str | None = ""
    objekt: str | None = ""
    operation: str | None = ""
    payloadContentType: str | None = "application/json"
    preencodedPayloadContentType: str | None = "text/plain"

    def __getitem__(self, key: str) -> Any:
        try:
            return getattr(self, key)
        except AttributeError:
            raise KeyError(f"key {key} not found in {self.__class__.__name__}") from None

    def json(self):
        """
        The header as a dictionary of its fields.

        Returns
        -------
        header: dict[str, Any]
            the header fields keyed by their names
        """
        return {f: getattr(self, f) for f in self.__struct_fields__}

Functions

json

json()

The header as a dictionary of its fields.

Returns:

Name Type Description
header dict[str, Any]

the header fields keyed by their names

Source code in repo/hololinked/hololinked/server/zmq/message.py
def json(self):
    """
    The header as a dictionary of its fields.

    Returns
    -------
    header: dict[str, Any]
        the header fields keyed by their names
    """
    return {f: getattr(self, f) for f in self.__struct_fields__}

hololinked.server.zmq.message.ResponseHeader

Bases: Struct

Header of a response message.

Source code in repo/hololinked/hololinked/server/zmq/message.py
class ResponseHeader(msgspec.Struct):
    """Header of a response message."""

    messageType: str
    messageID: str
    receiverID: str
    senderID: str
    payloadContentType: str | None = "application/json"
    preencodedPayloadContentType: str | None = ""

    def __getitem__(self, key: str) -> Any:
        try:
            return getattr(self, key)
        except AttributeError:
            raise KeyError(f"key {key} not found in {self.__class__.__name__}") from None

    def json(self):
        """
        The header as a dictionary of its fields.

        Returns
        -------
        header: dict[str, Any]
            the header fields keyed by their names
        """
        return {f: getattr(self, f) for f in self.__struct_fields__}

Functions

json

json()

The header as a dictionary of its fields.

Returns:

Name Type Description
header dict[str, Any]

the header fields keyed by their names

Source code in repo/hololinked/hololinked/server/zmq/message.py
def json(self):
    """
    The header as a dictionary of its fields.

    Returns
    -------
    header: dict[str, Any]
        the header fields keyed by their names
    """
    return {f: getattr(self, f) for f in self.__struct_fields__}

hololinked.server.zmq.message.EventHeader

Bases: Struct

Header of an event message.

Source code in repo/hololinked/hololinked/server/zmq/message.py
class EventHeader(msgspec.Struct):
    """Header of an event message."""

    messageType: str
    messageID: str
    senderID: str
    eventID: str
    payloadContentType: str | None = "application/json"
    preencodedPayloadContentType: str | None = ""

    def __getitem__(self, key: str) -> Any:
        try:
            return getattr(self, key)
        except AttributeError:
            raise KeyError(f"key {key} not found in {self.__class__.__name__}") from None

    def json(self):
        """
        The header as a dictionary of its fields.

        Returns
        -------
        header: dict[str, Any]
            the header fields keyed by their names
        """
        return {f: getattr(self, f) for f in self.__struct_fields__}

Functions

json

json()

The header as a dictionary of its fields.

Returns:

Name Type Description
header dict[str, Any]

the header fields keyed by their names

Source code in repo/hololinked/hololinked/server/zmq/message.py
def json(self):
    """
    The header as a dictionary of its fields.

    Returns
    -------
    header: dict[str, Any]
        the header fields keyed by their names
    """
    return {f: getattr(self, f) for f in self.__struct_fields__}