def list_time_entries(self, ticket_id=None): url = "tickets/time_entries" if ticket_id is not None: url = "tickets/%d/time_entries" % ticket_id timeEntries = [] for r in self._api._get(url): timeEntries.append(TimeEntry(**r)) return timeEntries
def list_time_entries(self, ticket_id=None, **kwargs): url = "time_entries?" if ticket_id is not None: url = "tickets/%d/time_entries?" % ticket_id page = kwargs.get("page", 1) per_page = kwargs.get("per_page", 100) time_entries = [] # Skip pagination by looping over each page and adding tickets if 'page' key is not in kwargs. # else return the requested page and break the loop while True: this_page = self._api._get(url + 'page={}&per_page={}'.format(page, per_page), kwargs) time_entries += this_page if len(this_page) < per_page or "page" in kwargs: break page += 1 return [TimeEntry(**c) for c in time_entries]