using Habitica.Todoist.Integration.Data; using Habitica.Todoist.Integration.Model.Storage; using Habitica.Todoist.Integration.Model.Todoist; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Habitica.Todoist.Integration.Services { public static class TodoistExtensions { public static IEnumerable WhereAdded(this List items, TableStorageClient storageClient, string userId) { return items .Where(x => !storageClient .Exists(userId, x.Id) && x.Is_deleted == 0); } public static IEnumerable WhereUpdated(this List items, TableStorageClient storageClient, string userId) { return items .Where(x => storageClient .Exists(userId, x.Id) && x.Is_deleted == 0 && x.Date_completed == null); } public static IEnumerable WhereCompleted(this List items, TableStorageClient storageClient, string userId) { return items .Where(x => storageClient .Exists(userId, x.Id) && x.Is_deleted == 0 && x.Date_completed != null); } public static IEnumerable WhereDeleted(this List items, TableStorageClient storageClient, string userId) { return items .Where(x => storageClient .Exists(userId, x.Id) && x.Is_deleted == 1); } } }