Exemplo n.º 1
0
        /// <summary>
        /// Downloads attachment to specified file.
        /// </summary>
        /// <param name="fullFileName">Full file name where attachment will be downloaded.</param>
        public Task DownloadAsync(string fullFileName)
        {
            AddAuthenticationToRequest(_webClient, _jira);
            var url = GetRequestUrl();

            return(_webClient.DownloadAsync(url, fullFileName));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns <see cref="IEnumerable{Location}"></see> of all the locations.
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <exception cref="CovidClientException">
        /// </exception>
        /// <returns><see cref="IEnumerable{Location}"></see> of all the locations.</returns>
        public async Task <IEnumerable <Location> > GetLocationsAsync(CancellationToken cancellationToken = default)
        {
            var result = await _webClient.DownloadAsync(locations_url, cancellationToken).ConfigureAwait(false);

            if (result.IsFailed)
            {
                throw new CovidClientException(result.Errors);
            }

            return(Parser.Parse <Location, LocationMap>(result.Value));
        }
Exemplo n.º 3
0
        protected async Task <T> Get <T>(string queryPath = null)
        {
            string uri = new Uri(BuildUrl(), queryPath).ToString();

            return(await _jsonDeserializer.DeserializeAsync <T>(await _webClient.DownloadAsync(uri)));
        }