Added the create, destroy, list and list IDs mute(s) endpoints.
Roughly modelled on the similar-ish block user functions (note: the "mutes/users" instead of just "mutes" appears to be intentional by Twitter). Also added myself to AUTHORS.rst because I reckon adding API bits makes the grade. ;)
This commit is contained in:
parent
134414c87a
commit
123b8f4f74
2 changed files with 41 additions and 0 deletions
|
|
@ -54,3 +54,4 @@ Patches and Suggestions
|
||||||
- `Mertcan Mermerkaya <https://github.com/mmermerkaya>`_, Fixed code example in documentation
|
- `Mertcan Mermerkaya <https://github.com/mmermerkaya>`_, Fixed code example in documentation
|
||||||
- `Donne Martin <https://github.com/donnemartin>`_, Fixed typos in `README.rst`
|
- `Donne Martin <https://github.com/donnemartin>`_, Fixed typos in `README.rst`
|
||||||
- `Diego Allen <https://github.com/dalleng>`_, Add missing comma in documentation code snippet
|
- `Diego Allen <https://github.com/dalleng>`_, Add missing comma in documentation code snippet
|
||||||
|
- `Ben McGinnes <https://github.com/Hasimir>`_, Added mute API endpoints, a couple of examples, random bits.
|
||||||
|
|
|
||||||
|
|
@ -523,6 +523,46 @@ class EndpointsMixin(object):
|
||||||
"""
|
"""
|
||||||
return self.get('users/profile_banner', params=params)
|
return self.get('users/profile_banner', params=params)
|
||||||
|
|
||||||
|
def list_mutes(self, **params):
|
||||||
|
"""Returns a collection of user objects that the authenticating user
|
||||||
|
is muting.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/mutes/users/list
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('mutes/users/list', params=params)
|
||||||
|
list_mutes.iter_mode = 'cursor'
|
||||||
|
list_mutes.iter_key = 'users'
|
||||||
|
|
||||||
|
def list_mute_ids(self, **params):
|
||||||
|
"""Returns an array of numeric user ids the authenticating user
|
||||||
|
is muting.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/get/mutes/users/ids
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.get('mutes/users/ids', params=params)
|
||||||
|
list_mutes_ids.iter_mode = 'cursor'
|
||||||
|
list_mutes_ids.iter_key = 'ids'
|
||||||
|
|
||||||
|
def create_mute(self, **params):
|
||||||
|
"""Mutes the specified user, preventing their tweets appearing
|
||||||
|
in the authenticating user's timeline.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/post/mutes/users/create
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.post('mutes/users/create', params=params)
|
||||||
|
|
||||||
|
def destroy_mute(self, **params):
|
||||||
|
"""Un-mutes the user specified in the user or ID parameter for
|
||||||
|
the authenticating user.
|
||||||
|
|
||||||
|
Docs: https://dev.twitter.com/docs/api/1.1/post/mutes/users/destroy
|
||||||
|
|
||||||
|
"""
|
||||||
|
return self.post('mutes/users/destroy', params=params)
|
||||||
|
|
||||||
# Suggested Users
|
# Suggested Users
|
||||||
def get_user_suggestions_by_slug(self, **params):
|
def get_user_suggestions_by_slug(self, **params):
|
||||||
"""Access the users in a given category of the Twitter suggested user list.
|
"""Access the users in a given category of the Twitter suggested user list.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue