Returns a collection of upto 100 recent messages in the room. Accepts an
 additional optional parameter ‘limit’ to restrict the number of messages
 returned.
555724
def recent_messages(limit = nil, &callback)
      connection.http(:get, "/room/#{id}/recent.json", (limit ? { :limit => limit } : nil)) do |data, http|
        callback.call(data[:messages].map { |msg| Firering::Message.instantiate(connection, msg) }) if callback
      end
    end
310688
async def serviceQueues(self, limit=None) -> int:
        
        return await self._inbox_router.handleAll(self._inbox, limit)
861000
def list(self, limit=None, marker=None):
        
        return self._manager.list(limit=limit, marker=marker)
1249411
@Nonnull
  public Query limit(int limit) {
    QueryOptions newOptions = new QueryOptions(options);
    newOptions.limit = limit;
    return new Query(firestore, path, newOptions);
  }
45816
def consume(self, limit=None):
        """"""
        for total_message_count in count():
            if limit and total_message_count >= limit:
                raise StopIteration
            self.drain_events()
            yield True
550419
def set_sync_limit(self, limit: int) -> Optional[int]:
        
        try:
            prev_limit = json.loads(self.sync_filter)['room']['timeline']['limit']
        except (json.JSONDecodeError, KeyError):
            prev_limit = None
        self.sync_filter = json.dumps({'room': {'timeline': {'limit': limit}}})
        return prev_limit
895458
def next(self):
        
        c = Conversation(self.data, requests.get(self.data["comments"]["paging"]["next"]).json())
        if "error" in c.data["comments"] and c.data["comments"]["error"]["code"] == 613:
            raise LimitExceededException()
        return c
919852
def fetchall(self):
        
        result = r = self.fetchmany(size=self.FETCHALL_BLOCKSIZE)
        while len(r) == self.FETCHALL_BLOCKSIZE or not self._received_last_resultset_part:
            r = self.fetchmany(size=self.FETCHALL_BLOCKSIZE)
            result.extend(r)
        return result
131241
def recv_msg(self):
        ''''''
        if self._index >= self._count:
            return None
        m = self._msgs[self._index]
        self._index += 1
        self.percent = (100.0 * self._index) / self._count
        self.messages[m.get_type()] = m
        return m
382797
def get_limits(self):
        
        if self.limits != {}:
            return self.limits
        limits = {}
        limits.update(self._get_limits_instances())
        limits.update(self._get_limits_networking())
        limits.update(self._get_limits_spot())
        self.limits = limits
        return self.limits
1110816
async def serviceQueues(self, limit=None) -> int:
        
        # do not start any view changes until catch-up is finished!
        if not Mode.is_done_syncing(self.provider.node_mode()):
            return 0
        return await self.inBoxRouter.handleAll(self.inBox, limit)
451463
def get_actions(self, filters, since=None, before=None, limit=1000):
        
        if limit > 1000:
            raise NotImplementedError(
                "Fetching more than 1000 items is not implemented")
        resp = self.stats.session.open(
            "{0}/members/{1}/actions?{2}".format(
                self.stats.url, self.username, urllib.urlencode({
                    "key": self.key,
                    "token": self.token,
                    "filter": filters,
                    "limit": limit,
                    "since": str(since),
                    "before": str(before)})))

        actions = json.loads(resp.read())
        log.data(pretty(actions))
        # print[act for act in actions if "shortLink" not in
        # act['data']['board'].keys()]
        actions = [act for act in actions if act['data']
                   ['board']['id'] in self.board_ids]
        return actions
178762
def limit(self, limit):
        
        if self._limit != limit:
            self.dirty = True
            self._limit = limit
        return self
950055
def get_posts(self, offset=0, limit=1000, order=None, filters=None):
        
        order = self._get_order(order)
        cache_key = self.get_cache_key(offset, limit, order, filters)
        content = cache.get(cache_key)
#        if content:
#            return content
        try:
            if self.up_to_date():
                pass # not time to update yet
            else:
                self.update()
        except:
            raise
            pass # query the database for now and update later
        query = self._get_query(order=order, filters=filters)
        posts = query[int(offset):int(offset)+int(limit)]
        posts = self._format(posts)
        cache_duration = conf.GOSCALE_CACHE_DURATION if posts else 1
        cache.set(cache_key, posts, cache_duration)
        return posts
343795
def gather(self):
        
        if self.state in constants.RECEIVE_STATES:
            raise TypeError("Only new messages can be gathered.")
        if not self._message:
            raise ValueError("Message data already consumed.")
        try:
            raise self._response
        except TypeError:
            pass
        return [self]
353727
def list(self, teamId=None, rType=None, maxResults=C.MAX_RESULT_DEFAULT, limit=C.ALL):
    
    queryParams = {'teamId': teamId,
            'type': rType,
            'max': maxResults}
    queryParams = self.clean_query_Dict(queryParams)
    ret = self.send_request(C.GET, self.end, data=queryParams, limit=limit)
    return [Room(self.token, roomData) for roomData in ret['items']]
174850
def count_unread_messages_for(self, user):
        
        unread_total = self.filter(user=user,
                                   read_at__isnull=True,
                                   deleted_at__isnull=True).count()

        return unread_total