コード例 #1
0
        public TeamCityClient(TeamCityClientOptions options) : this()
        {
            var handler = new HttpClientHandler
            {
                Credentials     = new NetworkCredential(options.Username, options.Password),
                PreAuthenticate = true
            };

            _httpClient = new HttpClient(handler)
            {
                BaseAddress = options.ServerUri
            };
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(options.DefaultAcceptHeaderValue));
            _httpClient.DefaultRequestHeaders.Add("Origin", options.ServerUri.AbsoluteUri);

            Projects   = new ProjectsClient(_httpClient);
            BuildTypes = new BuildTypesClient(_httpClient);
        }
コード例 #2
0
 public TeamCityClient(HttpClient httpClient) : this()
 {
     _httpClient = httpClient;
     Projects    = new ProjectsClient(_httpClient);
     BuildTypes  = new BuildTypesClient(_httpClient);
 }