Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to incrementally sync without keeping process running #14

Closed
rcodesmith opened this issue Mar 26, 2021 · 4 comments
Closed

Way to incrementally sync without keeping process running #14

rcodesmith opened this issue Mar 26, 2021 · 4 comments

Comments

@rcodesmith
Copy link

I want to use the incremental sync feature of the todoist API.
It looks like this library support you calling sync() multiple times on the same Todoist object, each time getting only the data that changed.

I'd like to use incremental sync in a serverless function (e.g. lambda function) where no state (no Todoist object) is being saved between calls to sync(). Is this supported?

@romgrk
Copy link
Owner

romgrk commented Mar 26, 2021

In a stateless environment, it would fetch all the data each time, just as when you call .sync() initially. This is supported. Consider using .sync(resourceType: string[]) with resourceType being the data you're interested in to reduce your bandwidth usage, refer to todoist's documentation for more details.

Closing to keep issues low & clean, but please ask if you have more questions.

@romgrk romgrk closed this as completed Mar 26, 2021
@rcodesmith
Copy link
Author

Thanks for the info. Is there a way for me to save the sync_token, and pass it into the library so I only get newly updated entities? I can't really save an instance of the api per todoist account to sync with, but I can definetely save the sync_token per todoist account I want to sync with.

@romgrk
Copy link
Owner

romgrk commented Apr 5, 2021

I have added accessors for you to get and set the syncToken. They have been published in 0.5.0 at the moment. I'm not going to document them at the moment because I haven't tested anything and am not sure of the implications of setting the syncToken directly, but as far as I understand the API this should allow for your use case. Let me know if there is anything more that can be done, and don't hesitate to open a PR if you want to improve things.

@rcodesmith
Copy link
Author

Great! I'll try it out and report back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants