mantelo.internal.serializers
============================

.. py:module:: mantelo.internal.serializers


Classes
-------

.. autoapisummary::

   mantelo.internal.serializers.BaseSerializer
   mantelo.internal.serializers.JsonSerializer


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

.. py:class:: BaseSerializer

   Bases: :py:obj:`abc.ABC`


   Abstract base class for all serializers.


   .. py:property:: content_type
      :type: str | None


      Default content-type for this serializer.



   .. py:property:: supported_content_types
      :type: list[str]

      :abstractmethod:


      Get all the content types this serializer can handle.

      :return: A list of supported content types.
      :rtype: list



   .. py:method:: matches_content_type(content_type: str) -> bool

      Check if the given content type is supported by this serializer.

      :param content_type: The content type to match.
      :return: True if the content type is supported, False otherwise.



   .. py:method:: loads(data: str) -> dict
      :abstractmethod:


      Deserialize a string into a dictionary.

      :param data: The string to deserialize.
      :return: The deserialized dictionary.
      :rtype: dict



   .. py:method:: dumps(data: dict) -> str
      :abstractmethod:


      Serialize a dictionary into a string.

      :param data: The dictionary to serialize.
      :return: The serialized string.
      :rtype: str



.. py:class:: JsonSerializer

   Bases: :py:obj:`BaseSerializer`


   A serializer for JSON data.


   .. py:property:: supported_content_types
      :type: list[str]


      Get all the content types this serializer can handle.

      :return: A list of supported content types.
      :rtype: list



   .. py:method:: loads(data: str) -> dict

      Deserialize a string into a dictionary.

      :param data: The string to deserialize.
      :return: The deserialized dictionary.
      :rtype: dict



   .. py:method:: dumps(data: dict) -> str

      Serialize a dictionary into a string.

      :param data: The dictionary to serialize.
      :return: The serialized string.
      :rtype: str



