diff options
Diffstat (limited to 'mastodon/conversations.py')
-rw-r--r-- | mastodon/conversations.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mastodon/conversations.py b/mastodon/conversations.py new file mode 100644 index 0000000..ba3ee61 --- /dev/null +++ b/mastodon/conversations.py | |||
@@ -0,0 +1,43 @@ | |||
1 | # conversations.py - conversation endpoints | ||
2 | |||
3 | from .versions import _DICT_VERSION_CONVERSATION | ||
4 | from .utility import api_version | ||
5 | |||
6 | from .internals import Mastodon as Internals | ||
7 | |||
8 | class Mastodon(Internals): | ||
9 | ### | ||
10 | # Reading data: Conversations | ||
11 | ### | ||
12 | @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION) | ||
13 | def conversations(self, max_id=None, min_id=None, since_id=None, limit=None): | ||
14 | """ | ||
15 | Fetches a user's conversations. | ||
16 | |||
17 | Returns a list of :ref:`conversation dicts <conversation dicts>`. | ||
18 | """ | ||
19 | if max_id is not None: | ||
20 | max_id = self.__unpack_id(max_id, dateconv=True) | ||
21 | |||
22 | if min_id is not None: | ||
23 | min_id = self.__unpack_id(min_id, dateconv=True) | ||
24 | |||
25 | if since_id is not None: | ||
26 | since_id = self.__unpack_id(since_id, dateconv=True) | ||
27 | |||
28 | params = self.__generate_params(locals()) | ||
29 | return self.__api_request('GET', "/api/v1/conversations/", params) | ||
30 | |||
31 | ### | ||
32 | # Writing data: Conversations | ||
33 | ### | ||
34 | @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION) | ||
35 | def conversations_read(self, id): | ||
36 | """ | ||
37 | Marks a single conversation as read. | ||
38 | |||
39 | Returns the updated :ref:`conversation dict <conversation dict>`. | ||
40 | """ | ||
41 | id = self.__unpack_id(id) | ||
42 | url = '/api/v1/conversations/{0}/read'.format(str(id)) | ||
43 | return self.__api_request('POST', url) | ||