コード例 #1
0
        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
                );
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 public string GetClickupIdFromTodoistTask(Todoist.Task task)
 {
     return(GetClickupIdFromTodoistContent(task.Content));
 }
コード例 #4
0
 public async Task CompleteTask(Todoist.Task task)
 {
     await _client.PostAsync($"tasks/{task.Id}/close", null);
 }
コード例 #5
0
 public async Task DeleteTask(Todoist.Task task)
 {
     await _client.DeleteAsync($"tasks/{task.Id}");
 }