Exemplo n.º 1
0
 public ReleaseDownloader(IReleaseDownloaderSettings settings)
 {
     _settings = settings.Copy();
     _settings.HTTPClient.DefaultRequestHeaders.Add("User-Agent", _settings.Repository);
     _releasesEndpoint = "https://api.github.com/repos/" + _settings.Author + "/" + _settings.Repository +
                         "/releases";
 }
Exemplo n.º 2
0
        public ReleaseDownloader(IReleaseDownloaderSettings settings)
        {
            _settings = settings.Copy();

            HttpClient = new HttpClient();
            var assemblyName = Assembly.GetExecutingAssembly().GetName();

            HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(new ProductHeaderValue(assemblyName.Name, assemblyName.Version.ToString())));
            HttpClient.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3.raw");
            if (!string.IsNullOrEmpty(_settings.PAT))
            {
                HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", _settings.PAT);
            }
        }