Source code for kappa_sdk.event
from datetime import datetime
from typing import Dict, Any
[docs]
class Event:
    """ KAPPA Automate event.
    .. note:: Should not be instantiated directly.
    """
[docs]
    def __init__(self,
                 event_id: str,
                 object_id: str,
                 object_type: str,
                 event_type: str,
                 topic: str,
                 context: Dict[Any, Any],
                 content: Dict[Any, Any],
                 creation_time: datetime,
                 transaction_id: str):
        self.__event_id: str = event_id
        self.__object_id: str = object_id
        self.__object_type: str = object_type
        self.__event_type: str = event_type
        self.__topic: str = topic
        self.__context: Dict[Any, Any] = context
        self.__content: Dict[Any, Any] = content
        self.__creation_time: datetime = creation_time
        self.__transaction_id: str = transaction_id 
    @property
    def event_id(self) -> str:
        """ Gets the id of the :class:`Event`.
        """
        return self.__event_id
    @property
    def object_id(self) -> str:
        """ Gets the id of the object related to this :class:`Event`.
        """
        return self.__object_id
    @property
    def object_type(self) -> str:
        """ Gets the type of the object related to this :class:`Event`.
        """
        return self.__object_type
    @property
    def event_type(self) -> str:
        """ Gets the type of the :class:`Event`.
        """
        return self.__event_type
    @property
    def topic(self) -> str:
        """ Gets the topic of this :class:`Event`.
        """
        return self.__topic
    @property
    def context(self) -> Dict[Any, Any]:
        """ Gets the deserialized JSON context of :class:`Event`.
        """
        return self.__context
    @property
    def content(self) -> Dict[Any, Any]:
        """ Gets the deserialized JSON content of :class:`Event`'s payload.
        """
        return self.__content
    @property
    def creation_time(self) -> datetime:
        """ Gets the creation (issue) time of the :class:`Event`.
        """
        return self.__creation_time
    @property
    def transaction_id(self) -> str:
        """ Gets the id of the transaction related to this :class:`Event`.
        """
        return self.__transaction_id