def get_timesheet_by_ticket(self, ticket_id): url = 'helpdesk/tickets/%s/time_sheets.json' % ticket_id l = [] timesheet_data = self._api._get(url) i = 0 while (i < len(timesheet_data)): l.append(TimeEntry(**timesheet_data[i]['time_entry'])) i = i + 1 return l
def get_all_timesheets(self, **kwargs): url = 'helpdesk/time_sheets.json' if "filter_name" in kwargs.keys() and "filter_value" in kwargs.keys(): url = url + "?{}={}".format(kwargs["filter_name"], kwargs["filter_value"]) l = [] timesheet_data = self._api._get(url) i = 0 while (i < len(timesheet_data)): l.append(TimeEntry(**timesheet_data[i]['time_entry'])) i = i + 1 return l