public FileUploader(IFileServiceClientFactory fileServiceClientFactory, IFileServiceAccessTokenRepository fileServiceAccessTokenRepository, Uri mdsBaseUrl) { this.fileServiceClientFactory = fileServiceClientFactory; // ReSharper disable once JoinNullCheckWithUsage if (fileServiceAccessTokenRepository == null) { throw new ArgumentNullException(nameof(fileServiceAccessTokenRepository)); } this.fileServiceAccessTokenRepository = fileServiceAccessTokenRepository; if (!mdsBaseUrl.ToString().EndsWith(@"/")) { mdsBaseUrl = new Uri($@"{mdsBaseUrl}/"); } if (string.IsNullOrWhiteSpace(mdsBaseUrl.ToString())) { throw new ArgumentNullException(nameof(mdsBaseUrl)); } this.mdsBaseUrl = mdsBaseUrl; this.watch = new Stopwatch(); }
public FileServiceClient(IFileServiceAccessTokenRepository fileServiceAccessTokenRepository, Uri mdsBaseUrl, HttpMessageHandler httpClientHandler, CancellationToken cancellationToken) { if (fileServiceAccessTokenRepository == null) { throw new ArgumentNullException(nameof(fileServiceAccessTokenRepository)); } if (cancellationToken == null) { throw new ArgumentNullException(nameof(cancellationToken)); } if (string.IsNullOrWhiteSpace(mdsBaseUrl.ToString())) { throw new ArgumentNullException(nameof(mdsBaseUrl)); } if (!mdsBaseUrl.ToString().EndsWith(@"/")) { mdsBaseUrl = new Uri($@"{mdsBaseUrl}/"); } if (!mdsBaseUrl.IsWellFormedOriginalString()) { throw new InvalidOperationException($"MDS Url, '{mdsBaseUrl}' is not a well formed url."); } this.fileServiceAccessTokenRepository = fileServiceAccessTokenRepository; this.mdsBaseUrl = mdsBaseUrl; this.cancellationToken = cancellationToken; if (_httpClient == null) { _httpClient = CreateHttpClient(httpClientHandler); } }
public FileUploader( IFileServiceAccessTokenRepository fileServiceAccessTokenRepository, Uri mdsBaseUrl) : this(new FileServiceClientFactory(), fileServiceAccessTokenRepository, mdsBaseUrl) { }
public IFileServiceClient CreateFileServiceClient( IFileServiceAccessTokenRepository fileServiceAccessTokenRepository, Uri mdsBaseUrl, CancellationToken cancellationToken) { return(new FileServiceClient(fileServiceAccessTokenRepository, mdsBaseUrl, new HttpClientHandler(), cancellationToken)); }