79 lines
1.2 KiB
Go
79 lines
1.2 KiB
Go
package routes
|
|
|
|
import "net/http"
|
|
|
|
type APIHandlers struct {
|
|
CreateObject http.HandlerFunc
|
|
ListObjects 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
|
|
}
|
|
|
|
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/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,
|
|
)
|
|
}
|