public GoogleTokenVerificationService( GoogleClient googleClient, IGoogleConfig googleConfig) { this.googleClient = googleClient; this.googleConfig = googleConfig; }
public GoogleCalendarService(IGoogleConfig config) { service = new CalendarService(new BaseClientService.Initializer() { HttpClientInitializer = config.Auth.Authorize(googleUser: config.GoogleUser), ApplicationName = ApplicationName, }); var calendars = service.CalendarList.List().Execute().Items; Log.Info("List of google calendars:"); Log.Indent++; foreach (CalendarListEntry entry in calendars) { Log.Info(entry.Summary + " - " + entry.Id); if (entry.Summary.ToLower().Contains(config.CalendarName.ToLower())) { calendarId = entry.Id; Log.Indent++; Log.Info("We'll use this one!"); Log.Indent--; } } Log.Indent--; if (string.IsNullOrWhiteSpace(calendarId)) { throw new ArgumentException("The google account has no calendar that matches the required name."); } }