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

GCal events_list(): return all events, not just first 250 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrisnovakovic
Copy link

The Google Calendar API v3 limits the number of events returned by the "Events: list" endpoint to 250 by default, and API::Google::GCal provides no means of overriding this behaviour. This commit makes two changes to API::Google::GCal's events_list() method so that it returns all events in the requested calendar:

  • Iterate over all pages of the event result list by using the nextPageToken property in each API response as the value of the pageToken parameter in the next API request.
  • Set the maxResults query parameter to its maximum permitted value under the v3 API (2500), to minimise the number of API requests that must be made to iterate over all of the result pages.

The Google Calendar API v3 limits the number of events returned by the
"Events: list" endpoint to 250 by default, and API::Google::GCal
provides no means of overriding this behaviour. This commit makes two
changes to API::Google::GCal's events_list() method so that it returns
all events in the requested calendar:

* Iterate over all pages of the event result list by using the
  nextPageToken property in each API response as the value of the
  pageToken parameter in the next API request.

* Set the maxResults query parameter to its maximum permitted value
  under the v3 API (2500), to minimise the number of API requests that
  must be made to iterate over all of the result pages.
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

Successfully merging this pull request may close these issues.

1 participant