diff calsync/gcalclient/gcalclient.go @ 61:8aee4f5c4bdd

receive notifications and route them to calendar sync functions
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 16:43:14 -0700
parents 3b0595c2bf03
children 0f09464d4974
line wrap: on
line diff
--- a/calsync/gcalclient/gcalclient.go	Fri Sep 06 16:41:48 2024 -0700
+++ b/calsync/gcalclient/gcalclient.go	Fri Sep 06 16:43:14 2024 -0700
@@ -12,7 +12,9 @@
 	"log"
 	"net/url"
 	"strings"
+	"time"
 
+	"bigasterisk.com/go/gcalendarwatch/mongoclienttypes"
 	"google.golang.org/api/calendar/v3"
 )
 
@@ -80,3 +82,8 @@
 	}
 	return fmt.Sprintf("%x", md5.Sum([]byte(pageToken)))
 }
+
+func (gc *GCalClient) WatchEvents(cal *mongoclienttypes.MongoCal, watchId string, expire time.Duration) error {
+	_, err := watchEventsCall(gc.srv, cal.GoogleId, expire, watchId).Do()
+	return err
+}