diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.rst | 98 |
1 files changed, 70 insertions, 28 deletions
diff --git a/docs/index.rst b/docs/index.rst index 87e6fb5..80687de 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -88,18 +88,18 @@ User dicts | |||
88 | mastodon.account(<numerical id>) | 88 | mastodon.account(<numerical id>) |
89 | # Returns the following dictionary: | 89 | # Returns the following dictionary: |
90 | { | 90 | { |
91 | 'display_name': # The user's display name | 91 | 'id': # Same as <numerical id> |
92 | 'username': # The username (what you @ them with) | ||
92 | 'acct': # The user's account name as username@domain (@domain omitted for local users) | 93 | 'acct': # The user's account name as username@domain (@domain omitted for local users) |
94 | 'display_name': # The user's display name | ||
95 | 'locked': # Denotes whether the account can be followed without a follow request | ||
93 | 'following_count': # How many people they follow | 96 | 'following_count': # How many people they follow |
94 | 'url': # Their URL; usually 'https://mastodon.social/users/<acct>' | ||
95 | 'statuses_count': # How many statuses they have | ||
96 | 'followers_count': # How many followers they have | 97 | 'followers_count': # How many followers they have |
97 | 'avatar': # URL for their avatar | 98 | 'statuses_count': # How many statuses they have |
98 | 'note': # Their bio | 99 | 'note': # Their bio |
100 | 'url': # Their URL; usually 'https://mastodon.social/users/<acct>' | ||
101 | 'avatar': # URL for their avatar | ||
99 | 'header': # URL for their header image | 102 | 'header': # URL for their header image |
100 | 'id': # Same as <numerical id> | ||
101 | 'username': # The username (what you @ them with) | ||
102 | 'locked': # Denotes whether the account can be followed without a follow request | ||
103 | } | 103 | } |
104 | 104 | ||
105 | Toot dicts | 105 | Toot dicts |
@@ -109,24 +109,28 @@ Toot dicts | |||
109 | mastodon.toot("Hello from Python") | 109 | mastodon.toot("Hello from Python") |
110 | # Returns the following dictionary: | 110 | # Returns the following dictionary: |
111 | { | 111 | { |
112 | 'sensitive': # Denotes whether media attachments to the toot are marked sensitive | 112 | 'id': # Numerical id of this toot |
113 | 'created_at': # Creation time | ||
114 | 'mentions': # A list of account dicts mentioned in the toot | ||
115 | 'uri': # Descriptor for the toot | 113 | 'uri': # Descriptor for the toot |
116 | # EG 'tag:mastodon.social,2016-11-25:objectId=<id>:objectType=Status' | 114 | # EG 'tag:mastodon.social,2016-11-25:objectId=<id>:objectType=Status' |
117 | 'tags': # A list of hashtag dicts used in the toot | 115 | 'url': # URL of the toot |
116 | 'account': # Account dict for the account which posted the status | ||
118 | 'in_reply_to_id': # Numerical id of the toot this toot is in response to | 117 | 'in_reply_to_id': # Numerical id of the toot this toot is in response to |
119 | 'media_attachments': # list of media dicts of attached files. Only present | 118 | 'in_reply_to_account_id': # Numerical id of the account this toot is in response to |
120 | # when there are attached files. | ||
121 | 'id': # Numerical id of this toot | ||
122 | 'reblogs_count': # Number of reblogs | ||
123 | 'favourites_count': # Number of favourites | ||
124 | 'reblog': # Denotes whether the toot is a reblog | 119 | 'reblog': # Denotes whether the toot is a reblog |
125 | 'url': # URL of the toot | ||
126 | 'content': # Content of the toot, as HTML: '<p>Hello from Python</p>' | 120 | 'content': # Content of the toot, as HTML: '<p>Hello from Python</p>' |
127 | 'spoiler_text': # Warning text that should be displayed before the toot content | 121 | 'created_at': # Creation time |
122 | 'reblogs_count': # Number of reblogs | ||
123 | 'favourites_count': # Number of favourites | ||
124 | 'reblogged': # Denotes whether the logged in user has boosted this toot | ||
128 | 'favourited': # Denotes whether the logged in user has favourited this toot | 125 | 'favourited': # Denotes whether the logged in user has favourited this toot |
129 | 'account': # Account dict for the logged in account | 126 | 'sensitive': # Denotes whether media attachments to the toot are marked sensitive |
127 | 'spoiler_text': # Warning text that should be displayed before the toot content | ||
128 | 'visibility': # Toot visibility ('public', 'unlisted', 'private', or 'direct') | ||
129 | 'mentions': # A list of account dicts mentioned in the toot | ||
130 | 'media_attachments': # list of media dicts of attached files. Only present | ||
131 | # when there are attached files. | ||
132 | 'tags': # A list of hashtag dicts used in the toot | ||
133 | 'application': # Application dict for the client used to post the toot | ||
130 | } | 134 | } |
131 | 135 | ||
132 | Relationship dicts | 136 | Relationship dicts |
@@ -136,9 +140,9 @@ Relationship dicts | |||
136 | mastodon.account_follow(<numerical id>) | 140 | mastodon.account_follow(<numerical id>) |
137 | # Returns the following dictionary: | 141 | # Returns the following dictionary: |
138 | { | 142 | { |
139 | 'followed_by': # Boolean denoting whether they follow you back | ||
140 | 'following': # Boolean denoting whether you follow them | ||
141 | 'id': # Numerical id (same one as <numerical id>) | 143 | 'id': # Numerical id (same one as <numerical id>) |
144 | 'following': # Boolean denoting whether you follow them | ||
145 | 'followed_by': # Boolean denoting whether they follow you back | ||
142 | 'blocking': # Boolean denoting whether you are blocking them | 146 | 'blocking': # Boolean denoting whether you are blocking them |
143 | 'muting': # Boolean denoting whether you are muting them | 147 | 'muting': # Boolean denoting whether you are muting them |
144 | 'requested': # Boolean denoting whether you have sent them a follow request | 148 | 'requested': # Boolean denoting whether you have sent them a follow request |
@@ -153,9 +157,10 @@ Notification dicts | |||
153 | { | 157 | { |
154 | 'id': # id of the notification. | 158 | 'id': # id of the notification. |
155 | 'type': # "mention", "reblog", "favourite" or "follow". | 159 | 'type': # "mention", "reblog", "favourite" or "follow". |
160 | 'created_at': # The time the notification was created. | ||
161 | 'account': # User dict of the user from whom the notification originates. | ||
156 | 'status': # In case of "mention", the mentioning status. | 162 | 'status': # In case of "mention", the mentioning status. |
157 | # In case of reblog / favourite, the reblogged / favourited status. | 163 | # In case of reblog / favourite, the reblogged / favourited status. |
158 | 'account': # User dict of the user from whom the notification originates. | ||
159 | } | 164 | } |
160 | 165 | ||
161 | Context dicts | 166 | Context dicts |
@@ -165,8 +170,8 @@ Context dicts | |||
165 | mastodon.status_context(<numerical id>) | 170 | mastodon.status_context(<numerical id>) |
166 | # Returns the following dictionary: | 171 | # Returns the following dictionary: |
167 | { | 172 | { |
168 | 'descendants': # A list of toot dicts | ||
169 | 'ancestors': # A list of toot dicts | 173 | 'ancestors': # A list of toot dicts |
174 | 'descendants': # A list of toot dicts | ||
170 | } | 175 | } |
171 | 176 | ||
172 | Media dicts | 177 | Media dicts |
@@ -176,10 +181,25 @@ Media dicts | |||
176 | mastodon.media_post("image.jpg", "image/jpeg") | 181 | mastodon.media_post("image.jpg", "image/jpeg") |
177 | # Returns the following dictionary: | 182 | # Returns the following dictionary: |
178 | { | 183 | { |
179 | 'text_url': # The display text for the media (what shows up in toots) | 184 | 'id': # The ID of the attachment. |
180 | 'preview_url': # The URL for the media preview | ||
181 | 'type': # Media type, EG 'image' | 185 | 'type': # Media type, EG 'image' |
182 | 'url': # The URL for the media | 186 | 'url': # The URL for the image in the local cache |
187 | 'remote_url': # The remote URL for the media (if the image is from a remote instance) | ||
188 | 'preview_url': # The URL for the media preview | ||
189 | 'text_url': # The display text for the media (what shows up in toots) | ||
190 | } | ||
191 | |||
192 | Card dicts | ||
193 | ~~~~~~~~~~ | ||
194 | ..code-block:: python | ||
195 | |||
196 | mastodon.status_card(<numerical id>): | ||
197 | # Returns the folowing dictionary | ||
198 | { | ||
199 | 'url': The URL of the card. | ||
200 | 'title': The title of the card. | ||
201 | 'description': The description of the card. | ||
202 | 'image': (optional) The image associated with the card. | ||
183 | } | 203 | } |
184 | 204 | ||
185 | App registration and user authentication | 205 | App registration and user authentication |
@@ -202,6 +222,13 @@ methods for this are provided. | |||
202 | .. automethod:: Mastodon.log_in | 222 | .. automethod:: Mastodon.log_in |
203 | .. automethod:: Mastodon.auth_request_url | 223 | .. automethod:: Mastodon.auth_request_url |
204 | 224 | ||
225 | Reading data: Instance | ||
226 | ----------------------- | ||
227 | This function allows you to fetch information associated with the | ||
228 | current instance. | ||
229 | |||
230 | .. automethod:: Mastodon.instance | ||
231 | |||
205 | Reading data: Timelines | 232 | Reading data: Timelines |
206 | ----------------------- | 233 | ----------------------- |
207 | This function allows you to access the timelines a logged in | 234 | This function allows you to access the timelines a logged in |
@@ -221,6 +248,7 @@ These functions allow you to get information about single statuses. | |||
221 | .. automethod:: Mastodon.status_context | 248 | .. automethod:: Mastodon.status_context |
222 | .. automethod:: Mastodon.status_reblogged_by | 249 | .. automethod:: Mastodon.status_reblogged_by |
223 | .. automethod:: Mastodon.status_favourited_by | 250 | .. automethod:: Mastodon.status_favourited_by |
251 | .. automethod:: Mastodon.status_card | ||
224 | 252 | ||
225 | Reading data: Notifications | 253 | Reading data: Notifications |
226 | --------------------------- | 254 | --------------------------- |
@@ -241,6 +269,11 @@ their relationships. | |||
241 | .. automethod:: Mastodon.account_relationships | 269 | .. automethod:: Mastodon.account_relationships |
242 | .. automethod:: Mastodon.account_search | 270 | .. automethod:: Mastodon.account_search |
243 | 271 | ||
272 | Reading data: Follows | ||
273 | --------------------- | ||
274 | |||
275 | .. automethod:: Mastodon.follows | ||
276 | |||
244 | Reading data: Searching | 277 | Reading data: Searching |
245 | ----------------------- | 278 | ----------------------- |
246 | This function allows you to search for content. | 279 | This function allows you to search for content. |
@@ -256,6 +289,14 @@ muted or blocked by the logged in user. | |||
256 | .. automethod:: Mastodon.mutes | 289 | .. automethod:: Mastodon.mutes |
257 | .. automethod:: Mastodon.blocks | 290 | .. automethod:: Mastodon.blocks |
258 | 291 | ||
292 | Reading data: Reports | ||
293 | ------------------------------ | ||
294 | These functions allow you to retrieve information about reports filed | ||
295 | by the authenticated user, and file a report against a user. | ||
296 | |||
297 | .. automethod:: Mastodon.reports | ||
298 | .. automethod:: Mastodon.report | ||
299 | |||
259 | Reading data: Favourites | 300 | Reading data: Favourites |
260 | ------------------------ | 301 | ------------------------ |
261 | This function allows you to get information about statuses favourited | 302 | This function allows you to get information about statuses favourited |
@@ -295,6 +336,7 @@ These functions allow you to interact with other accounts: To (un)follow and | |||
295 | .. automethod:: Mastodon.account_unblock | 336 | .. automethod:: Mastodon.account_unblock |
296 | .. automethod:: Mastodon.account_mute | 337 | .. automethod:: Mastodon.account_mute |
297 | .. automethod:: Mastodon.account_unmute | 338 | .. automethod:: Mastodon.account_unmute |
339 | .. automethod:: Mastodon.account_update_credentials | ||
298 | 340 | ||
299 | Writing data: Follow requests | 341 | Writing data: Follow requests |
300 | ----------------------------- | 342 | ----------------------------- |
@@ -320,6 +362,6 @@ These functions allow access to the streaming API. | |||
320 | .. automethod:: Mastodon.hashtag_stream | 362 | .. automethod:: Mastodon.hashtag_stream |
321 | 363 | ||
322 | 364 | ||
323 | .. _Mastodon: https://github.com/Gargron/mastodon | 365 | .. _Mastodon: https://github.com/tootsuite/mastodon |
324 | .. _Mastodon flagship instance: http://mastodon.social/ | 366 | .. _Mastodon flagship instance: http://mastodon.social/ |
325 | .. _Mastodon api docs: https://github.com/Gargron/mastodon/wiki/API \ No newline at end of file | 367 | .. _Mastodon api docs: https://github.com/tootsuite/documentation/ |