public ResourceRequestFactory(GoogleServiceCredentials creds, string[] resourceServiceScopes, string[] calendarServiceScopes, int resourceServicePoolSize, int calendarServicePoolSize)
        {
            this.directoryServicePool = new BaseClientServicePool <DirectoryService>(resourceServicePoolSize, () =>
            {
                DirectoryService x = new DirectoryService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer           = new ServiceAccountCredential(creds.GetInitializer(resourceServiceScopes)),
                    ApplicationName                 = "LithnetGoogleAppsLibrary",
                    GZipEnabled                     = !Settings.DisableGzip,
                    Serializer                      = new GoogleJsonSerializer(),
                    DefaultExponentialBackOffPolicy = ExponentialBackOffPolicy.None,
                });

                x.HttpClient.Timeout = Timeout.InfiniteTimeSpan;
                return(x);
            });

            this.calendarServicePool = new BaseClientServicePool <CalendarService>(calendarServicePoolSize, () =>
            {
                CalendarService x = new CalendarService(
                    new BaseClientService.Initializer()
                {
                    HttpClientInitializer           = new ServiceAccountCredential(creds.GetInitializer(calendarServiceScopes)),
                    ApplicationName                 = "LithnetGoogleAppsLibrary",
                    GZipEnabled                     = !Settings.DisableGzip,
                    Serializer                      = new GoogleJsonSerializer(),
                    DefaultExponentialBackOffPolicy = ExponentialBackOffPolicy.None,
                });

                x.HttpClient.Timeout = Timeout.InfiniteTimeSpan;
                return(x);
            });
        }
        public UserRequestFactory(GoogleServiceCredentials creds, string[] scopes, int poolSize)
        {
            this.directoryServicePool = new BaseClientServicePool <DirectoryService>(poolSize, () =>
            {
                DirectoryService x = new DirectoryService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer           = new ServiceAccountCredential(creds.GetInitializer(scopes)),
                    ApplicationName                 = "LithnetGoogleAppsLibrary",
                    GZipEnabled                     = !Settings.DisableGzip,
                    Serializer                      = new GoogleJsonSerializer(),
                    DefaultExponentialBackOffPolicy = ExponentialBackOffPolicy.None,
                });

                x.HttpClient.Timeout = Settings.DefaultTimeout;
                return(x);
            });
        }
예제 #3
0
 internal CourseStudentRequestFactory(BaseClientServicePool <ClassroomService> classroomServicePool)
 {
     this.classRoomServicePool = classroomServicePool;
     RateLimiter.SetConcurrentLimit(CourseStudentRequestFactory.limiterName, CourseStudentRequestFactory.ConcurrentOperationLimitDefault);
 }
예제 #4
0
 internal GroupMemberRequestFactory(BaseClientServicePool <DirectoryService> directoryServicePool)
 {
     this.directoryServicePool = directoryServicePool;
     RateLimiter.SetConcurrentLimit(GroupMemberRequestFactory.limiterName, GroupMemberRequestFactory.ConcurrentOperationLimitDefault);
 }