v1

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	With2FAAssertion = api.WithMetadataItem("assertion", cms.TwoFAAssertion{})
	WithSecurity     = api.WithSecurity(Security)
)
View Source
var Info = api.CRUDInfo{Area: "admin", Version: "v1"}
View Source
var Security = []map[string][]string{
	{"basic": {}},
	{"bearer": {}},
}

Functions

func ErrorTransformer

func ErrorTransformer(_ context.Context, err error) error

Types

type Admin

type Admin struct {
	api.List[model.Admin]
	api.Read[model.Admin, int64]
	// contains filtered or unexported fields
}

func NewAdmin

func NewAdmin(r repository.Admin, errorTransformer api.ErrorTransformerFunc) Admin

func (Admin) Area

func (Admin) Area() string

func (Admin) Register

func (r Admin) Register(e *echo.Echo, humaAPI huma.API)

func (Admin) Version

func (Admin) Version() string

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(
	repo repository.Admin,
	cache cms.Cache,
	secret string,
	tokenExpiry time.Duration,
	logger *zap.Logger,
) Auth

func (Auth) Area

func (Auth) Area() string

func (Auth) Register

func (r Auth) Register(_ *echo.Echo, humaAPI huma.API)

func (Auth) Version

func (Auth) Version() string

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

func NewConfiguration

func NewConfiguration(repo repository.Configuration, errorTransformer api.ErrorTransformerFunc) Configuration

func (Configuration) Area

func (Configuration) Area() string

func (Configuration) Register

func (h Configuration) Register(_ *echo.Echo, humaAPI huma.API)

func (Configuration) Version

func (Configuration) Version() string
type Menu struct {
	api.CRUD[MenuBody, MenuBody, model.Menu, int64]
}

func NewMenu

func NewMenu(repo repository.Menu, errorTransformer api.ErrorTransformerFunc) Menu
type MenuBody struct {
	NodeID  *int64 `json:"nodeID,omitempty" yaml:"nodeID,omitempty" required:"false"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty" required:"true"`
	Handle  string `json:"handle,omitempty" yaml:"handle,omitempty" required:"false"`
	Enabled bool   `json:"enabled,omitempty" yaml:"enabled,omitempty" required:"false"`
}
func (dto MenuBody) Decode(_ context.Context, m *model.Menu) error

type Node

type Node struct {
	api.CRUD[NodeBody, NodeBody, model.Node, int64]
}

func NewNode

func NewNode(repo repository.Node, errorTransformer api.ErrorTransformerFunc) Node

type NodeBody

type NodeBody struct {
	ParentID           int64             `json:"parentID,omitempty" yaml:"parentID,omitempty" required:"false"`
	Name               string            `json:"name,omitempty" yaml:"name,omitempty" required:"true"`
	Label              string            `json:"label,omitempty" yaml:"label,omitempty" required:"false"`
	URI                string            `json:"uri,omitempty" yaml:"uri,omitempty" required:"false"`
	Position           int               `json:"position,omitempty" yaml:"position,omitempty" required:"false"`
	DisplayChildren    bool              `json:"displayChildren,omitempty" yaml:"displayChildren,omitempty" required:"false"`
	Display            bool              `json:"display,omitempty" yaml:"display,omitempty" required:"false"`
	Attributes         map[string]string `json:"attributes,omitempty" yaml:"attributes,omitempty" required:"false"`
	LinkAttributes     map[string]string `json:"linkAttributes,omitempty" yaml:"linkAttributes,omitempty" required:"false"`
	ChildrenAttributes map[string]string `json:"childrenAttributes,omitempty" yaml:"childrenAttributes,omitempty" required:"false"`
	LabelAttributes    map[string]string `json:"labelAttributes,omitempty" yaml:"labelAttributes,omitempty" required:"false"`
	Metadata           map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"`
}

func (NodeBody) Decode

func (dto NodeBody) Decode(_ context.Context, m *model.Node) error

type OTP

type OTP struct {
	Body struct {
		Password string `json:"password,omitempty" required:"true" minLength:"6" maxLength:"6" pattern:"[0-9]+"`
	}
}

type Page

type Page struct {
	api.CRUD[PageBody, PageBody, model.Page, int64]
	// contains filtered or unexported fields
}

func NewPage

func NewPage(pageRepo repository.Page, cfgRepo repository.Configuration, errorTransformer api.ErrorTransformerFunc) Page

func (Page) HybridPatterns

func (h Page) HybridPatterns(e *echo.Echo) func(context.Context, *struct{}) (*api.Response[[]*Route], error)

func (Page) Register

func (h Page) Register(e *echo.Echo, humaAPI huma.API)

type PageBody

