Files
bjoern-m 601ffaae92 Introduce Flowpilot - integration (#1532)
This pull request introduces the new Flowpilot system along with several new features and various improvements. The key enhancements include configurable authorization, registration, and profile flows, as well as the ability to enable and disable user identifiers (e.g., email addresses and usernames) and login methods.

---------

Co-authored-by: Frederic Jahn <frederic.jahn@hanko.io>
Co-authored-by: Lennart Fleischmann <lennart.fleischmann@hanko.io>
Co-authored-by: lfleischmann <67686424+lfleischmann@users.noreply.github.com>
Co-authored-by: merlindru <hello@merlindru.com>
2024-08-06 16:07:29 +02:00

56 lines
1.2 KiB
Go

package flowpilot
// LinkCategory represents the category of the link.
type LinkCategory string
// LinkTarget represents the html target attribute.
type LinkTarget string
// Link targets enumeration.
const (
LinkTargetSelf LinkTarget = "_self"
LinkTargetBlank LinkTarget = "_blank"
LinkTargetParent LinkTarget = "_parent"
LinkTargetTop LinkTarget = "_top"
)
// Link defines the interface for links.
type Link interface {
Target(LinkTarget) Link
toResponseLink() ResponseLink
}
// defaultLink represents a link with its options.
type defaultLink struct {
name string
href string
category LinkCategory
target LinkTarget
}
// Target sets the target attribute of the link.
func (l *defaultLink) Target(target LinkTarget) Link {
l.target = target
return l
}
func (l *defaultLink) toResponseLink() ResponseLink {
return ResponseLink{
Name: l.name,
Href: l.href,
Category: l.category,
Target: l.target,
}
}
// NewLink creates a new defaultLink instance with provided parameters.
func NewLink(name string, category LinkCategory, href string) Link {
return &defaultLink{
name: name,
href: href,
category: category,
target: LinkTargetSelf,
}
}