Documentation
¶
Index ¶
- Constants
- func AddHeaders(rc *RequestContext)
- func AddSessionHeaders(rc *RequestContext)
- func Respond(w http.ResponseWriter, path, requestId string, producer runtime.Producer, ...)
- func RespondWithApiError(w http.ResponseWriter, r *http.Request, requestId string, ...)
- func RespondWithError(w http.ResponseWriter, r *http.Request, requestId string, ...)
- type EventLogger
- type RequestContext
- type Responder
- type ResponderImpl
- func (responder *ResponderImpl) GetProducer() runtime.Producer
- func (responder *ResponderImpl) Respond(data interface{}, httpStatus int)
- func (responder *ResponderImpl) RespondWithApiError(apiError *errorz.ApiError)
- func (responder *ResponderImpl) RespondWithCouldNotParseBody(err error)
- func (responder *ResponderImpl) RespondWithCouldNotReadBody(err error)
- func (responder *ResponderImpl) RespondWithCreatedId(id string, link rest_model.Link)
- func (responder *ResponderImpl) RespondWithEmptyOk()
- func (responder *ResponderImpl) RespondWithError(err error)
- func (responder *ResponderImpl) RespondWithFieldError(fe *errorz.FieldError)
- func (responder *ResponderImpl) RespondWithNotFound()
- func (responder *ResponderImpl) RespondWithNotFoundWithCause(cause error)
- func (responder *ResponderImpl) RespondWithOk(data interface{}, meta *rest_model.Meta)
- func (responder *ResponderImpl) RespondWithValidationErrors(errors *schema.ValidationErrors)
- func (responder *ResponderImpl) SetProducer(producer runtime.Producer)
Constants ¶
View Source
const ( IdPropertyName = "id" SubIdPropertyName = "subId" )
View Source
const ( ApiSessionExpirationSecondsHeader = "expiration-seconds" ApiSessionExpiresAtHeader = "expires-at" ServerHeader = "server" )
Variables ¶
This section is empty.
Functions ¶
func AddHeaders ¶ added in v0.17.56
func AddHeaders(rc *RequestContext)
func AddSessionHeaders ¶ added in v0.17.56
func AddSessionHeaders(rc *RequestContext)
func RespondWithApiError ¶ added in v0.14.35
func RespondWithError ¶ added in v0.14.35
Types ¶
type EventLogger ¶
type RequestContext ¶
type RequestContext struct {
Responder
Id string
ApiSession *model.ApiSession
Identity *model.Identity
ActivePermissions []string
ResponseWriter http.ResponseWriter
Request *http.Request
EventLogger EventLogger
SessionToken string
Body []byte
// contains filtered or unexported fields
}
func (*RequestContext) GetEntityId ¶ added in v0.14.35
func (rc *RequestContext) GetEntityId() (string, error)
func (*RequestContext) GetEntitySubId ¶ added in v0.14.35
func (rc *RequestContext) GetEntitySubId() (string, error)
func (*RequestContext) SetEntityId ¶ added in v0.14.35
func (rc *RequestContext) SetEntityId(id string)
func (*RequestContext) SetEntitySubId ¶ added in v0.14.35
func (rc *RequestContext) SetEntitySubId(id string)
type Responder ¶
type Responder interface {
Respond(data interface{}, httpStatus int)
RespondWithOk(data interface{}, meta *rest_model.Meta)
RespondWithEmptyOk()
RespondWithError(err error)
RespondWithApiError(apiError *errorz.ApiError)
SetProducer(producer runtime.Producer)
GetProducer() runtime.Producer
RespondWithCouldNotReadBody(err error)
RespondWithCouldNotParseBody(err error)
RespondWithValidationErrors(errors *schema.ValidationErrors)
RespondWithNotFound()
RespondWithNotFoundWithCause(cause error)
RespondWithFieldError(fe *errorz.FieldError)
RespondWithCreatedId(id string, link rest_model.Link)
}
todo: rename to Responder, remove old Responder and RequestResponder
type ResponderImpl ¶ added in v0.14.35
type ResponderImpl struct {
// contains filtered or unexported fields
}
func NewResponder ¶ added in v0.14.35
func NewResponder(rc *RequestContext) *ResponderImpl
func (*ResponderImpl) GetProducer ¶ added in v0.14.35
func (responder *ResponderImpl) GetProducer() runtime.Producer
func (*ResponderImpl) Respond ¶ added in v0.14.35
func (responder *ResponderImpl) Respond(data interface{}, httpStatus int)
func (*ResponderImpl) RespondWithApiError ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithApiError(apiError *errorz.ApiError)
func (*ResponderImpl) RespondWithCouldNotParseBody ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithCouldNotParseBody(err error)
func (*ResponderImpl) RespondWithCouldNotReadBody ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithCouldNotReadBody(err error)
func (*ResponderImpl) RespondWithCreatedId ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithCreatedId(id string, link rest_model.Link)
func (*ResponderImpl) RespondWithEmptyOk ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithEmptyOk()
func (*ResponderImpl) RespondWithError ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithError(err error)
func (*ResponderImpl) RespondWithFieldError ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithFieldError(fe *errorz.FieldError)
func (*ResponderImpl) RespondWithNotFound ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithNotFound()
func (*ResponderImpl) RespondWithNotFoundWithCause ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithNotFoundWithCause(cause error)
func (*ResponderImpl) RespondWithOk ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithOk(data interface{}, meta *rest_model.Meta)
func (*ResponderImpl) RespondWithValidationErrors ¶ added in v0.14.35
func (responder *ResponderImpl) RespondWithValidationErrors(errors *schema.ValidationErrors)
func (*ResponderImpl) SetProducer ¶ added in v0.14.35
func (responder *ResponderImpl) SetProducer(producer runtime.Producer)
Click to show internal directories.
Click to hide internal directories.