Documentation ¶
Index ¶
- func NewRouter(baseUrl string, handler v1.StrictServerInterface) http.Handler
- type ErrorHandler
- type Server
- func (s *Server) Close() (err error)
- func (s *Server) GetRepoById(_ context.Context, request v1.GetRepoByIdRequestObject) (v1.GetRepoByIdResponseObject, error)
- func (s *Server) GetRepoMedia(_ context.Context, request v1.GetRepoMediaRequestObject) (v1.GetRepoMediaResponseObject, error)
- func (s *Server) GetRepoMediaById(_ context.Context, request v1.GetRepoMediaByIdRequestObject) (v1.GetRepoMediaByIdResponseObject, error)
- func (s *Server) GetRepoMediaDownload(_ context.Context, request v1.GetRepoMediaDownloadRequestObject) (v1.GetRepoMediaDownloadResponseObject, error)
- func (s *Server) GetRepoMediaStream(_ context.Context, request v1.GetRepoMediaStreamRequestObject) (v1.GetRepoMediaStreamResponseObject, error)
- func (s *Server) GetRepoMediaStreams(_ context.Context, _ v1.GetRepoMediaStreamsRequestObject) (v1.GetRepoMediaStreamsResponseObject, error)
- func (s *Server) GetRepos(_ context.Context, _ v1.GetReposRequestObject) (v1.GetReposResponseObject, error)
- func (s *Server) Repos() []repo.Repository
- type WrapMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorHandler ¶
type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error)
ErrorHandler handles translating errors to HTTP responses.
var ( DefaultRequestErrorHandler 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 ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusInternalServerError) e := v1.Error{Type: v1.InternalError, 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") } } )
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a REST server for the Katana v1 API.
func (*Server) GetRepoById ¶
func (s *Server) GetRepoById(_ context.Context, request v1.GetRepoByIdRequestObject) (v1.GetRepoByIdResponseObject, error)
func (*Server) GetRepoMedia ¶
func (s *Server) GetRepoMedia(_ context.Context, request v1.GetRepoMediaRequestObject) (v1.GetRepoMediaResponseObject, error)
func (*Server) GetRepoMediaById ¶
func (s *Server) GetRepoMediaById(_ context.Context, request v1.GetRepoMediaByIdRequestObject) (v1.GetRepoMediaByIdResponseObject, error)
func (*Server) GetRepoMediaDownload ¶
func (s *Server) GetRepoMediaDownload(_ context.Context, request v1.GetRepoMediaDownloadRequestObject) (v1.GetRepoMediaDownloadResponseObject, error)
func (*Server) GetRepoMediaStream ¶
func (s *Server) GetRepoMediaStream(_ context.Context, request v1.GetRepoMediaStreamRequestObject) (v1.GetRepoMediaStreamResponseObject, error)
func (*Server) GetRepoMediaStreams ¶
func (s *Server) GetRepoMediaStreams(_ context.Context, _ v1.GetRepoMediaStreamsRequestObject) (v1.GetRepoMediaStreamsResponseObject, error)
func (*Server) GetRepos ¶
func (s *Server) GetRepos(_ context.Context, _ v1.GetReposRequestObject) (v1.GetReposResponseObject, 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.