aboutsummaryrefslogtreecommitdiff
blob: ba3ee61e8f300d7d8a2feec80ad2c4618f4971f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# conversations.py - conversation endpoints

from .versions import _DICT_VERSION_CONVERSATION
from .utility import api_version

from .internals import Mastodon as Internals

class Mastodon(Internals):    
    ###
    # Reading data: Conversations
    ###
    @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION)
    def conversations(self, max_id=None, min_id=None, since_id=None, limit=None):
        """
        Fetches a user's conversations.

        Returns a list of :ref:`conversation dicts <conversation dicts>`.
        """
        if max_id is not None:
            max_id = self.__unpack_id(max_id, dateconv=True)

        if min_id is not None:
            min_id = self.__unpack_id(min_id, dateconv=True)

        if since_id is not None:
            since_id = self.__unpack_id(since_id, dateconv=True)

        params = self.__generate_params(locals())
        return self.__api_request('GET', "/api/v1/conversations/", params)

    ###
    # Writing data: Conversations
    ###
    @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION)
    def conversations_read(self, id):
        """
        Marks a single conversation as read.

        Returns the updated :ref:`conversation dict <conversation dict>`.
        """
        id = self.__unpack_id(id)
        url = '/api/v1/conversations/{0}/read'.format(str(id))
        return self.__api_request('POST', url)
Powered by cgit v1.2.3 (git 2.41.0)