public VstsConfig(VstsSettings settings, IVstsClient client)
 {
     _settings     = settings;
     _client       = client;
     _cache        = new ConcurrentDictionary <string, bool?>();
     _cacheTimeout = DateTime.UtcNow.Add(_settings.CacheTimeout);
 }
 private ConfigureVsts(IConfigureBehavior control, VstsSettings settings)
 {
     _control  = control;
     _settings = settings;
     _target   = new VstsConfig(_settings);
     _config   = control.Custom(_target.IsEnabled);
 }
        public VstsClient(Uri projectUrl, string pat, VstsSettings settings)
        {
            if (projectUrl == null)
            {
                throw new ArgumentNullException("projectUrl");
            }

            if (projectUrl.LocalPath == "/")
            {
                throw new ArgumentException("Invalid URL: The URL must have the format: 'https://<account>.visualstudio.com/<project>'.", "projectUrl");
            }

            var urlWrapper = new UrlWrapper(projectUrl);

            _projectName = urlWrapper.ProjectName;
            var baseUrl = urlWrapper.ProjectCollectionUri;

            _settings = settings;

            VssCredentials credentials = string.IsNullOrEmpty(pat)
                ? credentials = new VssClientCredentials()
                : new VssBasicCredential(string.Empty, pat);

            var connection = new VssConnection(baseUrl, credentials);

            _client = connection.GetClient <WorkItemTrackingHttpClient>();
        }
 public VstsConfig(VstsSettings settings)
     : this(settings, null)
 {
 }
 IConfigureVsts IConfigureVsts.WithSettings(VstsSettings settings)
 {
     return(new ConfigureVsts(_control, settings));
 }
 public VstsClient(VstsSettings settings)
     : this(settings.Url, settings.PrivateAccessToken, settings)
 {
 }