public HiDriveClient(IHiDriveAuthenticator authenticator, Func <HttpClientHandler> httpClientHandlerFactory = null) { if (authenticator == null) { throw new ArgumentNullException("authenticator"); } _authenticator = authenticator; _httpClientHandlerFactory = httpClientHandlerFactory != null ? httpClientHandlerFactory : () => new HttpClientHandler(); }
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); }
public HiDriveStorageConfigurator() { _authenticator = HiDriveHelper.GetAuthenticator(); }
internal static IHiDriveClient GetClient(IHiDriveAuthenticator authenticator) { return new HiDriveClient(authenticator, ProxyTools.CreateHttpClientHandler); }
internal static IHiDriveClient GetClient(IHiDriveAuthenticator authenticator) { return(new HiDriveClient(authenticator, ProxyTools.CreateHttpClientHandler)); }