1"""Provide the ReplyableMixin class."""
2from ....const import API_PATH
3
4
5class ReplyableMixin(object):
6    """Interface for RedditBase classes that can be replied to."""
7
8    def reply(self, body):
9        """Reply to the object.
10
11        :param body: The markdown formatted content for a comment.
12        :returns: A :class:`~.Comment` object for the newly created comment.
13
14        Example usage:
15
16        .. code:: python
17
18           submission = reddit.submission(id='5or86n')
19           submission.reply('reply')
20
21           comment = reddit.comment(id='dxolpyc')
22           comment.reply('reply')
23
24        """
25        data = {"text": body, "thing_id": self.fullname}
26        return self._reddit.post(API_PATH["comment"], data=data)[0]
27