type PageBody struct {
	SiteID     int64             `json:"siteID,omitempty" yaml:"siteID,omitempty" required:"true"`
	ParentID   *int64            `json:"parentID,omitempty" yaml:"parentID,omitempty" required:"false"`
	Name       string            `json:"name,omitempty" yaml:"name,omitempty" required:"true"`
	Title      string            `json:"title,omitempty" yaml:"title,omitempty" required:"false"`
	Pattern    string            `json:"pattern,omitempty" yaml:"pattern,omitempty" required:"true"`
	Alias      string            `json:"alias,omitempty" yaml:"alias,omitempty" required:"false"`
	Slug       string            `json:"slug,omitempty" yaml:"slug,omitempty" required:"false"`
	CustomURL  string            `json:"customURL,omitempty" yaml:"customURL,omitempty" required:"false"`
	Javascript string            `json:"javascript,omitempty" yaml:"javascript,omitempty" required:"false"`
	Stylesheet string            `json:"stylesheet,omitempty" yaml:"stylesheet,omitempty" required:"false"`
	Template   string            `json:"template,omitempty" yaml:"template,omitempty" required:"true"`
	Decorate   bool              `json:"decorate,omitempty" yaml:"decorate,omitempty" required:"false"`
	Position   int               `json:"position,omitempty" yaml:"position,omitempty" required:"false"`
	Headers    map[string]string `json:"headers,omitempty" yaml:"headers,omitempty" required:"false"`
	Metas      []model.Meta      `json:"metas,omitempty" yaml:"metas,omitempty" required:"false"`
	Metadata   map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"`
	Published  *time.Time        `json:"published,omitempty" yaml:"published,omitempty" required:"false"`
	Expired    *time.Time        `json:"expired,omitempty" yaml:"expired,omitempty" required:"false"`
}

func (PageBody) Decode

func (dto PageBody) Decode(_ context.Context, m *model.Page) error

type RefreshToken

type RefreshToken struct {
	Body struct {
		RefreshToken string `json:"refreshToken,omitempty" required:"true"`
	}
}

type Route

type Route struct {
	Pattern string   `json:"pattern" yaml:"pattern" required:"true"`
	Methods []string `json:"methods,omitempty" yaml:"methods,omitempty" required:"false"`
}

type Session

type Session struct {
	AccessToken  string `json:"accessToken" required:"true"`
	RefreshToken string `json:"refreshToken" required:"true"`
}

type SignIn

type SignIn struct {
	Body struct {
		Email    string `json:"email,omitempty" required:"true" minLength:"3" maxLength:"254" format:"email"`
		Password string `json:"password,omitempty" required:"true" minLength:"8" maxLength:"64"`
	}
}

type Site

type Site struct {
	api.CRUD[SiteBody, SiteBody, model.Site, int64]
}

func NewSite

func NewSite(repo repository.Site, errorTransformer api.ErrorTransformerFunc) Site

type SiteBody

type SiteBody struct {
	Name         string            `json:"name,omitempty" yaml:"name,omitempty" required:"true"`
	Title        string            `json:"title,omitempty" yaml:"title,omitempty" required:"false"`
	Separator    string            `json:"separator,omitempty" yaml:"separator,omitempty" required:"true"`
	Host         string            `json:"host,omitempty" yaml:"host,omitempty" required:"true"`
	Locale       string            `json:"locale,omitempty" yaml:"locale,omitempty" required:"false"`
	RelativePath string            `json:"relativePath,omitempty" yaml:"relativePath,omitempty" required:"false"`
	IsDefault    bool              `json:"isDefault,omitempty" yaml:"isDefault,omitempty" required:"false"`
	Javascript   string            `json:"javascript,omitempty" yaml:"javascript,omitempty" required:"false"`
	Stylesheet   string            `json:"stylesheet,omitempty" yaml:"stylesheet,omitempty" required:"false"`
	Metas        []model.Meta      `json:"metas,omitempty" yaml:"metas,omitempty" required:"false"`
	Metadata     map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty" required:"false"`
	Published    *time.Time        `json:"published,omitempty" yaml:"published,omitempty" required:"false"`
	Expired      *time.Time        `json:"expired,omitempty" yaml:"expired,omitempty" required:"false"`
}

func (SiteBody) Decode

func (dto SiteBody) Decode(_ context.Context, m *model.Site) error

type Template

type Template struct {
	api.CRUD[TemplateBody, TemplateBody, model.Template, int64]
}

func NewTemplate

func NewTemplate(repo repository.Template, errorTransformer api.ErrorTransformerFunc) Template

type TemplateBody

type TemplateBody struct {
	Name    string `json:"name,omitempty" yaml:"name,omitempty" required:"true"`
	Content string `json:"content,omitempty" yaml:"content,omitempty" required:"false"`
	Enabled bool   `json:"enabled,omitempty" yaml:"enabled,omitempty" required:"false"`
}

func (TemplateBody) Decode

func (dto TemplateBody) Decode(_ context.Context, m *model.Template) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL