/// <summary> /// Provides a Web Client for Jenkins REST API. /// </summary> /// <returns>A <see cref="IJenkinsRestClient"/> instance.</returns> public IJenkinsRestClient GetClient() { try { this.restClientLock.EnterUpgradeableReadLock(); if (this.restClient == null) { try { this.restClientLock.EnterWriteLock(); this.webClient = new JenkinsWebClient(); this.restManager = new RestManager(this.webClient, this.userName, this.apiToken); this.restClient = new JenkinsRestClient(this.restManager); } finally { this.restClientLock.ExitWriteLock(); } } return(this.restClient); } finally { this.restClientLock.ExitUpgradeableReadLock(); } }
public RestManager(IJenkinsWebClient webClient) { if (webClient == null) { throw new ArgumentNullException("webClient"); } this.client = webClient; }
public RestManager(IJenkinsWebClient webClient, string userName, string apiToken) : this(webClient) { this.userName = userName; this.apiToken = apiToken; }