chat.collections.message ======================== .. py:module:: chat.collections.message Attributes ---------- .. autoapisummary:: chat.collections.message._M Classes ------- .. autoapisummary:: chat.collections.message.MessageCollection Module Contents --------------- .. py:data:: _M .. py:class:: MessageCollection(session: sqlalchemy.orm.Session, type: tuple[str, Ellipsis] | Literal['*'] | None = ..., channel_id: str = '*', newer_than: str | None = None, older_than: str | None = None, limit: int | None = None, load: Literal['older-first', 'newer-first'] = 'older-first') MessageCollection(session: sqlalchemy.orm.Session, type: str, channel_id: str = '*', newer_than: str | None = None, older_than: str | None = None, limit: int | None = None, load: Literal['older-first', 'newer-first'] = 'older-first') Bases: :py:obj:`onegov.core.collection.GenericCollection`\ [\ :py:obj:`_M`\ ] Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: type :value: '*' .. py:attribute:: channel_id :value: '*' .. py:attribute:: newer_than :value: None .. py:attribute:: older_than :value: None .. py:attribute:: limit :value: None .. py:attribute:: load :value: 'older-first' .. py:property:: model_class :type: type[_M] .. py:method:: add(*, channel_id: str, owner: str | None = None, type: str | None = None, meta: dict[str, Any] = ..., text: str | None = None, created: datetime.datetime = ..., updated: datetime.datetime | None = ..., file: onegov.chat.models.MessageFile | None = None, **kwargs: Any) -> _M add(**kwargs: Any) -> _M .. py:method:: query() -> sqlalchemy.orm.Query[_M] Queries the messages with the given parameters. .. py:method:: latest_message(offset: int = 0) -> _M | None Returns the latest message in descending order (newest first).