finished creating second level todos in todoist as checklists in habitica

This commit is contained in:
2020-04-10 23:02:02 -04:00
parent 49275681fd
commit 0aaf15a89d
9 changed files with 125 additions and 59 deletions

View File

@@ -21,7 +21,7 @@ namespace Habitica.Todoist.Integration.Function.Sync
[Singleton("SyncLock", SingletonScope.Host)]
[FunctionName("ScheduledSyncFunction")]
public static async Task Run([TimerTrigger("* * * * * *")]TimerInfo myTimer, ILogger log)
public static async Task Run([TimerTrigger("0 */30 * * * *")]TimerInfo myTimer, ILogger log)
{
// initialize integration services
var todoistService = new TodoistIntegrationService(ScheduledConfiguration.TodoistApiKey,
@@ -33,14 +33,13 @@ namespace Habitica.Todoist.Integration.Function.Sync
ScheduledConfiguration.GiosUserId);
// get all changed items from todoist
var items = await todoistService.ReadItemChanges();
// perform actions
await habiticaService.Add(items.WhereAdded());
await habiticaService.UpdateTasks(items.WhereUpdated());
await habiticaService.CompleteTasks(items.WhereCompleted());
await habiticaService.DeleteTasks(items.WhereDeleted());
await habiticaService.Update(items.WhereUpdated());
await habiticaService.Complete(items.WhereCompleted());
await habiticaService.Delete(items.WhereDeleted());
// commit read changes
await todoistService.CommitRead();