Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add resourceLinkById #20

Merged
merged 1 commit into from
Dec 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions types/server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ type URLBuilder interface {
SetSubContext(subContext string)
FilterLink(schema *Schema, fieldName string, value string) string
Action(action string, resource *RawResource) string
ResourceLinkByID(schema *Schema, id string) string
}

type Store interface {
Expand Down
4 changes: 4 additions & 0 deletions urlbuilder/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ func (u *urlBuilder) FilterLink(schema *types.Schema, fieldName string, value st
url.QueryEscape(fieldName) + "=" + url.QueryEscape(value)
}

func (u *urlBuilder) ResourceLinkByID(schema *types.Schema, id string) string {
return u.constructBasicURL(schema.Version, schema.PluralName, id)
}

func (u *urlBuilder) constructBasicURL(version types.APIVersion, parts ...string) string {
buffer := bytes.Buffer{}

Expand Down