Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Code int `json:"code,omitempty"` Detail string `json:"detail,omitempty"` Source *SourceResponse `json:"source,omitempty"` }
ErrorResponse represents the error list of the request
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Error method inplement built-in error interface
type ErrorResponses ¶
type ErrorResponses []ErrorResponse
ErrorResponses is the list of ErrorResponse
func (*ErrorResponses) Append ¶
func (e *ErrorResponses) Append(newE ErrorResponse)
Append a new error response to the list of errors
func (ErrorResponses) Error ¶
func (e ErrorResponses) Error() string
Error method inplement built-in error interface
func (*ErrorResponses) FromValidationErrors ¶
func (e *ErrorResponses) FromValidationErrors(vldErrs validator.ValidationErrors)
FromValidationErrors converts from validator.ValidationErrors to presenter.ErrorResponse
type IDResponse ¶
type IDResponse struct {
ID interface{} `json:"id,omitempty"`
}
IDResponse represent the common data response for many requests
type MetaResponse ¶
type MetaResponse struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Total uint64 `json:"total,omitempty"` NextCursor string `json:"next_cursor,omitempty"` PreviousCursor string `json:"previous_cursor,omitempty"` }
MetaResponse represents meta-information
type PagingRequest ¶
type PagingRequest struct { Size uint64 `mapstructure:"size" json:"page[size]"` Number uint64 `mapstructure:"number" json:"page[number]"` }
PagingRequest request
type RegisterRequest ¶
type RegisterRequest struct { Password string `json:"password" binding:"required"` Username string `json:"username" binding:"required"` }
RegisterRequest body of register request
type Response ¶
type Response struct { Meta MetaResponse `json:"meta,omitempty"` Data interface{} `json:"data,omitempty"` Errors ErrorResponses `json:"errors,omitempty"` }
Response represents the response of every request
type SourceResponse ¶
type SourceResponse struct { Pointer string `json:"pointer,omitempty"` Parameter string `json:"parameter,omitempty"` }
SourceResponse an object containing references to the source of the error, optionally including any of the following members: - pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. - parameter: a string indicating which URI query parameter caused the error.
type UserInformation ¶
UserInformation represents information of a user