Documentation ¶
Index ¶
- type LibraryRequest
- type MW
- func (mw *MW) AddToLibrary(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (mw *MW) Authorize(h httprouter.Handle) httprouter.Handle
- func (mw *MW) DeleteFromLibrary(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (mw *MW) Library(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (mw *MW) SearchBooks(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (mw *MW) SearchCategories(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- func (mw *MW) SingleBook(w http.ResponseWriter, r *http.Request, p httprouter.Params)
- type Response
- type ResponseError
- type SearchBooksRequest
- type SearchCategoryRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LibraryRequest ¶
LibraryRequest describes common ADD / DELETE request for user library.
type MW ¶
type MW struct {
// contains filtered or unexported fields
}
MW defines service which dependent on database.
func (*MW) AddToLibrary ¶
func (mw *MW) AddToLibrary(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
AddToLibrary saves given book to the library of current user.
func (*MW) Authorize ¶
func (mw *MW) Authorize(h httprouter.Handle) httprouter.Handle
Authorize middleware: check authorization, save user in context and move request to given handler.
func (*MW) DeleteFromLibrary ¶
func (mw *MW) DeleteFromLibrary(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
DeleteFromLibrary drop given book from the library of current user.
func (*MW) Library ¶
func (mw *MW) Library(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Library returns the library of current user.
func (*MW) SearchBooks ¶
func (mw *MW) SearchBooks(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
SearchBooks finds multiple books by the given search criteria.
func (*MW) SearchCategories ¶
func (mw *MW) SearchCategories(w http.ResponseWriter, r *http.Request, p httprouter.Params)
func (*MW) SingleBook ¶
func (mw *MW) SingleBook(w http.ResponseWriter, r *http.Request, p httprouter.Params)
SingleBook finds book from database by its id with volumes available for this book.
type Response ¶
type Response struct { Data interface{} `json:"data,omitempty"` Meta interface{} `json:"meta,omitempty"` Error *ResponseError `json:"error,omitempty"` }
Response defines common block of API response.
type ResponseError ¶
ResponseError defines error block of API response.
type SearchBooksRequest ¶
type SearchBooksRequest struct {
// contains filtered or unexported fields
}
SearchBooksRequest describes parameters of books searching request.
type SearchCategoryRequest ¶
type SearchCategoryRequest struct {
// contains filtered or unexported fields
}
SearchCategoryRequest describes parameters of categories searching request.