1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

YAML config added. App refreshInterval as first value

This commit is contained in:
Chris Cummer
2018-04-03 17:54:52 -07:00
committed by Chris Cummer
parent 22a9f7b194
commit 39cf8c6e1c
3 changed files with 10 additions and 11 deletions

View File

@@ -101,27 +101,23 @@ func Fetch() (*calendar.Events, error) {
b, err := ioutil.ReadFile("./gcal/client_secret.json")
if err != nil {
//log.Fatalf("Unable to read client secret file: %v", err)
return nil, err
}
config, err := google.ConfigFromJSON(b, calendar.CalendarReadonlyScope)
if err != nil {
//log.Fatalf("Unable to parse client secret file to config: %v", err)
return nil, err
}
client := getClient(ctx, config)
srv, err := calendar.New(client)
if err != nil {
//log.Fatalf("Unable to retrieve calendar Client %v", err)
return nil, err
}
t := today().Format(time.RFC3339)
events, err := srv.Events.List("primary").ShowDeleted(false).SingleEvents(true).TimeMin(t).MaxResults(10).OrderBy("startTime").Do()
if err != nil {
//log.Fatalf("Unable to retrieve next ten of the user's events. %v", err)
return nil, err
}