aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-04-28 21:24:31 +0200
committerLorenz Diener <[email protected]>2019-04-28 21:24:31 +0200
commiteb0fa327c4b3b520e243d7b888724512a905347a (patch)
tree871b9777162c2272ca6808ad9ba9794df09c342c /mastodon/Mastodon.py
parentc82b0b19196d5d390419d71e2b45f11ec1c74a05 (diff)
downloadmastodon.py-eb0fa327c4b3b520e243d7b888724512a905347a.tar.gz
Add reblog visibility
Diffstat (limited to 'mastodon/Mastodon.py')
-rw-r--r--mastodon/Mastodon.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index dd710b7..3fe3d21 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1370,8 +1370,7 @@ class Mastodon:
1370 should be marked as sensitive, which hides it by default on the Mastodon 1370 should be marked as sensitive, which hides it by default on the Mastodon
1371 web front-end. 1371 web front-end.
1372 1372
1373 The visibility parameter is a string value and matches the visibility 1373 The visibility parameter is a string value and accepts any of:
1374 option on the /api/v1/status POST API endpoint. It accepts any of:
1375 'direct' - post will be visible only to mentioned users 1374 'direct' - post will be visible only to mentioned users
1376 'private' - post will be visible only to followers 1375 'private' - post will be visible only to followers
1377 'unlisted' - post will be public but not appear on the public timeline 1376 'unlisted' - post will be public but not appear on the public timeline
@@ -1514,15 +1513,26 @@ class Mastodon:
1514 self.__api_request('DELETE', url) 1513 self.__api_request('DELETE', url)
1515 1514
1516 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 1515 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS)
1517 def status_reblog(self, id): 1516 def status_reblog(self, id, visibility=None):
1518 """ 1517 """
1519 Reblog a status. 1518 Reblog / boost a status.
1519
1520 The visibility parameter functions the same as in `status_post()`_ and
1521 allows you to reduce the visibility of a reblogged status.
1520 1522
1521 Returns a `toot dict`_ with a new status that wraps around the reblogged one. 1523 Returns a `toot dict`_ with a new status that wraps around the reblogged one.
1522 """ 1524 """
1525 params = self.__generate_params(locals(), ['id'])
1526 valid_visibilities = ['private', 'public', 'unlisted', 'direct']
1527 if 'visibility' in params:
1528 params['visibility'] = params['visibility'].lower()
1529 if params['visibility'] not in valid_visibilities:
1530 raise ValueError('Invalid visibility value! Acceptable '
1531 'values are %s' % valid_visibilities)
1532
1523 id = self.__unpack_id(id) 1533 id = self.__unpack_id(id)
1524 url = '/api/v1/statuses/{0}/reblog'.format(str(id)) 1534 url = '/api/v1/statuses/{0}/reblog'.format(str(id))
1525 return self.__api_request('POST', url) 1535 return self.__api_request('POST', url, params)
1526 1536
1527 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) 1537 @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS)
1528 def status_unreblog(self, id): 1538 def status_unreblog(self, id):
Powered by cgit v1.2.3 (git 2.41.0)