dir2opds/opds/link_builder.go

40 lines
1010 B
Go
Raw Normal View History

package opds
2017-05-11 23:06:21 +00:00
import (
"github.com/lann/builder"
"golang.org/x/tools/blog/atom"
)
type linkBuilder builder.Builder
func (l linkBuilder) Rel(rel string) linkBuilder {
return builder.Set(l, "Rel", rel).(linkBuilder)
}
func (l linkBuilder) Href(href string) linkBuilder {
return builder.Set(l, "Href", href).(linkBuilder)
}
func (l linkBuilder) Type(typeName string) linkBuilder {
return builder.Set(l, "Type", typeName).(linkBuilder)
}
func (l linkBuilder) HrefLang(lang string) linkBuilder {
return builder.Set(l, "HrefLang", lang).(linkBuilder)
}
func (l linkBuilder) Title(title string) linkBuilder {
return builder.Set(l, "Title", title).(linkBuilder)
}
func (l linkBuilder) Length(length uint) linkBuilder {
return builder.Set(l, "Length", length).(linkBuilder)
}
func (l linkBuilder) Build() atom.Link {
return builder.GetStruct(l).(atom.Link)
}
2018-03-03 20:12:41 +00:00
// LinkBuilder is a fluent immutable builder to build OPDS Links
2017-05-11 23:06:21 +00:00
var LinkBuilder = builder.Register(linkBuilder{}, atom.Link{}).(linkBuilder)