/// <summary> /// Initializes a new instance of the <see cref="NuGetClient"/> class. /// </summary> /// <param name="clientFactory">The factory used to create NuGet clients.</param> public NuGetClient(NuGetClientFactory clientFactory) { if (clientFactory == null) { throw new ArgumentNullException(nameof(clientFactory)); } _contentClient = clientFactory.CreatePackageContentClient(); _metadataClient = clientFactory.CreatePackageMetadataClient(); _searchClient = clientFactory.CreateSearchClient(); _autocompleteClient = clientFactory.CreateAutocompleteClient(); }
/// <summary> /// Initializes a new instance of the <see cref="NuGetClient"/> class. /// </summary> /// <param name="serviceIndexUrl"> /// The NuGet Service Index resource URL. /// /// For NuGet.org, use https://api.nuget.org/v3/index.json /// </param> public NuGetClient(string serviceIndexUrl) { var httpClient = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, }); var clientFactory = new NuGetClientFactory(httpClient, serviceIndexUrl); _contentClient = clientFactory.CreatePackageContentClient(); _metadataClient = clientFactory.CreatePackageMetadataClient(); _searchClient = clientFactory.CreateSearchClient(); _autocompleteClient = clientFactory.CreateAutocompleteClient(); _publishClient = clientFactory.CreatePublishClient(); }
/// <summary> /// Create a new <see cref="CatalogProcessor"/> to discover and download catalog leafs. /// Leafs are processed by the <see cref="ICatalogLeafProcessor"/>. /// </summary> /// <param name="clientFactory">The factory used to create NuGet clients.</param> /// <param name="cursor">Cursor to track succesfully processed leafs. Leafs before the cursor are skipped.</param> /// <param name="leafProcessor">The leaf processor.</param> /// <param name="options">The options to configure catalog processing.</param> /// <param name="logger">The logger used for telemetry.</param> /// <returns>The catalog processor.</returns> public static CatalogProcessor CreateCatalogProcessor( this NuGetClientFactory clientFactory, ICursor cursor, ICatalogLeafProcessor leafProcessor, CatalogProcessorOptions options, ILogger <CatalogProcessor> logger) { var catalogClient = clientFactory.CreateCatalogClient(); return(new CatalogProcessor( cursor, catalogClient, leafProcessor, options, logger)); }
public PublishClient(NuGetClientFactory clientFactory) { _clientfactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); }
public ServiceIndexClient(NuGetClientFactory clientFactory) { _clientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); }
public AutocompleteClient(NuGetClientFactory clientFactory) { _clientfactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); }
public PackageMetadataClient(NuGetClientFactory clientFactory) { _clientfactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory)); }