handler

package
v0.0.0-...-e33bd30 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorDetail

type ErrorDetail struct {
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

ErrorDetail represents individual JSON API error detail

type ErrorResponse

type ErrorResponse struct {
	Errors []ErrorDetail `json:"errors"`
	Meta   interface{}   `json:"meta"`
}

ErrorResponse is the standard JSON API failed errors-meta response

type InvalidAttributeError

type InvalidAttributeError struct {
	Field        string
	ValidatorTag string
}

InvalidAttributeError is used mostly in request payload validation

func (*InvalidAttributeError) Error

func (e *InvalidAttributeError) Error() string

type InvalidValidationError

type InvalidValidationError struct {
	Detail string
}

InvalidValidationError is used mostly in request payload validation

func (*InvalidValidationError) Error

func (e *InvalidValidationError) Error() string

type StoryHandler

type StoryHandler struct {
	StoryUsecase writing.StoryUsecase
}

StoryHandler is the controller for story scope

func NewStoryHandler

func NewStoryHandler(storyUsecase writing.StoryUsecase) *StoryHandler

NewStoryHandler initializes fresh handler

func (*StoryHandler) Create

func (h *StoryHandler) Create(w http.ResponseWriter, r *http.Request)

Create handles `POST /stories`

func (*StoryHandler) Delete

func (h *StoryHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete handles `DELETE /stories/{id}`

func (*StoryHandler) Get

Show handles `GET /stories/{id}`

func (*StoryHandler) Get10LatestStories

func (h *StoryHandler) Get10LatestStories(w http.ResponseWriter, r *http.Request)

Get10LatestStories handles `GET /stories/ten-latests`

func (*StoryHandler) GetByAuthorID

func (h *StoryHandler) GetByAuthorID(w http.ResponseWriter, r *http.Request)

GetByAuthorID handles `GET /stories/by-authors/{id}`

func (*StoryHandler) Update

func (h *StoryHandler) Update(w http.ResponseWriter, r *http.Request)

Update handles `PATCH /stories/{id}`

type SuccessResponse

type SuccessResponse struct {
	Data interface{} `json:"data"`
	Meta interface{} `json:"meta"`
}

SuccessResponse is the standard JSON API success data-meta response

Jump to

Keyboard shortcuts

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