示例#1
0
 def __init__(
     self,
     *,
     sent_time: Union[str, datetime] = None,
     did: str = None,
     localization: dict = None,
     **kwargs,
 ):
     """
     TODO: update doc
     Initialize basic message object.
     Args:
         sent_time: Time message was sent
         did: did to resolve
         localization: localization
     """
     super().__init__(**kwargs)
     if not sent_time:
         sent_time = datetime_now()
     if localization:
         self._decorators["l10n"] = localization
     self.sent_time = datetime_to_str(sent_time)
     self.did = did
示例#2
0
 def __init__(
     self,
     *,
     sent_time: Union[str, datetime] = None,
     did_document: dict = None,
     resolver_metadata: dict = None,
     localization: dict = None,
     **kwargs,
 ):
     """
     TODO: update doc
     Initialize basic message object.
     Args:
         sent_time: Time message was sent
         did_document: did document (as json or python object)
         localization: localization
     """
     super().__init__(**kwargs)
     if not sent_time:
         sent_time = datetime_now()
     if localization:
         self._decorators["l10n"] = localization
     self.sent_time = datetime_to_str(sent_time)
     self.did_document = did_document
示例#3
0
    def __init__(
        self,
        *,
        sent_time: Union[str, datetime] = None,
        content: str = None,
        localization: str = None,
        **kwargs,
    ):
        """
        Initialize basic message object.

        Args:
            sent_time: Time message was sent
            content: message content
            localization: localization

        """
        super().__init__(**kwargs)
        if not sent_time:
            sent_time = datetime_now()
        if localization:
            self._decorators["l10n"] = localization
        self.sent_time = datetime_to_str(sent_time)
        self.content = content