Documentation ¶
Overview ¶
PAckage handler implements router and endpoints for REST API
Index ¶
- Variables
- func ErrInternalServer(err error) render.Renderer
- func ErrInvalidRequest(err error) render.Renderer
- func ErrNotFound(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func OrdersListResponse(orders []*core.Order) []render.Renderer
- func SendRequestID(next http.Handler) http.Handler
- type CreateOrderRequest
- type Deps
- type ErrResponse
- type Handler
- type LaunchpadService
- type OrderHandler
- type OrderResponse
- type OrderService
- type Services
- type TripService
- type UserService
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ErrInternalServer ¶
func ErrInvalidRequest ¶
func ErrNotFound ¶
Types ¶
type CreateOrderRequest ¶
type CreateOrderRequest struct { *dto.Order *dto.User FirstName string `json:"first_name"` LastName string `json:"last_name"` Gender string `json:"gender"` Birthday string `json:"birthday"` LaunchpadID string `json:"launchpad_id"` DestinationID string `json:"destination_id"` LaunchDate string `json:"launch_date"` }
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
type Handler ¶
type Handler struct { Order *OrderHandler // contains filtered or unexported fields }
Handler represents rest modules of API
func (*Handler) Logger ¶
Logger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.
type LaunchpadService ¶
type OrderHandler ¶
type OrderHandler struct {
// contains filtered or unexported fields
}
OrderHandler represents handler for rest endpoints related to order entity
func NewOrderHandler ¶
func NewOrderHandler(services Services, log *zap.Logger) *OrderHandler
NewOrderHandler returns new instance of orders handler
type OrderResponse ¶
func (*OrderResponse) Render ¶
func (or *OrderResponse) Render(w http.ResponseWriter, r *http.Request) error
type OrderService ¶
type Services ¶
type Services struct { Launchpad LaunchpadService Order OrderService Trip TripService User UserService }
type TripService ¶
Click to show internal directories.
Click to hide internal directories.