aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/index.rst90
1 files changed, 89 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst
index a91cfb7..a9ecf49 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -81,7 +81,19 @@ Reading data: Statuses
81These functions allow you to get information about single statuses. 81These functions allow you to get information about single statuses.
82 82
83.. automethod:: Mastodon.status 83.. automethod:: Mastodon.status
84
85Returns a single toot dict for the given status.
86
84.. automethod:: Mastodon.status_context 87.. automethod:: Mastodon.status_context
88
89.. code-block:: python
90 mastodon.status_context(<numerical id>)
91 # Returns
92 {
93 'descendants': A list of toot dicts
94 'ancestors': A list of toot dicts
95 }
96
85.. automethod:: Mastodon.status_reblogged_by 97.. automethod:: Mastodon.status_reblogged_by
86.. automethod:: Mastodon.status_favourited_by 98.. automethod:: Mastodon.status_favourited_by
87 99
@@ -91,6 +103,8 @@ This function allows you to get information about a users notifications.
91 103
92.. automethod:: Mastodon.notifications 104.. automethod:: Mastodon.notifications
93 105
106Returns a list of toot dicts for toots mentioning the current logged-in user.
107
94 108
95Reading data: Accounts 109Reading data: Accounts
96---------------------- 110----------------------
@@ -99,13 +113,37 @@ their relationships.
99 113
100.. automethod:: Mastodon.account 114.. automethod:: Mastodon.account
101.. automethod:: Mastodon.account_verify_credentials 115.. automethod:: Mastodon.account_verify_credentials
116
117These methods return an account dict:
118.. code-block:: python
119 mastodon.account(<numerical id>)
120 # Returns
121 {
122 'display_name': The user's display name
123 'acct': The user's account name as username@domain (@domain omitted for local users)
124 'following_count': How many people they follow
125 'url': Their URL; usually 'https://mastodon.social/users/<acct>'
126 'statuses_count': How many statuses they have
127 'followers_count': How many followers they have
128 'avatar': URL for their avatar
129 'note': Their bio
130 'header': URL for their header image
131 'id': Same as <numerical id>
132 'username': The username (what you @ them with)
133 }
134
102.. automethod:: Mastodon.account_statuses 135.. automethod:: Mastodon.account_statuses
103.. automethod:: Mastodon.account_following 136.. automethod:: Mastodon.account_following
104.. automethod:: Mastodon.account_followers 137.. automethod:: Mastodon.account_followers
105.. automethod:: Mastodon.account_relationships 138.. automethod:: Mastodon.account_relationships
139
140See following below for format of relationship dicts.
141
106.. automethod:: Mastodon.account_suggestions 142.. automethod:: Mastodon.account_suggestions
107.. automethod:: Mastodon.account_search 143.. automethod:: Mastodon.account_search
108 144
145Returns a list of user dicts.
146
109Writing data: Statuses 147Writing data: Statuses
110---------------------- 148----------------------
111These functions allow you to post statuses to Mastodon and to 149These functions allow you to post statuses to Mastodon and to
@@ -113,17 +151,56 @@ interact with already posted statuses.
113 151
114.. automethod:: Mastodon.status_post 152.. automethod:: Mastodon.status_post
115.. automethod:: Mastodon.toot 153.. automethod:: Mastodon.toot
116.. automethod:: Mastodon.status_delete
117.. automethod:: Mastodon.status_reblog 154.. automethod:: Mastodon.status_reblog
118.. automethod:: Mastodon.status_unreblog 155.. automethod:: Mastodon.status_unreblog
119.. automethod:: Mastodon.status_favourite 156.. automethod:: Mastodon.status_favourite
120.. automethod:: Mastodon.status_unfavourite 157.. automethod:: Mastodon.status_unfavourite
121 158
159These methods return a toot dict:
160.. code-block:: python
161 mastodon.toot("Hello from Python")
162 # Returns the following dictionary:
163 {
164 'sensitive': Denotes whether the toot is marked sensitive
165 'created_at': Creation time
166 'mentions': A list of account dicts mentioned in the toot
167 'uri': Descriptor for the toot
168 EG 'tag:mastodon.social,2016-11-25:objectId=<id>:objectType=Status'
169 'tags': A list of hashtag dicts used in the toot
170 'in_reply_to_id': Numerical id of the toot this toot is in response to
171 'id': Numerical id of this toot
172 'reblogs_count': Number of reblogs
173 'favourites_count': Number of favourites
174 'reblog': Denotes whether the toot is a reblog
175 'url': URL of the toot
176 'content': Content of the toot, as HTML: '<p>Hello from Python</p>'
177 'favourited': Denotes whether the logged in user has favourited this toot
178 'account': Account dict for the logged in account
179 }
180
181.. automethod:: Mastodon.status_delete
182Returns an empty dict:
183.. code-block:: python
184 mastodon.delete_status(<numerical id>)
185 # Returns
186 {}
187
122Writing data: Accounts 188Writing data: Accounts
123---------------------- 189----------------------
124These functions allow you to interact with other accounts: To (un)follow and 190These functions allow you to interact with other accounts: To (un)follow and
125(un)block. 191(un)block.
126 192
193They return a relationship dict:
194.. code-block:: python
195 mastodon.account_follow(<numerical id>)
196 # Returns
197 {
198 'followed_by': Boolean denoting whether they follow you back
199 'following': Boolean denoting whether you follow them
200 'id': Numerical id (same one as <numerical id>)
201 'blocking': Boolean denoting whether you are blocking them
202 }
203
127.. automethod:: Mastodon.account_follow 204.. automethod:: Mastodon.account_follow
128.. automethod:: Mastodon.account_unfollow 205.. automethod:: Mastodon.account_unfollow
129.. automethod:: Mastodon.account_block 206.. automethod:: Mastodon.account_block
@@ -137,6 +214,17 @@ to attach media to statuses.
137 214
138.. automethod:: Mastodon.media_post 215.. automethod:: Mastodon.media_post
139 216
217Returns a media dict:
218.. code-block:: python
219 mastodon.media_post("image.jpg", "image/jpeg")
220 # Returns
221 {
222 'text_url': The display text for the media (what shows up in toots)
223 'preview_url': The URL for the media preview
224 'type': Media type, EG 'image'
225 'url': The URL for the media
226 }
227
140.. _Mastodon: https://github.com/Gargron/mastodon 228.. _Mastodon: https://github.com/Gargron/mastodon
141.. _Mastodon flagship instance: http://mastodon.social/ 229.. _Mastodon flagship instance: http://mastodon.social/
142.. _Mastodon api docs: https://github.com/Gargron/mastodon/wiki/API 230.. _Mastodon api docs: https://github.com/Gargron/mastodon/wiki/API
Powered by cgit v1.2.3 (git 2.41.0)