예제 #1
0
        /// <summary>
        ///
        /// https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md#get-time-entries-started-in-a-specific-time-range
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public List <TimeEntry> List(QueryObjects.TimeEntryParams obj)
        {
            var entries = ToggleSrv.Get(ApiRoutes.TimeEntry.TimeEntriesUrl, obj.GetParameters())
                          .GetData <List <TimeEntry> >();

            if (obj.ProjectId.HasValue)
            {
                entries = entries.Where(w => w.ProjectId == obj.ProjectId).ToList();
            }

            return(entries.Select(s => s).ToList());
        }
예제 #2
0
        /// <summary>
        ///
        /// https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md#get-time-entries-started-in-a-specific-time-range
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task <List <TimeEntry> > List(QueryObjects.TimeEntryParams obj)
        {
            var response = await ToggleSrv.Get(ApiRoutes.TimeEntry.TimeEntriesUrl, obj.GetParameters());

            var entries = response
                          .GetData <List <TimeEntry> >()
                          .AsQueryable();

            if (obj.ProjectId.HasValue)
            {
                entries = entries.Where(w => w.ProjectId == obj.ProjectId);
            }

            return(entries.Select(s => s).ToList());
        }
예제 #3
0
        /// <summary>
        /// List time entries
        /// https://github.com/toggl/toggl_api_docs/blob/master/chapters/time_entries.md#get-time-entries-started-in-a-specific-time-range
        /// </summary>
        /// <param name="obj"></param>
        public async Task <List <TimeEntry> > GetAllAsync(QueryObjects.TimeEntryParams obj)
        {
            var response = await TogglSrv.GetAsync(ApiRoutes.TimeEntry.TimeEntriesUrl, obj.GetParameters()).ConfigureAwait(false);

            var entries = response
                          .GetData <List <TimeEntry> >()
                          .AsQueryable();

            if (obj.ProjectId.HasValue)
            {
                entries = entries.Where(w => w.ProjectId == obj.ProjectId);
            }

            return(entries.Select(s => s).ToList());
        }