Ejemplo n.º 1
0
        public PluginRepository()
        {
            var httpClient    = new HttpClient(new HttpClientHandler());
            var clientFactory = new NuGetClientFactory(httpClient, "https://api.nuget.org/v3/index.json");

            _searchClient = clientFactory.CreateSearchClient();
        }
Ejemplo n.º 2
0
 public ExtractCommand(
     NuGetClientFactory clientFactory,
     Func <DirectoryInfo, PackageExtractor> extractorFactory,
     ILogger <ExtractCommand> logger)
 {
     _clientFactory    = clientFactory;
     _extractorFactory = extractorFactory;
     _logger           = logger;
 }
 public CatalogLeafItemProducer(
     NuGetClientFactory factory,
     IOptionsSnapshot <MirrorOptions> options,
     ILogger <CatalogLeafItemProducer> logger)
 {
     _factory = factory;
     _options = options;
     _logger  = logger;
 }
 public PackageMetadataWorker(
     NuGetClientFactory factory,
     IOptionsSnapshot <MirrorOptions> options,
     ILogger <PackageMetadataWorker> logger)
 {
     _factory = factory;
     _json    = new JsonSerializer();
     _options = options;
     _logger  = logger;
 }
 public static NuGetApiOptions AddUpstreamSource(this NuGetApiOptions options, string name, string serviceIndexUrl, int timeoutInSeconds = 600)
 {
     _mirrorsAdded = true;
     options.Services.AddSingleton <IUpstreamNuGetSource>(sp =>
     {
         var clientFactory = new NuGetClientFactory(HttpClientFactory(timeoutInSeconds), serviceIndexUrl);
         return(new UpstreamNuGetSource(name, new NuGetClient(clientFactory)));
     });
     return(options);
 }
Ejemplo n.º 6
0
 public QueueAllCommand(
     NuGetClientFactory clientFactory,
     QueuePackageUrls queue,
     //ICursor cursor,
     ILogger <QueueAllCommand> logger)
 {
     _clientFactory = clientFactory;
     _queue         = queue;
     //_cursor = cursor;
     _logger = logger;
 }
Ejemplo n.º 7
0
        public PackageMetadataCursor(
            NuGetClientFactory factory,
            HttpClient httpClient,
            ILogger <PackageMetadataCursor> logger)
        {
            _factory    = factory;
            _httpClient = httpClient;
            _logger     = logger;

            _cursorUrl = null;
        }
Ejemplo n.º 8
0
        public BaGetClientIntegrationTests(ITestOutputHelper output)
        {
            _app = new BaGetApplication(output);

            var serviceIndexUrl = new Uri(_app.Server.BaseAddress, "v3/index.json");

            _httpClient    = _app.CreateClient();
            _clientFactory = new NuGetClientFactory(_httpClient, serviceIndexUrl.AbsoluteUri);
            _client        = new NuGetClient(_clientFactory);

            _packageStream = TestResources.GetResourceStream(TestResources.Package);
        }
Ejemplo n.º 9
0
        public BaGetClientIntegrationTests(
            BaGetWebApplicationFactory factory,
            ITestOutputHelper output)
        {
            _factory = factory.WithOutput(output);

            var serviceIndexUrl = new Uri(_factory.Server.BaseAddress, "v3/index.json");

            var httpClient = _factory.CreateDefaultClient();

            _clientFactory = new NuGetClientFactory(httpClient, serviceIndexUrl.AbsoluteUri);
            _client        = new NuGetClient(_clientFactory);
        }
Ejemplo n.º 10
0
 public AddPackagesCommand(
     NuGetClientFactory clientFactory,
     ICatalogLeafItemBatchProcessor leafProcessor,
     ICursor cursor,
     IOptions <AddPackagesOptions> options,
     ILogger <AddPackagesCommand> logger)
 {
     _clientFactory = clientFactory;
     _leafProcessor = leafProcessor;
     _cursor        = cursor;
     _options       = options;
     _logger        = logger;
 }
Ejemplo n.º 11
0
 public ProcessCatalogLeafItem(
     NuGetClientFactory clientFactory,
     IPackageService packages,
     CloudBlobContainer blobContainer,
     PackageIndexer indexer,
     ILogger <ProcessCatalogLeafItem> logger)
 {
     _clientFactory = clientFactory;
     _packages      = packages;
     _blobContainer = blobContainer;
     _indexer       = indexer;
     _logger        = logger;
 }
Ejemplo n.º 12
0
 public RebuildV3Command(
     NuGetClientFactory clientFactory,
     BatchQueueClient queue,
     ICursor cursor,
     IOptions <RebuildV3Options> options,
     ILogger <RebuildV3Command> logger)
 {
     _clientFactory = clientFactory;
     _queue         = queue;
     _cursor        = cursor;
     _options       = options;
     _logger        = logger;
 }
        public static NuGetApiOptions AddUpstreamSource(this NuGetApiOptions options, string name, string serviceIndexUrl, string username, string apiToken, int timeoutInSeconds = 600)
        {
            _mirrorsAdded = true;
            options.Services.AddSingleton <IUpstreamNuGetSource>(sp =>
            {
                var httpClient = HttpClientFactory(timeoutInSeconds);
                var creds      = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{username}:{apiToken}"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", creds);
                var clientFactory = new NuGetClientFactory(httpClient, serviceIndexUrl);
                return(new UpstreamNuGetSource(name, new NuGetClient(clientFactory)));
            });

            return(options);
        }
Ejemplo n.º 14
0
        public ProtocolFixture()
        {
            var httpClient = new HttpClient(new TestDataHttpMessageHandler());

            NuGetClientFactory = new NuGetClientFactory(httpClient, TestData.ServiceIndexUrl);
            NuGetClient        = new NuGetClient(NuGetClientFactory);

            ServiceIndexClient = new RawServiceIndexClient(httpClient, TestData.ServiceIndexUrl);
            ContentClient      = new RawPackageContentClient(httpClient, TestData.PackageContentUrl);
            MetadataClient     = new RawPackageMetadataClient(httpClient, TestData.PackageMetadataUrl);
            SearchClient       = new RawSearchClient(httpClient, TestData.SearchUrl);
            AutocompleteClient = new RawAutocompleteClient(httpClient, TestData.AutocompleteUrl);
            CatalogClient      = new RawCatalogClient(httpClient, TestData.CatalogIndexUrl);
        }
Ejemplo n.º 15
0
 public RebuildSearchCommand(
     NuGetClientFactory clientFactory,
     ICursor cursor,
     IPackageService packages,
     IndexActionBuilder actionBuilder,
     AzureSearchBatchIndexer indexer,
     ILogger <RebuildSearchCommand> logger)
 {
     _clientFactory = clientFactory;
     _cursor        = cursor;
     _packages      = packages;
     _actionBuilder = actionBuilder;
     _indexer       = indexer;
     _logger        = logger;
 }
Ejemplo n.º 16
0
 public PackageMetadataClient(NuGetClientFactory clientFactory)
 {
     _clientfactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
 }
Ejemplo n.º 17
0
 public NuGetClientFactoryTests(ProtocolFixture fixture)
 {
     _target = fixture.NuGetClientFactory;
 }
Ejemplo n.º 18
0
 public CatalogClient(NuGetClientFactory clientFactory)
 {
     _clientfactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
 }