Documentation ¶
Index ¶
- Variables
- func DeleteEmail(w http.ResponseWriter, r *http.Request)
- func DeleteEmails(w http.ResponseWriter, r *http.Request)
- func ErrInvalidRequest(err error) render.Renderer
- func GetEmailById(w http.ResponseWriter, r *http.Request)
- func GetEmailByMessageId(w http.ResponseWriter, r *http.Request)
- func ListEmails(w http.ResponseWriter, r *http.Request)
- func NewRouter() http.Handler
- func QueryEmails(w http.ResponseWriter, r *http.Request)
- func SearchEmails(w http.ResponseWriter, r *http.Request)
- func UpdateEmail(w http.ResponseWriter, r *http.Request)
- func UpdateEmails(w http.ResponseWriter, r *http.Request)
- type ErrResponse
Constants ¶
This section is empty.
Variables ¶
var ErrInternalServer = &ErrResponse{HTTPStatusCode: 500, StatusText: "Internal server error."}
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}
Functions ¶
func DeleteEmail ¶
func DeleteEmail(w http.ResponseWriter, r *http.Request)
DeleteEmail deletes an email by its id.
func DeleteEmails ¶
func DeleteEmails(w http.ResponseWriter, r *http.Request)
DeleteEmails deletes emails by their ids.
func ErrInvalidRequest ¶
func GetEmailById ¶
func GetEmailById(w http.ResponseWriter, r *http.Request)
GetEmailById returns an email by its id.
func GetEmailByMessageId ¶
func GetEmailByMessageId(w http.ResponseWriter, r *http.Request)
GetEmailByMessageId returns an email by its message id.
func ListEmails ¶
func ListEmails(w http.ResponseWriter, r *http.Request)
ListEmails returns a list of all emails in zinc.
func QueryEmails ¶
func QueryEmails(w http.ResponseWriter, r *http.Request)
QueryEmails returns a list of emails that match the query string. The query string comes as a query parameter.
func SearchEmails ¶
func SearchEmails(w http.ResponseWriter, r *http.Request)
SearchEmails returns a list of emails that match the search query. The search query comes from the body of the request as a JSON object.
func UpdateEmail ¶
func UpdateEmail(w http.ResponseWriter, r *http.Request)
UpdateEmail updates an email by its id.
func UpdateEmails ¶
func UpdateEmails(w http.ResponseWriter, r *http.Request)
UpdateEmails updates multiple emails.
Types ¶
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code StatusText string `json:"status"` // user-level status message ErrorText string `json:"error,omitempty"` // application-level error message, for debugging }
ErrResponse renderer type for handling all sorts of errors.
In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error