jason0x43 / alfred-toggl

Alfred Workflow for interacting with the Toggl time tracking service
MIT License
367 stars 16 forks source link

Migration to API v9 #66

Closed s7anley closed 3 months ago

s7anley commented 3 months ago

Hey 👋

Adjusting the workflow with the updated go-toggl. I pick the easiest way, so I can build it and test it locally. There might be some helper methods to handle pointers to the project IDs some better way. Let me know, what you think.

Unrelated formating changes are due to the gofmt and golines.

Opening as draft only, until https://github.com/jason0x43/go-toggl/pull/17#pullrequestreview-2065126552 is merged.

s7anley commented 3 months ago

Note for users who want to test it now I prepared a separate branch in my fork for testing, which you could build and start testing locally. You just need to install or build https://github.com/jason0x43/go-alfred.

E.g.

../go-alfred/alfred/alfred build
../go-alfred/alfred/alfred pack
delbao commented 3 months ago

Thanks for the fix. When I tried to build with it. I got these errors. any fixes?

$ go build
# github.com/jason0x43/alfred-toggl
./project.go:52:39: cache.Account.Projects undefined (type toggl.Account has no field or method Projects)
./project.go:75:41: invalid operation: runningTimer.Pid != nil (mismatched types int and untyped nil)
./project.go:75:49: invalid operation: cannot indirect runningTimer.Pid (variable of type int)
./project.go:163:27: cache.Account.Workspaces undefined (type toggl.Account has no field or method Workspaces)
./project.go:167:49: cache.Account.Projects undefined (type toggl.Account has no field or method Projects)
./project.go:185:26: adata.Projects undefined (type *toggl.Account has no field or method Projects)
./project.go:187:10: adata.Projects undefined (type *toggl.Account has no field or method Projects)
./project.go:253:60: invalid operation: project.Billable != nil (mismatched types bool and untyped nil)
./project.go:259:20: invalid operation: cannot indirect project.Billable (variable of type bool)
./project.go:270:21: invalid operation: cannot indirect project.Billable (variable of type bool)
./project.go:270:21: too many errors
s7anley commented 3 months ago

Hey @delbao, that is expected. As I wrote in the description, this PR was just a draft without dependency change, because it was not yet merged.

I just updated the PR, so it should be possible to build it.

s7anley commented 3 months ago

Hey @jason0x43, this is ready for review. I have been using it for over a week and I didn't find a broken user flow.