Update: Todoist Integration

In the last blog post, I gave a brief idea as to how Todoist plugin is structured to work and I talked about my work related to loading Todoist tasks inside GNOME To Do. After modifying the previous work and making some improvements, the code has finally been pushed to master. I also worked on implementing functions that will save any changes made to Todoist tasks or lists. The Todoist Api allows applications to send an HTTP Post requests for adding/deleting tasks/lists. To Do makes uses of the Todoist Api v7 and sends HTTP response for fetching and storing the changes.

static void
gtd_provider_todoist_remove_task (GtdProvider *provider,
                                  GtdTask *task)
{
 GtdProviderTodoist *self;
 JsonObject *params;
 g_autofree gchar *command;
 g_autofree gchar *command_uuid;

 self = GTD_PROVIDER_TODOIST (provider);
 command = command_uuid = NULL;

if (!self->access_token)
 {
  emit_access_token_error ();
  return;
 }

 params = json_object_new ();

 command_uuid = g_uuid_string_random ();
 command = g_strdup_printf ("[{\"type\": \"item_delete\", \"uuid\": \"%s\", "
                            "\"args\": {\"ids\": [%s]}}]",
                            command_uuid,
                            gtd_object_get_uid (GTD_OBJECT (task)));

 json_object_set_string_member (params, "token", self->access_token);
 json_object_set_string_member (params, "commands", command);

 post (params, (RestProxyCallAsyncCallback) post_generic_cb, self);
}

The above snippet is to remove a task-list. Other function that work as editing the changes to Todoist, have similar implementation. They send param such as “token” and “command” and make use of post method to send an HTTP Post request. The post method use librest to make a call to Todoist sync endpoint.

What has been completed?

  1. GNOME To Do can load Todoist tasks and lists. So now, users can view their Todoist tasks inside To Do.
  2. Not just view, but one can also modify the tasks and lists and these changes will get saved to user Todoist account.
  3. Deleting tasks and list is also possible now. Although, deleting list won’t work because of a bug in GOA which doesn’t provide correct access rights to Todoist Account.

What is to be done?

  1. We cannot create a todoist task or list from GNOME To Do currently. This will be covered by next week.
  2. To Do cannot sync tasks and lists from Todoist automatically. This is currently in progress and hopefully will be completed by next 2 weeks.
  3. After completing the above tasks, I will work on limiting the number of post requests made by To Do so that we do not exceed the Todoist limit of 50 per minute.

A small video demonstrating the above Changes:

Do checkout the work and feel free to open bugs on bugzilla if you encounter them . Any suggestion for improvement is most welcomed. Don’t forget to drop a mail if you have Todoist specific features suggestions i.e Productivity Graph that can be implemented in GNOME To Do.

4 thoughts on “Update: Todoist Integration

    1. We can add ability to hide lists. Infact, there is a bug opened for this. Todoist api doesn’t allow reading selective lists, so I believe having a option to hide lists is best solution.

      Like

      1. Perhaps it would be better if user can select lists from preference like evolution does with google calendar/Owncloud. Let ToDo read all list but ignore everything during sync except those lists selected by user.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s