PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
475 stars 90 forks source link

Refactor V2/NuGetServerAPICalls to use object-oriented query/filter builder #1645

Closed sean-r-williams closed 2 months ago

sean-r-williams commented 2 months ago

PR Summary

This PR replaces the existing NuGet v2 API call-building mechanism based on string manipulation (as used in members of V2ServerAPICalls and NuGetServerAPICalls) with a separate pair of classes (NuGetV2QueryBuilder and NuGetV2FilterBuilder) that construct a query-string by aggregating user-supplied criteria.

Resolves #1643.

PR Context

The current implementation of V2 API calling classes builds API call URLs (including parameters) by directly performing string-manipulation on the URL itself. This has several drawbacks:

There are some specific limitations in the current implementation:

PR Checklist

sean-r-williams commented 2 months ago

@microsoft-github-policy-service agree company="Bungie, Inc."

anamnavi commented 2 months ago

/azp run PowerShell.PSResourceGet

azure-pipelines[bot] commented 2 months ago
Azure Pipelines successfully started running 1 pipeline(s).
anamnavi commented 2 months ago

@sean-r-williams thanks for creating this PR, it looks really thorough and the context was well explained :) The team will take a deeper look into it an get back by this week with any suggestions/questions/follow up.

sean-r-williams commented 2 months ago

Thanks @anamnavi! It looks like CodeQL is falling for some reason, but I'm not authorized to view the workflow logs. I have a feeling this might be due to the new dependency on System.Web, but I'm unsure.

If someone from your team is able to summarize the errors coming back from CodeQL, I might be able to resolve the errors myself.

sean-r-williams commented 2 months ago

Scratch that, it sems I forgot to add a file when I renamed a method. If someone could re-run Azure Pipelines, that'd be appreciated.

anamnavi commented 2 months ago

/azp run PowerShell.PSResourceGet

azure-pipelines[bot] commented 2 months ago
Azure Pipelines successfully started running 1 pipeline(s).
anamnavi commented 2 months ago

no worries! if that doesn't work I can take a look at the CodeQL errors/see if it has to do with things on our end.

sean-r-williams commented 2 months ago

@sean-r-williams thanks for creating this PR, it looks really thorough and the context was well explained :) The team will take a deeper look into it an get back by this week with any suggestions/questions/follow up.

@anamnavi Gentle reminder on this - the current implementation of v2 API calls blocks dependency installation on Artifactory.

I'd like to make sure either this PR or #1644 are included in 1.0.5 (or whatever the next patch or minor release happens to be), and that said release is made available in the near future.