slidge.util.types
=================

.. py:module:: slidge.util.types

.. autoapi-nested-parse::

   Typing stuff





Module Contents
---------------

.. py:class:: MessageReference

   A "message reply", ie a "quoted message" (:xep:`0461`)

   At the very minimum, the legacy message ID attribute must be set, but to
   ensure that the quote is displayed in all XMPP clients, the author must also
   be set (use the string "user" if the slidge user is the author of the referenced
   message).
   The body is used as a fallback for XMPP clients that do not support :xep:`0461`
   of that failed to find the referenced message.


.. py:class:: LegacyAttachment

   A file attachment to a message

   At the minimum, one of the ``path``, ``steam``, ``data`` or ``url`` attribute
   has to be set

   To be used with :meth:`.LegacyContact.send_files` or
   :meth:`.LegacyParticipant.send_files`


   .. py:attribute:: caption
      :type:  str | None
      :value: None


      A caption for this specific image. For a global caption for a list of attachments,
      use the ``body`` parameter of :meth:`.AttachmentMixin.send_files`



.. py:class:: MucType

   Bases: :py:obj:`enum.IntEnum`


   The type of group, private, public, anonymous or not.


   .. py:attribute:: GROUP
      :value: 0


      A private group, members-only and non-anonymous, eg a family group.



   .. py:attribute:: CHANNEL
      :value: 1


      A public group, aka an anonymous channel.



   .. py:attribute:: CHANNEL_NON_ANONYMOUS
      :value: 2


      A public group where participants' legacy IDs are visible to everybody.



.. py:class:: LinkPreview

   Bases: :py:obj:`NamedTuple`


   Embedded metadata from :xep:`0511`.

   See <https://ogp.me/>_.


   .. py:attribute:: about
      :type:  str

      URL of the link.



   .. py:attribute:: title
      :type:  str | None

      Title of the linked page.



   .. py:attribute:: description
      :type:  str | None

      A description of the page.



   .. py:attribute:: url
      :type:  str | None

      The canonical URL of the link.



   .. py:attribute:: image
      :type:  str | pathlib.Path | bytes | None

      An image representing the link. If it is a string, it should represent a URL to an image.



   .. py:attribute:: type
      :type:  str | None

      Type of the link destination.



   .. py:attribute:: site_name
      :type:  str | None

      Name of the web site.



.. py:class:: UserPreferences

   Bases: :py:obj:`TypedDict`


   dict() -> new empty dictionary
   dict(mapping) -> new dictionary initialized from a mapping object's
       (key, value) pairs
   dict(iterable) -> new dictionary initialized as if via:
       d = {}
       for k, v in iterable:
           d[k] = v
   dict(**kwargs) -> new dictionary initialized with the name=value pairs
       in the keyword argument list.  For example:  dict(one=1, two=2)


