39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
type RepoHandler struct{}
|
|
|
|
func NewRepoHandler() *RepoHandler {
|
|
return &RepoHandler{}
|
|
}
|
|
|
|
func (h *RepoHandler) List(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode([]any{})
|
|
}
|
|
|
|
func (h *RepoHandler) Create(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.WriteHeader(http.StatusCreated)
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "created"})
|
|
}
|
|
|
|
func (h *RepoHandler) Get(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
|
|
}
|
|
|
|
func (h *RepoHandler) Tree(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode([]any{})
|
|
}
|
|
|
|
func (h *RepoHandler) Blob(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(map[string]string{"content": ""})
|
|
}
|