def lists_memberships(self): """ List lists which user was added :return: list of :class:`~responsebot.models.List` objects """ return [List(tweepy_list_to_json(list)) for list in self._client.lists_memberships()]
def lists_subscriptions(self): """ List lists which user followed :return: list of :class:`~responsebot.models.List` objects """ return [List(tweepy_list_to_json(list)) for list in self._client.lists_subscriptions()]
def lists(self): """ List user's lists :return: list of :class:`~responsebot.models.List` objects """ return [List(tweepy_list_to_json(list)) for list in self._client.lists_all()]
def unsubscribe_list(self, list_id): """ Unsubscribe to a list :param list_id: list ID number :return: :class:`~responsebot.models.List` object """ return List(tweepy_list_to_json(self._client.unsubscribe_list(list_id=list_id)))
def get_list(self, list_id): """ Get info of specified list :param list_id: list ID number :return: :class:`~responsebot.models.List` object """ return List(tweepy_list_to_json(self._client.get_list(list_id=list_id)))
def remove_list_member(self, list_id, user_id): """ Remove a user from a list :param list_id: list ID number :param user_id: user ID number :return: :class:`~responsebot.models.List` object """ return List(tweepy_list_to_json(self._client.remove_list_member(list_id=list_id, user_id=user_id)))
def add_list_member(self, list_id, user_id): """ Add a user to list :param list_id: list ID number :param user_id: user ID number :return: :class:`~responsebot.models.List` object """ return List(tweepy_list_to_json(self._client.add_list_member(list_id=list_id, user_id=user_id)))
def destroy_list(self, list_id): """ Destroy a list :param list_id: list ID number :return: The destroyed list object :rtype: :class:`~responsebot.models.List` """ return List(tweepy_list_to_json(self._client.destroy_list(list_id=list_id)))
def create_list(self, name, mode='public', description=None): """ Create a list :param name: Name of the new list :param mode: :code:`'public'` (default) or :code:`'private'` :param description: Description of the new list :return: The new list object :rtype: :class:`~responsebot.models.List` """ return List(tweepy_list_to_json(self._client.create_list(name=name, mode=mode, description=description)))
def update_list(self, list_id, name=None, mode=None, description=None): """ Update a list :param list_id: list ID number :param name: New name for the list :param mode: :code:`'public'` (default) or :code:`'private'` :param description: New description of the list :return: The updated list object :rtype: :class:`~responsebot.models.List` """ return List(tweepy_list_to_json( self._client.update_list(list_id=list_id, name=name, mode=mode, description=description)) )
def test_parse_list(self): created_at = 'Mon Apr 25 08:25:58 +0000 2016' raw = { 'some_key': 'some value', 'created_at': created_at, 'user': { 'screen_name': 'some_one' } } expected_created_at = parse(created_at) list = List(raw) self.assertEqual(list.some_key, 'some value') self.assertEqual(list.created_at, expected_created_at) self.assertTrue(isinstance(list.user, User)) self.assertEqual(list.user.screen_name, 'some_one')