Mercurial > code > home > repos > gcalendarwatch
view calsync/gcalclient/event_requests.go @ 70:06f3aa9d461c
page size
author | drewp@bigasterisk.com |
---|---|
date | Fri, 06 Sep 2024 17:30:27 -0700 |
parents | 8aee4f5c4bdd |
children |
line wrap: on
line source
package gcalclient import ( "time" "google.golang.org/api/calendar/v3" ) const pageSize = 200 const notificationsUrl1 = "https://bigasterisk.com" const notificationsUrl2 = "/gcalendarwatch/notifications" func rangedEventsCall(srv *calendar.Service, calGoogleId string, initialFillStart, initialFillEnd time.Time, pageToken string) *calendar.EventsListCall { return srv.Events.List(calGoogleId). ShowDeleted(false). SingleEvents(true). TimeMin(initialFillStart.Format(time.RFC3339)). TimeMax(initialFillEnd.Format(time.RFC3339)). MaxResults(pageSize). PageToken(pageToken) } func syncEventsCall(srv *calendar.Service, calGoogleId string, syncToken, pageToken string) *calendar.EventsListCall { return srv.Events.List(calGoogleId). ShowDeleted(true). SingleEvents(true). MaxResults(pageSize). PageToken(pageToken). SyncToken(syncToken) } func watchEventsCall(srv *calendar.Service, calGoogleId string, expire time.Duration, watchId string) *calendar.EventsWatchCall { return srv.Events.Watch(calGoogleId, &calendar.Channel{ Address: notificationsUrl1 + notificationsUrl2, Expiration: (time.Now().Add(expire)).UnixMilli(), Id: watchId, Type: "web_hook", }) }