aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/nuget/links.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/nuget/links.go')
-rw-r--r--routers/api/packages/nuget/links.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/routers/api/packages/nuget/links.go b/routers/api/packages/nuget/links.go
index 1b02e46184..4c573fe316 100644
--- a/routers/api/packages/nuget/links.go
+++ b/routers/api/packages/nuget/links.go
@@ -5,10 +5,17 @@ package nuget
import (
"fmt"
+ "net/url"
)
+type nextOptions struct {
+ Path string
+ Query url.Values
+}
+
type linkBuilder struct {
Base string
+ Next *nextOptions
}
// GetRegistrationIndexURL builds the registration index url
@@ -30,3 +37,16 @@ func (l *linkBuilder) GetPackageDownloadURL(id, version string) string {
func (l *linkBuilder) GetPackageMetadataURL(id, version string) string {
return fmt.Sprintf("%s/Packages(Id='%s',Version='%s')", l.Base, id, version)
}
+
+func (l *linkBuilder) GetNextURL() string {
+ u, _ := url.Parse(l.Base)
+ u = u.JoinPath(l.Next.Path)
+ q := u.Query()
+ for k, vs := range l.Next.Query {
+ for _, v := range vs {
+ q.Add(k, v)
+ }
+ }
+ u.RawQuery = q.Encode()
+ return u.String()
+}