public ICalendarService InitCalendarService(string token, EventSource source)
        {
            if (token == null)
            {
                throw new Exception("API token is null");
            }

            ICalendarService calendarAPI = null;

            switch (source)
            {
            case EventSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token);
                calendarAPI = new MSGraphCalendarAPI(serviceClient);
                break;

            case EventSource.Google:
                var googleClient       = GoogleClient.GetGoogleClient(_settings);
                var googlePeopleClient = GoogleCalendarAPI.GetServiceClient(googleClient, token);
                calendarAPI = new GoogleCalendarAPI(googlePeopleClient);
                break;

            default:
                throw new Exception("Event Type not Defined");
            }

            return(new CalendarService(calendarAPI, source));
        }
        /// <inheritdoc/>
        public IMailService InitMailService(string token, TimeZoneInfo timeZoneInfo, MailSource source)
        {
            switch (source)
            {
            case MailSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token, timeZoneInfo);
                return(new MSGraphMailAPI(serviceClient, timeZoneInfo));

            case MailSource.Google:
                var googleClient        = GoogleClient.GetGoogleClient(_settings);
                var googleServiceClient = GMailService.GetServiceClient(googleClient, token);
                return(new GMailService(googleServiceClient));

            default:
                throw new Exception("Event Type not Defined");
            }
        }
Exemplo n.º 3
0
        public IUserService InitUserService(string token, EventSource source)
        {
            switch (source)
            {
            case EventSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token);
                return(new MSGraphUserService(serviceClient));

            case EventSource.Google:
                var googleClient       = GoogleClient.GetGoogleClient(_skillConfig);
                var googlePeopleClient = GooglePeopleService.GetServiceClient(googleClient, token);
                return(new GooglePeopleService(googlePeopleClient));

            default:
                throw new Exception("Event Type not Defined");
            }
        }
Exemplo n.º 4
0
        public ICalendar InitCalendarService(string token, EventSource source)
        {
            ICalendar calendarAPI = null;

            switch (source)
            {
            case EventSource.Microsoft:

            case EventSource.Google:
                GoogleClient googleClient       = GoogleClient.GetGoogleClient(_skillConfig);
                var          googlePeopleClient = GoogleCalendarAPI.GetServiceClient(googleClient, token);
                calendarAPI = new GoogleCalendarAPI(googlePeopleClient);
                break;

            default:
                throw new Exception("Event Type not Defined");
            }

            return(new CalendarService(calendarAPI, source));
        }
Exemplo n.º 5
0
        public IUserService InitUserService(string token, EventSource source)
        {
            IUserService userService = null;

            switch (source)
            {
            case EventSource.Microsoft:
                var serviceClient = GraphClient.GetAuthenticatedClient(token);
                userService = new MSGraphUserService(serviceClient);
                break;

            case EventSource.Google:
                var googleClient       = GoogleClient.GetGoogleClient(_settings);
                var googlePeopleClient = GooglePeopleService.GetServiceClient(googleClient, token);
                userService = new GooglePeopleService(googlePeopleClient);
                break;

            default:
                throw new Exception("Event Type not Defined");
            }

            return(new UserService(userService));
        }