Files
pages/internal/server/routes/api.go
T

97 lines
1.5 KiB
Go

package routes
import "net/http"
type APIHandlers struct {
CreateObject http.HandlerFunc
ListObjects http.HandlerFunc
DeleteObject http.HandlerFunc
SaveRevision http.HandlerFunc
ListRevisions http.HandlerFunc
RestoreRevision http.HandlerFunc
RenderMarkdown http.HandlerFunc
AddTag http.HandlerFunc
BindPath http.HandlerFunc
RenamePath http.HandlerFunc
RenamePreview http.HandlerFunc
RemovePath http.HandlerFunc
ZombieList http.HandlerFunc
ZombiePurge http.HandlerFunc
}
func RegisterAPIRoutes(
mux *http.ServeMux,
h APIHandlers,
) {
mux.HandleFunc(
"/_/api/v1/object/create",
h.CreateObject,
)
mux.HandleFunc(
"/_/api/v1/object/list",
h.ListObjects,
)
mux.HandleFunc(
"/_/api/v1/object/delete",
h.DeleteObject,
)
mux.HandleFunc(
"/_/api/v1/revisions/save",
h.SaveRevision,
)
mux.HandleFunc(
"/_/api/v1/revisions/list",
h.ListRevisions,
)
mux.HandleFunc(
"/_/api/v1/revisions/restore",
h.RestoreRevision,
)
mux.HandleFunc(
"/_/api/v1/render/markdown",
h.RenderMarkdown,
)
mux.HandleFunc(
"/_/api/v1/tag/add",
h.AddTag,
)
mux.HandleFunc(
"/_/api/v1/path/bind",
h.BindPath,
)
mux.HandleFunc(
"/_/api/v1/path/rename",
h.RenamePath,
)
mux.HandleFunc(
"/_/api/v1/path/rename-preview",
h.RenamePreview,
)
mux.HandleFunc(
"/_/api/v1/path/remove",
h.RemovePath,
)
mux.HandleFunc(
"/_/api/v1/gc/zombies/list",
h.ZombieList,
)
mux.HandleFunc(
"/_/api/v1/gc/zombies/purge",
h.ZombiePurge,
)
}