haydenull / logseq-plugin-agenda

A calendar, task manager and daily planner plugin for logseq
https://agenda.haydenhayden.com
MIT License
841 stars 44 forks source link

Integration with other Task Managers (Vikunja) #180

Open krillin666 opened 1 year ago

krillin666 commented 1 year ago

Hi @haydenull,

This plugin is one of the must useful ones in Logseq, specially after adding support for Caldav calendar sources ! However, because of privacy reasons, I've switched from Todoist to Vikunja (https://vikunja.io/), made by @kolaente, some months ago.

I've been missing deeply the two-way sync of Todoist-Logseq tasks your plugin offers.

I wanted to ask if it is possible and how hard would it be, to port the Todoist sync to Vikunja. The Vikunja API (https://try.vikunja.io/api/v1/docs) is one of the most comprehensive I've seen and besides that, Vikunja supports start dates for tasks which would offer a more natural sync than Todoist.

Thank you!

latetedemelon commented 1 year ago

I agree. Logseq is awesome for coming up with tasks and tracking their relationship to a narrative. But getting them done with other priorities needs a separate tool. Vikunja is a great fit.

krillin666 commented 1 year ago

This should be quite easy since there's an extremely complete cli client for Vikunja now, made by @cernst72 called vja (https://gitlab.com/ce72/vja) which is available as an pip package. Maybe with pyodide we could hook it to the Agenda plugin ? 😁

latetedemelon commented 1 year ago

Hey @krillin666,

Re: https://github.com/krillin666/logseq-plugin-vikunja

I probably don't have the skill to help you but I can take a look / test if that helps at all. Thanks for taking a crack at this.

Cheers

krillin666 commented 1 year ago

Hey @krillin666,

Re: krillin666/logseq-plugin-vikunja

I probably don't have the skill to help you but I can take a look / test if that helps at all. Thanks for taking a crack at this.

Cheers

Hi, I've nothing working for now. I'm getting help from @cernst72 in adapting is cli app (vja) into working more as an python library. If that works ok, my next steps are learning the basics of typescript and then using python in typescript through pyodide. I'm a noob outside python, so if someone wants to help along the way it would be great. My idea is to adapt https://github.com/haydenull/logseq-plugin-agenda/blob/dcf15cfa9b6b0e1b50091869355ea5caa6f20d9a/src/helper/todoist.ts to vja library commands

latetedemelon commented 1 year ago

Is it worthwhile to generate a TS client for the Vikunja Rest API? It would be a little bit of work but it may make integration easier for this plugin.

kolaente commented 1 year ago

You could generate a client with the swagger declaration which the Vikunja api provides.

Since Vikunja itself uses typescript as well in the frontend to communicate with the api, you might be able to re-use that part.

krillin666 commented 1 year ago

@latetedemelon @kolaente That is a very good idea, however I don't think I can do that for now because I only know how to code python. So I would have to take some time to learn TS and swagger.

In the meantime, I've talked to @cernst72 about using https://gitlab.com/ce72/vja through Pyodide, but it seems vja is really more geared towards being a cli rather than a python library. This would be easier if Logseq plugins permitted running cli commands. I think the best I can do for now is trying to make a simpler python client to make the call for the Vikunja API and then use it through Pyodide and adapt https://github.com/haydenull/logseq-plugin-agenda/blob/dcf15cfa9b6b0e1b50091869355ea5caa6f20d9a/src/helper/todoist.ts to work with it. In the meantime, if someone wants to help to make a wrapper directly in TS, it would be the best I think :smile:

krillin666 commented 1 year ago

As suggested by @cernst72, we could use Axios to make the curl calls to Vikunja API, directly in typescript

cernst72 commented 1 year ago

I agree with kolaente. Calling a python application in the browser to wrap essentially a single API call does not sound very straightforward. Even if it might work, it introduces a lot of additional dependencies (python, pyodide, vja) to your stack.

latetedemelon commented 1 year ago

Very raw first crack at this; note to everyone I don't know what I'm doing here. Any contributions welcome. As of yet untested.

https://github.com/latetedemelon/vikunja-api-typescript

krillin666 commented 1 year ago

@kolaente couldn't this function (https://kolaente.dev/vikunja/frontend/src/commit/3643ffe0d0357c89cb3517fafbb0c438188ac88d/src/stores/tasks.ts#L370) be reused to work with https://github.com/haydenull/logseq-plugin-agenda/blob/dcf15cfa9b6b0e1b50091869355ea5caa6f20d9a/src/helper/todoist.ts ? You even use Axios 😅

kolaente commented 1 year ago

@krillin666 It probably could, yes. You could try to copy the services and models from the frontend over. They should (theoretically) work in other places as well. If you only need a few endpoints, that's probably overkill though.