def setUp(self): self.m_manager = mock.Mock() self.m_endpoint = mock.Mock() pages = [ [mock.Mock(id='foo'), mock.Mock(id='bar')], [mock.Mock(id='baz'), mock.Mock(id='qux')], ] self.m_endpoint.side_effect = pages self.messages = pagers.MessageList(self.m_manager, self.m_endpoint)
def list(self, before_id=None, since_id=None, **kwargs): """Return a page of direct messages. The messages come in reversed order (newest first). Note you can only provide _one_ of ``before_id``, ``since_id``. :param str before_id: message ID for paging backwards :param str since_id: message ID for most recent messages since :return: direct messages :rtype: :class:`~groupy.pagers.MessageList` """ return pagers.MessageList(self, self._raw_list, before_id=before_id, since_id=since_id, **kwargs)
def list(self, before_id=None, since_id=None, after_id=None, limit=20): """Return a page of group messages. The messages come in reversed order (newest first). Note you can only provide _one_ of ``before_id``, ``since_id``, or ``after_id``. :param str before_id: message ID for paging backwards :param str after_id: message ID for paging forwards :param str since_id: message ID for most recent messages since :param int limit: maximum number of messages per page :return: group messages :rtype: :class:`~groupy.pagers.MessageList` """ return pagers.MessageList(self, self._raw_list, before_id=before_id, after_id=after_id, since_id=since_id, limit=limit)