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