chat.models.message =================== .. py:module:: chat.models.message Classes ------- .. autoapisummary:: chat.models.message.MessageFile chat.models.message.Message Functions --------- .. autoapisummary:: chat.models.message.init Module Contents --------------- .. py:class:: MessageFile Bases: :py:obj:`onegov.file.File` A general file (image, document, pdf, etc), referenced in the database. Thanks to the use of `Depot `_ files can be seemingly stored in the database (with transaction guarantees), without actually storing it in the database. .. py:attribute:: __mapper_args__ .. py:class:: Message Bases: :py:obj:`onegov.core.orm.Base` A single chat message bound to channel. .. py:attribute:: __mapper_args__ .. py:attribute:: __tablename__ :value: 'messages' .. py:attribute:: id :type: sqlalchemy.Column[str] .. py:attribute:: channel_id :type: sqlalchemy.Column[str] .. py:attribute:: owner :type: sqlalchemy.Column[str | None] .. py:attribute:: type :type: sqlalchemy.Column[str | None] .. py:attribute:: meta :type: sqlalchemy.Column[dict[str, Any]] .. py:attribute:: text :type: sqlalchemy.Column[str | None] .. py:attribute:: created :type: sqlalchemy.Column[datetime.datetime] .. py:attribute:: modified :type: sqlalchemy.Column[datetime.datetime | None] .. py:attribute:: file :value: None .. py:method:: __hash__() -> int .. py:method:: __eq__(other: object) -> bool .. py:property:: subtype :type: str | None An optional subtype for this message used for separating messages of a type further (currently for UI). Should be made unique, but there's no guarantee. .. py:method:: get(request: onegov.core.request.CoreRequest) -> str | None Code rendering a message should call this method to get the actual text of the message. It might be rendered from meta or it might be returned directly from the text column. How this is done is up to the polymorphic Message. .. py:attribute:: edited :type: sqlalchemy.Column[bool] .. py:method:: bound_messages(session: sqlalchemy.orm.Session) -> onegov.chat.MessageCollection[Self] :classmethod: A message collection bound to the polymorphic identity of this message. .. py:function:: init(target: Message, args: tuple[Any, Ellipsis], kwargs: dict[str, Any]) -> None Ensures that the message id is created upon instantiation. This helps to ensure that each message is ordered according to it's creation. Note that messages created within a millisecond of each other are ordered randomly.