diff --git a/types/server_types.go b/types/server_types.go index d8c2aa9b..b52dd5f9 100644 --- a/types/server_types.go +++ b/types/server_types.go @@ -148,6 +148,7 @@ type URLBuilder interface { Sort(field string) string SetSubContext(subContext string) FilterLink(schema *Schema, fieldName string, value string) string + Action(action string, resource *RawResource) string } type Store interface { diff --git a/urlbuilder/url.go b/urlbuilder/url.go index 4fc81fc5..824de817 100644 --- a/urlbuilder/url.go +++ b/urlbuilder/url.go @@ -254,3 +254,7 @@ func parseResponseURLBase(requestURL string, r *http.Request) (string, error) { return requestURL[0:index], nil } + +func (u *urlBuilder) Action(action string, resource *types.RawResource) string { + return u.constructBasicURL(resource.Schema.Version, resource.Schema.PluralName, resource.ID) + "?action=" + url.QueryEscape(action) +}