Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use NuGet.org's new search service #74

Merged
merged 1 commit into from Sep 9, 2019

Conversation

loic-sharma
Copy link
Contributor

@loic-sharma loic-sharma commented Aug 26, 2019

@loic-sharma
Copy link
Contributor Author

loic-sharma commented Aug 26, 2019

By the way @praeclarum, would you be interested in using a third-party SDK that handles the nitty gritties of the NuGet protocol (like finding the correct search URL)? The usage would be something like:

var client = new NuGetClient("https://api.nuget.org/v3/index.json");
var response = await client.SearchAsync("json");

Console.WriteLine($"Found {response.TotalHits} results");

var index = 1;
foreach (var searchResult in response.Data)
{
    Console.WriteLine($"Result #{index}");
    Console.WriteLine($"Package id: {searchResult.PackageId}");
    Console.WriteLine($"Package version: {searchResult.Version}");
    Console.WriteLine($"Package downloads: {searchResult.TotalDownloads}");
    Console.WriteLine($"Package versions: {searchResult.Versions.Count}");
    Console.WriteLine();

    index++;
}

This is a side project that I'm working on, so let me know if you're interested 😄

@praeclarum
Copy link
Owner

Thanks for the stop-gap measure! I do promise to implement service provider... some day.

I don't love using 3rd party libraries to hit web APIs. But I'll admit that nuget's API is weird and breaky enough that it might warrant it. But honestly, I don't see the point.. I would end up changing a lot of code for no user-facing benefits - and I hate those kinds of "refactoring for the sake of refactoring" changes..

@praeclarum praeclarum merged commit d6deda7 into praeclarum:master Sep 9, 2019
@loic-sharma
Copy link
Contributor Author

I don't love using 3rd party libraries to hit web APIs. But I'll admit that nuget's API is weird and breaky enough that it might warrant it. But honestly, I don't see the point.. I would end up changing a lot of code for no user-facing benefits - and I hate those kinds of "refactoring for the sake of refactoring" changes..

That's fair. Ideally, the library abstracts away all the NuGet protocol's complexities so that you can focus on FuGet's functionality. This may be useful if you ever decide to support other NuGet servers (like Sleet or MyGet, all of which have their own quirks). If you're interested, I could send a pull request with all the necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants