Accomedate all endpoints that can be paginated with iter_mode and if needed, iter_key
This commit is contained in:
parent
0fa9b631c1
commit
10317bac23
1 changed files with 30 additions and 1 deletions
|
|
@ -123,6 +123,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('statuses/retweeters/ids', params=params)
|
return self.get('statuses/retweeters/ids', params=params)
|
||||||
|
get_retweeters_ids.iter_mode = 'cursor'
|
||||||
|
get_retweeters_ids.iter_key = 'ids'
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
def search(self, **params):
|
def search(self, **params):
|
||||||
|
|
@ -144,6 +146,7 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('direct_messages', params=params)
|
return self.get('direct_messages', params=params)
|
||||||
|
get_direct_messages.iter_mode = 'id'
|
||||||
|
|
||||||
def get_sent_messages(self, **params):
|
def get_sent_messages(self, **params):
|
||||||
"""Returns the 20 most recent direct messages sent by the authenticating user.
|
"""Returns the 20 most recent direct messages sent by the authenticating user.
|
||||||
|
|
@ -152,6 +155,7 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('direct_messages/sent', params=params)
|
return self.get('direct_messages/sent', params=params)
|
||||||
|
get_sent_messages.iter_mode = 'id'
|
||||||
|
|
||||||
def get_direct_message(self, **params):
|
def get_direct_message(self, **params):
|
||||||
"""Returns a single direct message, specified by an id parameter.
|
"""Returns a single direct message, specified by an id parameter.
|
||||||
|
|
@ -195,6 +199,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('friends/ids', params=params)
|
return self.get('friends/ids', params=params)
|
||||||
|
get_friends_ids.iter_mode = 'cursor'
|
||||||
|
get_friends_ids.iter_key = 'ids'
|
||||||
|
|
||||||
def get_followers_ids(self, **params):
|
def get_followers_ids(self, **params):
|
||||||
"""Returns a cursored collection of user IDs for every user
|
"""Returns a cursored collection of user IDs for every user
|
||||||
|
|
@ -204,6 +210,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('followers/ids', params=params)
|
return self.get('followers/ids', params=params)
|
||||||
|
get_followers_ids.iter_mode = 'cursor'
|
||||||
|
get_followers_ids.iter_key = 'ids'
|
||||||
|
|
||||||
def lookup_friendships(self, **params):
|
def lookup_friendships(self, **params):
|
||||||
"""Returns the relationships of the authenticating user to the
|
"""Returns the relationships of the authenticating user to the
|
||||||
|
|
@ -222,6 +230,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('friendships/incoming', params=params)
|
return self.get('friendships/incoming', params=params)
|
||||||
|
get_incoming_friendship_ids.iter_mode = 'cursor'
|
||||||
|
get_incoming_friendship_ids.iter_key = 'ids'
|
||||||
|
|
||||||
def get_outgoing_friendship_ids(self, **params):
|
def get_outgoing_friendship_ids(self, **params):
|
||||||
"""Returns a collection of numeric IDs for every protected user for
|
"""Returns a collection of numeric IDs for every protected user for
|
||||||
|
|
@ -231,6 +241,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('friendships/outgoing', params=params)
|
return self.get('friendships/outgoing', params=params)
|
||||||
|
get_outgoing_friendship_ids.iter_mode = 'cursor'
|
||||||
|
get_outgoing_friendship_ids.iter_key = 'ids'
|
||||||
|
|
||||||
def create_friendship(self, **params):
|
def create_friendship(self, **params):
|
||||||
"""Allows the authenticating users to follow the user specified
|
"""Allows the authenticating users to follow the user specified
|
||||||
|
|
@ -276,7 +288,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('friends/list', params=params)
|
return self.get('friends/list', params=params)
|
||||||
get_friends_list.iterator_mode = 'cursor'
|
get_friends_list.iter_mode = 'cursor'
|
||||||
|
get_friends_list.iter_key = 'users'
|
||||||
|
|
||||||
def get_followers_list(self, **params):
|
def get_followers_list(self, **params):
|
||||||
"""Returns a cursored collection of user objects for users
|
"""Returns a cursored collection of user objects for users
|
||||||
|
|
@ -286,6 +299,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('followers/list', params=params)
|
return self.get('followers/list', params=params)
|
||||||
|
get_followers_list.iter_mode = 'cursor'
|
||||||
|
get_followers_list.iter_key = 'users'
|
||||||
|
|
||||||
# Users
|
# Users
|
||||||
def get_account_settings(self, **params):
|
def get_account_settings(self, **params):
|
||||||
|
|
@ -363,6 +378,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('blocks/list', params=params)
|
return self.get('blocks/list', params=params)
|
||||||
|
list_blocks.iter_mode = 'cursor'
|
||||||
|
list_blocks.iter_key = 'users'
|
||||||
|
|
||||||
def list_block_ids(self, **params):
|
def list_block_ids(self, **params):
|
||||||
"""Returns an array of numeric user ids the authenticating user is blocking.
|
"""Returns an array of numeric user ids the authenticating user is blocking.
|
||||||
|
|
@ -371,6 +388,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('blocks/ids', params=params)
|
return self.get('blocks/ids', params=params)
|
||||||
|
list_block_ids.iter_mode = 'cursor'
|
||||||
|
list_block_ids.iter_key = 'ids'
|
||||||
|
|
||||||
def create_block(self, **params):
|
def create_block(self, **params):
|
||||||
"""Blocks the specified user from following the authenticating user.
|
"""Blocks the specified user from following the authenticating user.
|
||||||
|
|
@ -489,6 +508,7 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('favorites/list', params=params)
|
return self.get('favorites/list', params=params)
|
||||||
|
get_favorites.iter_mode = 'id'
|
||||||
|
|
||||||
def destroy_favorite(self, **params):
|
def destroy_favorite(self, **params):
|
||||||
"""Un-favorites the status specified in the ID parameter as the authenticating user.
|
"""Un-favorites the status specified in the ID parameter as the authenticating user.
|
||||||
|
|
@ -522,6 +542,7 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('lists/statuses', params=params)
|
return self.get('lists/statuses', params=params)
|
||||||
|
get_list_statuses.iter_mode = 'id'
|
||||||
|
|
||||||
def delete_list_member(self, **params):
|
def delete_list_member(self, **params):
|
||||||
"""Removes the specified member from the list.
|
"""Removes the specified member from the list.
|
||||||
|
|
@ -538,6 +559,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('lists/subscribers', params=params)
|
return self.get('lists/subscribers', params=params)
|
||||||
|
get_list_subscribers.iter_mode = 'cursor'
|
||||||
|
get_list_subscribers.iter_key = 'users'
|
||||||
|
|
||||||
def subscribe_to_list(self, **params):
|
def subscribe_to_list(self, **params):
|
||||||
"""Subscribes the authenticated user to the specified list.
|
"""Subscribes the authenticated user to the specified list.
|
||||||
|
|
@ -587,6 +610,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('lists/members', params=params)
|
return self.get('lists/members', params=params)
|
||||||
|
get_list_members.iter_mode = 'cursor'
|
||||||
|
get_list_members.iter_key = 'users'
|
||||||
|
|
||||||
def add_list_member(self, **params):
|
def add_list_member(self, **params):
|
||||||
"""Add a member to a list.
|
"""Add a member to a list.
|
||||||
|
|
@ -635,6 +660,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('lists/subscriptions', params=params)
|
return self.get('lists/subscriptions', params=params)
|
||||||
|
get_list_subscriptions.iter_mode = 'cursor'
|
||||||
|
get_list_subscriptions.iter_key = 'lists'
|
||||||
|
|
||||||
def delete_list_members(self, **params):
|
def delete_list_members(self, **params):
|
||||||
"""Removes multiple members from a list, by specifying a
|
"""Removes multiple members from a list, by specifying a
|
||||||
|
|
@ -652,6 +679,8 @@ class EndpointsMixin(object):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.get('lists/ownerships', params=params)
|
return self.get('lists/ownerships', params=params)
|
||||||
|
show_owned_lists.iter_mode = 'cursor'
|
||||||
|
show_owned_lists.iter_key = 'lists'
|
||||||
|
|
||||||
# Saved Searches
|
# Saved Searches
|
||||||
def get_saved_searches(self, **params):
|
def get_saved_searches(self, **params):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue