public async Task Export(TagActivity[] unfilteredTagActivities, DateRange range) { var tags = GetTags(unfilteredTagActivities); var workLogs = GetWorkLogs() .ToList(); var me = await _client.GetMe(); foreach (var tagActivity in tags) { var createWorkLogRequest = ConstructCreateWorkLogRequest(tagActivity, me.User.Id); var existingDuplicateWorkLogs = FindDuplicateExistingWorkLogs(workLogs, tagActivity) .ToList(); var existingConflictWorkLog = await FirstOrDefaultDeleteRemaining(existingDuplicateWorkLogs); // Remove handled WorkLogs from list workLogs = workLogs .Where(log => existingDuplicateWorkLogs.Contains(log) == false) .ToList(); await CreateIdempotent(existingConflictWorkLog, createWorkLogRequest); } foreach (var item in workLogs) { await _client.DeleteWorkLog(item.Id); } }
public async Task <List <TagSourceItem> > GetTagsAsync() { Me me = await _timeTrackingClient.GetMe(); IEnumerable <TagSourceItem> billableTags = await GetBillableTagsAsync(me); IEnumerable <TagSourceItem> nonBillableTags = await GetNonBillableTagsAsync(me); return(billableTags .Concat(nonBillableTags) .ToList()); }
private static async Task TimeTracker(string timeTrackerToken) { var client = new TimeTrackingClient(timeTrackerToken, "https://<organizationName>.timehub.7pace.com/api/rest/"); var me = await client.GetMe(); var items = await client.GetWorkLogs(DateTime.Now.AddDays(-7), DateTime.Now); var createRequest = new CreateWorkLogRequest(DateTime.UtcNow, 500, null, "TimeTracker API Test", me.User.Id, "00000000-0000-0000-0000-000000000000"); // var created = await client.CreateWorkLog(createRequest); // await client.DeleteWorkLog(created.Id); }