nirvash/archetype/adapter.go

47 lines
895 B
Go

package archetype
import (
"time"
)
type BuildStatus struct {
Success bool
Message string
}
type DeployStatus BuildStatus
type RevertStatus BuildStatus
type Page struct {
Title string
Content string
Edited time.Time
Error string
}
type ConfigOption struct {
Name string
Type string
Hidden bool
}
type BuildOption ConfigOption
type Adapter interface {
Init(cfg *Config)
Name() string
EditableSlugs() bool
BuildOptions() []BuildOption
GetConfig() map[ConfigOption]string
SetConfig(map[ConfigOption]string) error
ListPages() map[string]string
GetPage(slug string) Page
FormatPage(raw string) string
FormattingHelp() string
CreatePage(slug, title, content string) error
SavePage(oldSlug, newSlug, title, content string) error
DeletePage(slug string) error
Build(buildOptions map[BuildOption]string) BuildStatus
Deploy() DeployStatus
Revert() RevertStatus
}