This commit is contained in:
2020-04-09 21:11:01 -04:00
parent 74f3a621ca
commit 49275681fd
10 changed files with 112 additions and 25 deletions

View File

@@ -9,8 +9,25 @@ namespace Habitica.Todoist.Integration.Services.Extensions
{
public static class Extensions
{
public static ChecklistItem ToHabiticaChecklistItem(this Item item, string habiticaId = null)
{
if (string.IsNullOrEmpty(item.Parent_Id))
return null;
var checklistItem = new ChecklistItem
{
Id = habiticaId,
Text = item.Content
};
return checklistItem;
}
public static Task ToHabiticaTask(this Item item, string habiticaId = null)
{
if (!string.IsNullOrEmpty(item.Parent_Id))
return null;
var taskTypeStr = Enum.GetName(typeof(TaskType), TaskType.Todo).ToLower();
var task = new Task
{