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

Add a sample for listing package ids from a feed. #41

Closed

Conversation

KirillOsenkov
Copy link

No description provided.

@KirillOsenkov
Copy link
Author

@loic-sharma @nkolev92

@KirillOsenkov
Copy link
Author

I wasn't able to find documentation for ListResource so perhaps worth adding to the docs as well?

@nkolev92
Copy link
Member

nkolev92 commented Oct 6, 2020

ListResource is V2 based, it always falls back to the search/packages OData endpoint.
That's really the reason why we haven't documented it and instead recommend the other 3 resources (Search, Metadata, FindPackagesById).

Those are capable of switching between implementations properly.

@zivkan
Copy link
Member

zivkan commented Oct 6, 2020

I started writing this before Nikolche replied, but I was too slow because I was checking some server implementations and getting links:

This only works for v3 feeds when the service index contains a LegacyGallery link, as it's fundamentally a v2 operation.

While nuget.org, Azure DevOps, and MyGet implement it, I know that Sleet and BaGet do not. I don't know about GitHub Package Repository, or all the other servers listed in NuGet doc's hosting a package page.

A Nikolche wrote, that sample will not work for all NuGet server implementations.

@KirillOsenkov
Copy link
Author

So is there a canonical way to do this properly for any feed? Or should we publish this with a disclaimer explaining that it's only for feeds that support V2, and won't work in certain servers such as Sleet and BaGet?

@nkolev92
Copy link
Member

nkolev92 commented Oct 6, 2020

There's no resource to list all package ids in v3 today. NuGet/NuGetGallery#3878 is the ask afaik.

@KirillOsenkov
Copy link
Author

Then let's add this sample and add a snippet in the docs clarifying the situation. It's useful in most scenarios and better than nothing.

@loic-sharma
Copy link
Contributor

loic-sharma commented Oct 6, 2020

There's no resource to list all package ids in v3 today. NuGet/NuGetGallery#3878 is the ask afaik.

FYI, some V3 servers like nuget.org provide a catalog resource which can be used to discover all packages (see this tutorial). Here's a tool I wrote to do exactly just that: https://github.com/loic-sharma/nuget-mirror

For NuGet servers that do not support V2 and the catalog resource, I would recommend falling back to the search resource.

@KirillOsenkov
Copy link
Author

So let's see if I'm getting this right.

  1. Some feeds support V2 only, some V3 only and some support both.
  2. All V2 feeds support ListResource as used in my sample above
  3. Some V3 feeds support catalog resource, which can also discover all packages
  4. There exist V3 feeds that don't support V2 (no ListResource) and don't provide a catalog resource

So there's no reliable way to do what I want for all feeds but some combination of ListResource and catalog resource can together provide it for most feeds.

Does this sound about right?

@loic-sharma
Copy link
Contributor

loic-sharma commented Oct 7, 2020

That's right. For scenario 4, this suggestion can be used:

For NuGet servers that do not support V2 and the catalog resource, I would recommend falling back to the search resource.

In hindsight, this may be a little too complex for the SDK samples 😅

@KirillOsenkov
Copy link
Author

Let's either merge this or close it, and I'm OK with either :) Thanks!

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

4 participants