jhonderson / actual-http-api

Basic Actual Budget API exposed through HTTP endpoints
MIT License
40 stars 9 forks source link

Add endpoint for getting account balance #10

Closed shaymdev closed 5 months ago

shaymdev commented 5 months ago

It's likely that an integrating application would want to display account balances.

This pull request adds a new endpoint that, given an account id, returns an account balance.

The query used was taken from ActualBudgets source

jhonderson commented 5 months ago

Thanks for contributing to the project.

Although I haven’t tested this change, everything looks good to me. The only thing I am not sure about it’s what happen when the account balance is 0, looking at the code it looks like it will throw an error, which wouldn’t be ok.

Did you have a chance to test this new endpoint locally ? If so feel free to add few curl commands and results for few scenarios, and I am happy to merge. Otherwise I will test and merge on the weekend.

Thanks again

jhonderson commented 5 months ago

Tested locally and everything works, thanks!

shaymdev commented 5 months ago

Thanks for following up on that! I had wanted to get back to doing some of the more formal testing myself but we were out of town for the week and you beat me to it!