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

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

.. autoapi-nested-parse::

   Typing stuff



Attributes
----------

.. autoapisummary::

   slidge.util.types.LegacyGroupIdType


Classes
-------

.. autoapisummary::

   slidge.util.types.MessageReference
   slidge.util.types.LegacyAttachment
   slidge.util.types.MucType
   slidge.util.types.LinkPreview
   slidge.util.types.UserPreferences


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

.. py:data:: LegacyGroupIdType

   Type of the unique identifier for groups, usually a str or an int,
   but anything hashable should work.


.. 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:: disposition
      :type:  AttachmentDisposition | 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



   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



   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



   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)


