Permalink
Browse files

added a function to get time entries

  • Loading branch information...
RC7502 committed Feb 21, 2014
1 parent 2d28fde commit d317e370ed007b8ca3ac0f24511a2d5162420bd0
Showing with 25 additions and 0 deletions.
  1. +1 −0 TogglApi/Constants.cs
  2. +24 −0 TogglApi/Entities/Users.cs
View
@@ -11,6 +11,7 @@ public class Constants
public class Urls
{
public const string API_URL = "https://www.toggl.com/api/v8";
public const string TIMEENTRIES_URL = API_URL + "/time_entries?";
public const string ME = API_URL + "/me";
public const string ME_DETAILED = ME + "?with_related_data=true";
public const string ME_CLIENTS = API_URL + "/clients";
View
@@ -57,6 +57,30 @@ public User GetCurrentDetailed()
return resp.Data.data;
}
public List<TimeEntry> GetAllTimeEntries(DateTime start, DateTime end)
{
try
{
var startdate = "start_date=" + start.ToString("o");
var enddate = "end_date=" + end.ToString("o");
var client = new RestClient(Constants.Urls.TIMEENTRIES_URL + startdate + "&" + enddate);
var request = new RestRequest(Method.GET);
request.AddTogglAuth(_auth);
var resp = client.Execute<List<TimeEntry>>(request);
var content = resp.Content;
return resp.Data;
}
catch(Exception ex)
{
}
return new List<TimeEntry>();
}
/// <summary>
///
/// </summary>

0 comments on commit d317e37

Please sign in to comment.