Exemple #1
0
        public HiDriveClient(IHiDriveAuthenticator authenticator, Func <HttpClientHandler> httpClientHandlerFactory = null)
        {
            if (authenticator == null)
            {
                throw new ArgumentNullException("authenticator");
            }

            _authenticator            = authenticator;
            _httpClientHandlerFactory = httpClientHandlerFactory != null ? httpClientHandlerFactory : () => new HttpClientHandler();
        }
Exemple #2
0
 public HiDriveClient(IHiDriveAuthenticator authenticator)
 {
     Authenticator = authenticator ?? throw new ArgumentNullException(nameof(authenticator));
     _httpClient   = new HttpClient {
         BaseAddress = new Uri(ApiUrl), Timeout = Timeout.InfiniteTimeSpan
     };
     _httpClient.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8"));
     _httpClient.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
     Directory = new DirectoryRequestBuilder(this);
     File      = new FileRequestBuilder(this);
     Meta      = new MetaRequestBuilder(this);
     User      = new UserRequestBuilder(this);
 }
Exemple #3
0
 public HiDriveStorageConfigurator()
 {
     _authenticator = HiDriveHelper.GetAuthenticator();
 }
Exemple #4
0
 internal static IHiDriveClient GetClient(IHiDriveAuthenticator authenticator)
 {
     return new HiDriveClient(authenticator, ProxyTools.CreateHttpClientHandler);
 }
Exemple #5
0
 internal static IHiDriveClient GetClient(IHiDriveAuthenticator authenticator)
 {
     return(new HiDriveClient(authenticator, ProxyTools.CreateHttpClientHandler));
 }
 public HiDriveStorageConfigurator()
 {
     _authenticator = HiDriveHelper.GetAuthenticator();
 }