view calsync/gcalclient/event_requests.go @ 57:24f662799710

WIP incremental sync now runs
author drewp@bigasterisk.com
date Thu, 05 Sep 2024 15:03:05 -0700
parents 635ff76f867c
children 8aee4f5c4bdd
line wrap: on
line source

package gcalclient

import (
	"time"

	"google.golang.org/api/calendar/v3"
)

const pageSize = 20

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)
}