private async Task UpdateClickupTaskInTodoist(Clickup.Task clickupTask, Todoist.Task todoistTask) { if (clickupTask.Status.Type == "closed") { await _todoistRepository.CompleteTask(todoistTask); return; } var updatedContent = FormatTodoistContent(clickupTask); if ( updatedContent == todoistTask.Content && clickupTask.DueDate == todoistTask.Due?.Date.UpdateTimeZone(_todoistRepository.TodoistTimeZone) ) { return; } await _todoistRepository.UpdateTask( todoistTask, updatedContent, dueDatetime : null ); }
public async Task UpdateTask( Todoist.Task task, string content = null, List <long> labelIds = null, string dueDate = null, DateTimeOffset?dueDatetime = null) { var json = JsonConvert.SerializeObject(new TaskPostBody { Content = content, LabelIds = labelIds, DueDate = dueDate, DueDatetime = dueDatetime, }); var postContent = new StringContent(json, Encoding.UTF8, "application/json"); await _client.PostAsync($"tasks/{task.Id}", postContent); }
public string GetClickupIdFromTodoistTask(Todoist.Task task) { return(GetClickupIdFromTodoistContent(task.Content)); }
public async Task CompleteTask(Todoist.Task task) { await _client.PostAsync($"tasks/{task.Id}/close", null); }
public async Task DeleteTask(Todoist.Task task) { await _client.DeleteAsync($"tasks/{task.Id}"); }