/// <summary>Removes the specified interceptor from the list of execute interceptors.</summary>
 public void RemoveExecuteInterceptor(IHttpExecuteInterceptor interceptor)
 {
     lock (executeInterceptorsLock)
     {
         executeInterceptors.Remove(interceptor);
     }
 }
Beispiel #2
0
        public Drive(IServiceAccountApplication saApp)
        {
            credential = DriveCredentialsService.GetServiceAccountCredential(saApp);
            service    = DriveCredentialsService.GetService(saApp);

            application = saApp;
        }
 /// <summary>Adds the specified interceptor to the list of execute interceptors.</summary>
 public void AddExecuteInterceptor(IHttpExecuteInterceptor interceptor)
 {
     lock (executeInterceptorsLock)
     {
         executeInterceptors.Add(interceptor);
     }
 }
Beispiel #4
0
        public Drive(IUserCredentialApplication ucApp)
        {
            credential = DriveCredentialsService.GetUserCredential(ucApp);
            service    = DriveCredentialsService.GetService(ucApp);

            application = ucApp;
        }
Beispiel #5
0
        public static BaseClientService AddExecuteInterceptor(
            this BaseClientService service,
            IHttpExecuteInterceptor interceptor)
        {
            service.HttpClient.MessageHandler.AddExecuteInterceptor(interceptor);

            return(service);
        }
Beispiel #6
0
 /// <summary>
 /// Add an unsuccessful response handler for this request only.
 /// </summary>
 /// <param name="handler">The unsuccessful response handler. Must not be <c>null</c>.</param>
 public void AddExecuteInterceptor(IHttpExecuteInterceptor handler)
 {
     handler.ThrowIfNull(nameof(handler));
     if (_executeInterceptors == null)
     {
         _executeInterceptors = new List <IHttpExecuteInterceptor>();
     }
     _executeInterceptors.Add(handler);
 }
        public static ClientServiceRequest <TResponse> AddExecInterceptor <TResponse>(
            this ClientServiceRequest <TResponse> request,
            IHttpExecuteInterceptor interceptor)
        {
            var existingInterceptor = request.Service.HttpClient.MessageHandler.ExecuteInterceptors
                                      .FirstOrDefault(i => i.GetType().IsInstanceOfType(interceptor));

            if (existingInterceptor != null)
            {
                request.Service.HttpClient.MessageHandler.RemoveExecuteInterceptor(existingInterceptor);
            }

            request.Service.HttpClient.MessageHandler.AddExecuteInterceptor(interceptor);

            return(request);
        }
 /// <summary>Removes the specified interceptor from the list of execute interceptors.</summary>
 public void RemoveExecuteInterceptor(IHttpExecuteInterceptor interceptor)
 {
     lock (executeInterceptorsLock)
     {
         executeInterceptors.Remove(interceptor);
     }
 }
 /// <summary>Adds the specified interceptor to the list of execute interceptors.</summary>
 public void AddExecuteInterceptor(IHttpExecuteInterceptor interceptor)
 {
     lock (executeInterceptorsLock)
     {
         executeInterceptors.Add(interceptor);
     }
 }