Skip to content

Instantly share code, notes, and snippets.

@nleiva
Created September 14, 2020 15:26
Show Gist options
  • Save nleiva/3837be0b775e86177db119db1e2f8e80 to your computer and use it in GitHub Desktop.
Save nleiva/3837be0b775e86177db119db1e2f8e80 to your computer and use it in GitHub Desktop.
func isItBusy(min string) (bool, error) {
...
// max -> min.Add(1 * time.Hour)
max, err := maxTime(min)
// ...
srv, err := calendar.New(client)
// ...
freebusyRequest := calendar.FreeBusyRequest{
TimeMin: min,
TimeMax: max,
Items: []*calendar.FreeBusyRequestItem{&cal},
}
// ...
freebusyRequestResponse, err := freebusyRequestCall.Do()
// ...
if len(freebusyRequestResponse.Calendars[name].Busy) == 0 {
return false, nil
}
return true, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment