/// <inheritdoc /> public async Task <TResult> GetAsync <TResult>(string apiUrl) where TResult : class { EnsureRequiredArgumentAndAction(apiUrl); var httpResponse = await _httpClientWrapper.GetStreamAsync(GetCompleteApiUrl(apiUrl, '&')); return(await JsonSerializer.DeserializeAsync <TResult>(httpResponse)); }
public async Task <Stream> Download(Uri driverUrl) { using (var zippedDriverStream = await _httpClientWrapper.GetStreamAsync(driverUrl)) { var unzippedDriverStream = await _fileSystemWrapper.UnzipSingleFile(zippedDriverStream); return(unzippedDriverStream); } }
/// <summary> /// Returns a BinaryReader instance for reading a public URI or local file. /// </summary> /// <param name="filePath">Path of the file to read.</param> /// <param name="isUri">Species if the path is a URI.</param> /// <param name="httpClient">The IHttpClientWrapper implementation to use when reading from remote URIs.</param> /// <param name="log">Trace logger instance.</param> /// <returns>A BinaryReader instance.</returns> public static BinaryReader GetBinaryReader(string filePath, bool isUri, IHttpClientWrapper httpClient, ILogger log) { if (isUri) { return(new BinaryReader(httpClient.GetStreamAsync(filePath, log).Result)); } else { return(new BinaryReader(File.Open(filePath, FileMode.Open))); } }