Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweaks
  • Loading branch information
loic-sharma committed Dec 12, 2021
commit e5ed7e1fa92b3a4f212218239cb73edb7c99a9b3
14 changes: 7 additions & 7 deletions src/BaGet.Core/IUrlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ public interface IUrlGenerator
/// Get the URL for the package source (also known as the "service index").
/// See: https://docs.microsoft.com/en-us/nuget/api/service-index
/// </summary>
string GetServiceIndexV3Url();
string GetServiceIndexUrl();

/// <summary>
/// Get the URL for the package source that implements the legacy NuGet V2 API.
/// </summary>
string GetServiceIndexV2Url();

/// <summary>
/// Get the URL for the root of the package content resource.
Expand Down Expand Up @@ -109,15 +114,10 @@ public interface IUrlGenerator
/// <param name="version">The package's version</param>
string GetPackageIconDownloadUrl(string id, NuGetVersion version);

/// <summary>
/// Get the URL for the package source that implements the legacy NuGet V2 API.
/// </summary>
string GetServiceIndexV2Url();

/// <summary>
/// Get the URL for the metadata of a single package version.
/// </summary>
/// <param name="package">The package to lookup</param>
string GetPackageVersionV2Url(Package package);
string GetPackageMetadataV2Url(Package package);
}
}
1 change: 1 addition & 0 deletions src/BaGet.Core/V2/IV2Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace BaGet.Core
{
// TODO: comments
public interface IV2Builder
{
XElement BuildIndex();
Expand Down
4 changes: 2 additions & 2 deletions src/BaGet.Core/V2/V2Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public XElement BuildPackages(IReadOnlyList<Package> packages)

packages.Select(package =>
{
var packageV2Url = _url.GetPackageVersionV2Url(package);
var packageV2Url = _url.GetPackageMetadataV2Url(package);
var downloadUrl = _url.GetPackageDownloadUrl(package);

return new XElement(
Expand All @@ -69,7 +69,7 @@ public XElement BuildPackage(Package package)
{
// See: https://joelverhagen.github.io/NuGetUndocs/#endpoint-get-a-single-package
var serviceIndex = _url.GetServiceIndexV2Url();
var packageV2Url = _url.GetPackageVersionV2Url(package);
var packageV2Url = _url.GetPackageMetadataV2Url(package);
var downloadUrl = _url.GetPackageDownloadUrl(package);

return new XElement(
Expand Down
4 changes: 2 additions & 2 deletions src/BaGet.Web/BaGetUrlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public BaGetUrlGenerator(IHttpContextAccessor httpContextAccessor, LinkGenerator
_linkGenerator = linkGenerator ?? throw new ArgumentNullException(nameof(linkGenerator));
}

public string GetServiceIndexV3Url()
public string GetServiceIndexUrl()
{
return _linkGenerator.GetUriByRouteValues(
_httpContextAccessor.HttpContext,
Expand Down Expand Up @@ -168,7 +168,7 @@ public string GetServiceIndexV2Url()
values: null);
}

public string GetPackageVersionV2Url(Package package)
public string GetPackageMetadataV2Url(Package package)
{
return _linkGenerator.GetUriByRouteValues(
_httpContextAccessor.HttpContext,
Expand Down
2 changes: 1 addition & 1 deletion src/BaGet.Web/Pages/Upload.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var baseUrl = Url.PageLink("/Index");
var publishUrl = _url.GetPackagePublishResourceUrl();
var serviceIndexUrl = _url.GetServiceIndexV3Url();
var serviceIndexUrl = _url.GetServiceIndexUrl();
}

<div class="col-sm-12">
Expand Down