handlers

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMethodNotAllowed = &ErrorResponse{HTTPStatusCode: 405, StatusText: "Method not allowed"}
	ErrNotFound         = &ErrorResponse{HTTPStatusCode: 404, StatusText: "Resource not found"}
	ErrBadRequest       = &ErrorResponse{HTTPStatusCode: 400, StatusText: "Bad request"}
)
View Source
var ErrDir = errors.New("path is dir")

Functions

func NewAppListResponse added in v0.3.0

func NewAppListResponse(appGroups []models.AppGroup) []render.Renderer

func NewAppResource added in v0.3.0

func NewAppResource(service services.AppService) *appResource

func NewBookmarkListResponse added in v0.3.0

func NewBookmarkListResponse(bookmarkGroups []models.BookmarkGroup) []render.Renderer

func NewBookmarkResource added in v0.3.0

func NewBookmarkResource() *bookmarkResource

func NewHandler added in v0.3.0

func NewHandler() http.Handler

func NewStartpageResource

func NewStartpageResource(service services.StartpageService) *startpageResource

Types

type AppResponse added in v0.3.0

type AppResponse struct {
	models.AppGroup
}

func NewAppResponse added in v0.3.0

func NewAppResponse(appGroup models.AppGroup) *AppResponse

func (*AppResponse) Render added in v0.3.0

func (rd *AppResponse) Render(w http.ResponseWriter, r *http.Request) error

type BookmarkResponse added in v0.3.0

type BookmarkResponse struct {
	models.BookmarkGroup
}

func NewBookmarkResponse added in v0.3.0

func NewBookmarkResponse(bookmarkGroup models.BookmarkGroup) *BookmarkResponse

func (*BookmarkResponse) Render added in v0.3.0

type ErrorResponse added in v0.3.0

type ErrorResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

func ErrInvalidRequest

func ErrInvalidRequest(err error) *ErrorResponse

func ErrServerError added in v0.3.0

func ErrServerError(err error) *ErrorResponse

func (*ErrorResponse) Render added in v0.3.0

type StartpageRequest

type StartpageRequest struct {
	*models.Startpage

	ProtectedID string `json:"id"`
}

func (*StartpageRequest) Bind

func (s *StartpageRequest) Bind(r *http.Request) error

type StartpageResponse

type StartpageResponse struct {
	*models.Startpage
}

func NewStartpageResponse

func NewStartpageResponse(startpage *models.Startpage) *StartpageResponse

func (*StartpageResponse) Render

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL