public VstsConfig(VstsSettings settings, IVstsClient client)
 {
     _settings     = settings;
     _client       = client;
     _cache        = new ConcurrentDictionary <string, bool?>();
     _cacheTimeout = DateTime.UtcNow.Add(_settings.CacheTimeout);
 }
 public FcsActiveProvidersClient(IVstsClient vstsClient, IAppServiceSettings appServiceSettings, IConvertFromCsv convertFromCsv, ILog logger)
 {
     _vstsClient         = vstsClient;
     _appServiceSettings = appServiceSettings;
     _convertFromCsv     = convertFromCsv;
     _logger             = logger;
 }
예제 #3
0
        public async Task <IVstsClient> GetClient(Guid organizationId, string token = null)
        {
            OrganizationViewModel config;

            if (organizationId != default)
            {
                config = await _mediator.Request <Queries.GetOrganizationById, OrganizationViewModel>(new Queries.GetOrganizationById(organizationId));
            }
            else
            {
                config = await _mediator.Request <GetFirstOrganization, OrganizationViewModel>();
            }

            if (config == null || config.Identity.Equals(Guid.Empty))
            {
                throw new AzureDevopsConfigurationIsMissingException();
            }

            if (string.IsNullOrEmpty(token))
            {
                var identity = await _mediator.Request <GetIdentityById, IdentityViewModel>(new GetIdentityById { Id = config.Identity });

                token = identity.Token;
            }

            Client = VstsClient.Get(new OnlineUrlBuilderFactory(config.Name), token);

            return(Client);
        }
예제 #4
0
 public EmployerProviderVstsClient(
     IConvertFromCsv convertFromCsv,
     IVstsClient vstsClient,
     IAppServiceSettings appServiceSettings,
     ILog logger)
 {
     _convertFromCsv     = convertFromCsv;
     _vstsClient         = vstsClient;
     _appServiceSettings = appServiceSettings;
     _logger             = logger;
 }
 public VstsService(
     IAppServiceSettings appServiceSettings,
     IGitDynamicModelGenerator gitDynamicModelGenerator,
     IJsonMetaDataConvert jsonMetaDataConvert,
     IVstsClient vstsClient,
     ILog logger)
 {
     _appServiceSettings       = appServiceSettings;
     _gitDynamicModelGenerator = gitDynamicModelGenerator;
     _jsonMetaDataConvert      = jsonMetaDataConvert;
     _vstsClient = vstsClient;
     _logger     = logger;
 }
예제 #6
0
        public async Task <IVstsClient> GetClient(string token = null)
        {
            var config = await _mediator.Request <GetVstsDataSourceConfiguration, VstsDataSourceViewModel>();

            if (config == null || !config.DefaultToken.HasValue)
            {
                throw new AzureDevopsConfigurationIsMissingException();
            }

            if (string.IsNullOrEmpty(token))
            {
                var identity = await _mediator.Request <GetIdentityById, IdentityViewModel>(new GetIdentityById { Id = config.DefaultToken.Value });

                token = identity.Token;
            }

            Client = VstsClient.Get(new OnlineUrlBuilderFactory(config.InstanceName), token);

            return(Client);
        }