jhonderson / actual-http-api

Basic Actual Budget API exposed through HTTP endpoints
MIT License
37 stars 8 forks source link

Future Capabilities #19

Open culpeppers opened 1 month ago

culpeppers commented 1 month ago

First off, I can't thank you enough for creating this. I've been using it extensively on a project I've been working on the past few months.

Something I wanted to ask about is what, if any, capabilities could be added. I know you rely on what Actual exposes in its API for the current capabilities, but is it possible to tap into more of actual functionality outside of their API? Budget sync as an example, or other types of features.

If so, I would be happy to contribute where I can. Thanks!

jhonderson commented 1 month ago

Hello, glad this has been helpful for you. The functionality of this project is limited by what the nodejs api can do. If new features can be built on top of that functionality (such as https://github.com/jhonderson/actual-http-api/pull/10), they are welcome.

Can you explain the budget sync feature?

culpeppers commented 1 month ago

Sorry "budget sync" was not a good term. What I meant was, being able to use a web socket, or something similar, to receive updates as they happen based on the native server implementation, instead of having to poll.

jhonderson commented 1 month ago

For the example you mention, AFAIK actual http api server has no way to know the changes happening in the actual server, all it sees is a bunch of changes in protobuf format (see how budget sync works here https://github.com/bvanelli/actualpy?tab=readme-ov-file#understanding-how-actual-handles-changes).

So we would have to implement some kind of observer interceptor in this project, to recollect any change happening in actual-http-api server, and vend those as events to the websocket, but this approach would miss any change happening outside the http server. So I doubt that would be very useful.

Regardless, I am happy to check PRs, or specific proposals for this project to extend functionality, hopefully aiming for them to be useful to everyone using it.

culpeppers commented 1 month ago

That all makes sense, thanks. Sounds like I am thinking about this the wrong way, and need to adjust based on how Actual's sync works.

Though I am still a bit confused on how to observe or be notified of any changes, even after reading the actualpy doc. How would a client request to be notified of the delta changes being made?

jhonderson commented 1 month ago

Hey, sorry for the late reply. I don’t think there is a way for clients to be aware of delta changes using actual-nodejs-api. Even if we add support for it within actual-http-api, any changes made outside the http api wouldn’t be caught