added calls for fetching instance data, status cards, filing reports, and updating the user profile
This commit is contained in:
pare
a67b27c3c2
commit
911fcc733c
|
@ -213,6 +213,17 @@ class Mastodon:
|
||||||
|
|
||||||
return response['access_token']
|
return response['access_token']
|
||||||
|
|
||||||
|
###
|
||||||
|
# Reading data: Instance
|
||||||
|
###
|
||||||
|
def instance(self):
|
||||||
|
"""
|
||||||
|
Retrieve basic information about the instance, including the URI and administrative contact email.
|
||||||
|
|
||||||
|
Returns a dict.
|
||||||
|
"""
|
||||||
|
return self.__api_request('GET', '/api/v1/instance/')
|
||||||
|
|
||||||
###
|
###
|
||||||
# Reading data: Timelines
|
# Reading data: Timelines
|
||||||
##
|
##
|
||||||
|
@ -277,6 +288,14 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
return self.__api_request('GET', '/api/v1/statuses/' + str(id))
|
return self.__api_request('GET', '/api/v1/statuses/' + str(id))
|
||||||
|
|
||||||
|
def status_card(self, id):
|
||||||
|
"""
|
||||||
|
Fetch a card associated with a status.
|
||||||
|
|
||||||
|
Returns a card dict.
|
||||||
|
"""
|
||||||
|
return self.__api_request('GET', '/api/v1/statuses/' + str(id) + '/card')
|
||||||
|
|
||||||
def status_context(self, id):
|
def status_context(self, id):
|
||||||
"""
|
"""
|
||||||
Fetch information about ancestors and descendants of a toot.
|
Fetch information about ancestors and descendants of a toot.
|
||||||
|
@ -392,7 +411,6 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
params = self.__generate_params(locals())
|
params = self.__generate_params(locals())
|
||||||
return self.__api_request('GET', '/api/v1/accounts/search', params)
|
return self.__api_request('GET', '/api/v1/accounts/search', params)
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Reading data: Searching
|
# Reading data: Searching
|
||||||
|
@ -426,6 +444,17 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
return self.__api_request('GET', '/api/v1/blocks')
|
return self.__api_request('GET', '/api/v1/blocks')
|
||||||
|
|
||||||
|
###
|
||||||
|
# Reading data: Reports
|
||||||
|
###
|
||||||
|
def reports(self):
|
||||||
|
"""
|
||||||
|
Fetch a list of reports made by the authenticated user.
|
||||||
|
|
||||||
|
Returns a list of report dicts.
|
||||||
|
"""
|
||||||
|
return self.__api_request('GET', '/api/v1/reports')
|
||||||
|
|
||||||
###
|
###
|
||||||
# Reading data: Favourites
|
# Reading data: Favourites
|
||||||
###
|
###
|
||||||
|
@ -611,6 +640,31 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
|
return self.__api_request('POST', '/api/v1/accounts/' + str(id) + "/unmute")
|
||||||
|
|
||||||
|
def account_update_credentials(self, display_name = None, note = None, avatar = None, header = None):
|
||||||
|
"""
|
||||||
|
Update the profile for the currently authenticated user.
|
||||||
|
|
||||||
|
'note' is the user's bio.
|
||||||
|
|
||||||
|
'avatar' and 'header' are PNG images encoded in base64.
|
||||||
|
"""
|
||||||
|
params = self.__generate_params(locals())
|
||||||
|
return self.__api_request('POST', '/api/v1/accounts/update_credentials', params)
|
||||||
|
|
||||||
|
###
|
||||||
|
# Writing data: Reports
|
||||||
|
###
|
||||||
|
def report(self, id, toots, comment):
|
||||||
|
"""
|
||||||
|
Report a user to the admin.
|
||||||
|
|
||||||
|
Accepts a list of toot IDs associated with the report, and a comment.
|
||||||
|
|
||||||
|
Returns a report dict.
|
||||||
|
"""
|
||||||
|
params = self.__generate_params(locals())
|
||||||
|
return self.__api_request('POST', '/api/v1/reports/', params)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Writing data: Follow requests
|
# Writing data: Follow requests
|
||||||
###
|
###
|
||||||
|
|
Loading…
Referencia en una nova incidència