all repos — nirvash @ main

modular CMS using the quartzgun library

archetype/adapter.go (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
}

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
}