[calendar] Implement SyncToken for Calendar service
ClosedPublic

Authored by poboiko on Mar 20 2020, 1:43 PM.

Details

Summary

This is an implementation of a syncToken Google API feature (see T8376: [Calendar] Implement support for syncToken, and
https://developers.google.com/calendar/v3/reference/events/list) which is a
native way to perform incremental updates.

When EventFetchJob is created, we can provide it with a token by calling
job->setSyncToken(token), which will be used as a parameter for fetching.
Note: some of the parameters are incompatible with syncToken (timeMin,
timeMax, updatedMin, see API link above), so if token is provided, those
parameters get ignored.

When the job is finished, the next sync token can be obtained via
job->syncToken(). This token then can be used for the next EventFetchJob.

Test Plan
  1. Create an EventFetchJob with no syncToken
  2. When job is finished, fetch its syncToken
  3. Create a new job, using previous syncToken
  4. Only incremental changes are obtained

Diff Detail

Repository
R477 KGAPI Library
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
poboiko created this revision.Mar 20 2020, 1:43 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptMar 20 2020, 1:43 PM
poboiko requested review of this revision.Mar 20 2020, 1:43 PM

Nicely done! One minor nitpick, please fix it before merging.

src/calendar/eventfetchjob.cpp
188

Use d->syncToken.clear()

poboiko updated this revision to Diff 78096.Mar 20 2020, 2:28 PM

Use clear() instead

poboiko marked an inline comment as done.Mar 20 2020, 2:29 PM
This revision was not accepted when it landed; it landed in state Needs Review.Mar 20 2020, 2:30 PM
This revision was automatically updated to reflect the committed changes.