Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultRequestErrorHandler api.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusBadRequest) e := v1.Error{Type: v1.BadRequest, Description: err.Error()} if err := json.NewEncoder(w).Encode(e); err != nil { _, _ = fmt.Fprintf(w, "{\"type\":\"%s\",\"description\":\"%s\"}", v1.InternalError, "failed to serialize error") } } DefaultResponseErrorHandler api.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { w.Header().Set("Content-Type", "application/json") var ( status = http.StatusInternalServerError type_ = v1.InternalError httpErr *api.HTTPError ) if errors.As(err, &httpErr) { status = httpErr.Status if httpErr.Type != "" { type_ = v1.ErrorType(httpErr.Type) } } w.WriteHeader(status) e := v1.Error{Type: type_, Description: err.Error()} if err := json.NewEncoder(w).Encode(e); err != nil { _, _ = fmt.Fprintf(w, "{\"type\":\"%s\",\"description\":\"%s\"}", v1.InternalError, "failed to serialize error") } } )
Functions ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a REST server for the nero v1 API.
func (*Server) DeleteRepoId ¶
func (s *Server) DeleteRepoId(_ context.Context, request v1.DeleteRepoIdRequestObject) (v1.DeleteRepoIdResponseObject, error)
func (*Server) PostRepo ¶
func (s *Server) PostRepo(_ context.Context, request v1.PostRepoRequestObject) (v1.PostRepoResponseObject, error)
func (*Server) Repos ¶
func (s *Server) Repos() []*repo.Repository
Repos returns all repositories available to the server.
Click to show internal directories.
Click to hide internal directories.