/// <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();
        }