diff --git a/src/code/V2ServerAPICalls.cs b/src/code/V2ServerAPICalls.cs index 7ca08fd83..4a457b125 100644 --- a/src/code/V2ServerAPICalls.cs +++ b/src/code/V2ServerAPICalls.cs @@ -69,7 +69,7 @@ public V2ServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, N /// public override FindResults FindAll(bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindAll()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindAll()"); errRecord = null; List responses = new List(); @@ -156,7 +156,7 @@ public override FindResults FindAll(bool includePrerelease, ResourceType type, o /// public override FindResults FindTags(string[] tags, bool includePrerelease, ResourceType _type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindTags()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindTags()"); errRecord = null; List responses = new List(); @@ -249,7 +249,7 @@ public override FindResults FindTags(string[] tags, bool includePrerelease, Reso /// public override FindResults FindCommandOrDscResource(string[] tags, bool includePrerelease, bool isSearchingForCommands, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindCommandOrDscResource()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindCommandOrDscResource()"); List responses = new List(); int skip = 0; @@ -309,7 +309,7 @@ public override FindResults FindCommandOrDscResource(string[] tags, bool include /// public override FindResults FindName(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindName()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindName()"); // Make sure to include quotations around the package name var prerelease = includePrerelease ? "IsAbsoluteLatestVersion" : "IsLatestVersion"; @@ -352,7 +352,7 @@ public override FindResults FindName(string packageName, bool includePrerelease, /// public override FindResults FindNameWithTag(string packageName, string[] tags, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindNameWithTag()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindNameWithTag()"); // Make sure to include quotations around the package name var prerelease = includePrerelease ? "IsAbsoluteLatestVersion" : "IsLatestVersion"; @@ -403,7 +403,7 @@ public override FindResults FindNameWithTag(string packageName, string[] tags, b /// public override FindResults FindNameGlobbing(string packageName, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindNameGlobbing()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindNameGlobbing()"); List responses = new List(); int skip = 0; @@ -456,7 +456,7 @@ public override FindResults FindNameGlobbing(string packageName, bool includePre /// public override FindResults FindNameGlobbingWithTag(string packageName, string[] tags, bool includePrerelease, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindNameGlobbingWithTag()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindNameGlobbingWithTag()"); List responses = new List(); int skip = 0; @@ -511,7 +511,7 @@ public override FindResults FindNameGlobbingWithTag(string packageName, string[] /// public override FindResults FindVersionGlobbing(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindVersionGlobbing()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindVersionGlobbing()"); List responses = new List(); int skip = 0; @@ -565,7 +565,7 @@ public override FindResults FindVersionGlobbing(string packageName, VersionRange /// public override FindResults FindVersion(string packageName, string version, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindVersion()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindVersion()"); // https://www.powershellgallery.com/api/v2/FindPackagesById()?id='blah'&includePrerelease=false&$filter= NormalizedVersion eq '1.1.0' and substringof('PSModule', Tags) eq true // Quotations around package name and version do not matter, same metadata gets returned. // We need to explicitly add 'Id eq ' whenever $filter is used, otherwise arbitrary results are returned. @@ -607,7 +607,7 @@ public override FindResults FindVersion(string packageName, string version, Reso /// public override FindResults FindVersionWithTag(string packageName, string version, string[] tags, ResourceType type, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindVersionWithTag()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindVersionWithTag()"); // We need to explicitly add 'Id eq ' whenever $filter is used, otherwise arbitrary results are returned. string idFilterPart = $" and Id eq '{packageName}'"; string typeFilterPart = GetTypeFilterForRequest(type); @@ -656,7 +656,7 @@ public override FindResults FindVersionWithTag(string packageName, string versio /// public override Stream InstallName(string packageName, bool includePrerelease, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::InstallName()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::InstallName()"); var requestUrlV2 = $"{Repository.Uri}/package/{packageName}"; var response = HttpRequestCallForContent(requestUrlV2, out errRecord); @@ -675,7 +675,7 @@ public override Stream InstallName(string packageName, bool includePrerelease, o /// public override Stream InstallVersion(string packageName, string version, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::InstallVersion()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::InstallVersion()"); var requestUrlV2 = $"{Repository.Uri}/package/{packageName}/{version}"; var response = HttpRequestCallForContent(requestUrlV2, out errRecord); var responseStream = response.ReadAsStreamAsync().Result; @@ -688,7 +688,7 @@ public override Stream InstallVersion(string packageName, string version, out Er /// private string HttpRequestCall(string requestUrlV2, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::HttpRequestCall()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::HttpRequestCall()"); errRecord = null; string response = string.Empty; @@ -745,7 +745,7 @@ private string HttpRequestCall(string requestUrlV2, out ErrorRecord errRecord) /// private HttpContent HttpRequestCallForContent(string requestUrlV2, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::HttpRequestCallForContent()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::HttpRequestCallForContent()"); errRecord = null; HttpContent content = null; @@ -798,7 +798,7 @@ private HttpContent HttpRequestCallForContent(string requestUrlV2, out ErrorReco /// private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingModule, int skip, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindAllFromTypeEndPoint()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindAllFromTypeEndPoint()"); string typeEndpoint = isSearchingModule ? String.Empty : "/items/psscript"; string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000"; var prereleaseFilter = includePrerelease ? "IsAbsoluteLatestVersion&includePrerelease=true" : "IsLatestVersion"; @@ -812,7 +812,7 @@ private string FindAllFromTypeEndPoint(bool includePrerelease, bool isSearchingM /// private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool isSearchingModule, int skip, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindTagFromEndpoint()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindTagFromEndpoint()"); // scenarios with type + tags: // type: None -> search both endpoints // type: M -> just search Module endpoint @@ -821,7 +821,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i // type: Command -> just search Modules string typeEndpoint = isSearchingModule ? String.Empty : "/items/psscript"; string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000"; - var prereleaseFilter = includePrerelease ? "$filter=IsAbsoluteLatestVersion&includePrerelease=true" : "$filter=IsLatestVersion"; + var prereleaseFilter = includePrerelease ? "includePrerelease=true&$filter=IsAbsoluteLatestVersion" : "$filter=IsLatestVersion"; string typeFilterPart = isSearchingModule ? $" and substringof('PSModule', Tags) eq true" : $" and substringof('PSScript', Tags) eq true"; string tagFilterPart = String.Empty; @@ -840,7 +840,7 @@ private string FindTagFromEndpoint(string[] tags, bool includePrerelease, bool i /// private string FindCommandOrDscResource(string[] tags, bool includePrerelease, bool isSearchingForCommands, int skip, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindCommandOrDscResource()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindCommandOrDscResource()"); // can only find from Modules endpoint string paginationParam = $"&$orderby=Id desc&$inlinecount=allpages&$skip={skip}&$top=6000"; var prereleaseFilter = includePrerelease ? "$filter=IsAbsoluteLatestVersion&includePrerelease=true" : "$filter=IsLatestVersion"; @@ -867,7 +867,7 @@ private string FindCommandOrDscResource(string[] tags, bool includePrerelease, b /// private string FindNameGlobbing(string packageName, ResourceType type, bool includePrerelease, int skip, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindNameGlobbing()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindNameGlobbing()"); // https://www.powershellgallery.com/api/v2/Search()?$filter=endswith(Id, 'Get') and startswith(Id, 'PowerShell') and IsLatestVersion (stable) // https://www.powershellgallery.com/api/v2/Search()?$filter=endswith(Id, 'Get') and IsAbsoluteLatestVersion&includePrerelease=true @@ -935,7 +935,7 @@ private string FindNameGlobbing(string packageName, ResourceType type, bool incl /// private string FindNameGlobbingWithTag(string packageName, string[] tags, ResourceType type, bool includePrerelease, int skip, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindNameGlobbingWithTag()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindNameGlobbingWithTag()"); // https://www.powershellgallery.com/api/v2/Search()?$filter=endswith(Id, 'Get') and startswith(Id, 'PowerShell') and IsLatestVersion (stable) // https://www.powershellgallery.com/api/v2/Search()?$filter=endswith(Id, 'Get') and IsAbsoluteLatestVersion&includePrerelease=true @@ -1009,7 +1009,7 @@ private string FindNameGlobbingWithTag(string packageName, string[] tags, Resour /// private string FindVersionGlobbing(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, int skip, bool getOnlyLatest, out ErrorRecord errRecord) { - _cmdletPassedIn.WriteDebug("In NuGetServerAPICalls::FindVersionGlobbing()"); + _cmdletPassedIn.WriteDebug("In V2ServerAPICalls::FindVersionGlobbing()"); //https://www.powershellgallery.com/api/v2//FindPackagesById()?id='blah'&includePrerelease=false&$filter= NormalizedVersion gt '1.0.0' and NormalizedVersion lt '2.2.5' and substringof('PSModule', Tags) eq true //https://www.powershellgallery.com/api/v2//FindPackagesById()?id='PowerShellGet'&includePrerelease=false&$filter= NormalizedVersion gt '1.1.1' and NormalizedVersion lt '2.2.5' // NormalizedVersion doesn't include trailing zeroes