response

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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

func AddHeaders(rc *RequestContext)

func AddSessionHeaders

func AddSessionHeaders(rc *RequestContext)

func GetApiEnrollmentVersion

func GetApiEnrollmentVersion() string

func GetApiVersion

func GetApiVersion() string

Types

type EdgeResponseMapper

type EdgeResponseMapper struct{}

func (EdgeResponseMapper) EmptyOkData

func (EdgeResponseMapper) EmptyOkData() interface{}

func (EdgeResponseMapper) MapApiError

func (self EdgeResponseMapper) MapApiError(requestId string, apiError *errorz.ApiError) interface{}

type EventLogger

type EventLogger interface {
	Log(actorType, actorId, eventType, entityType, entityId, formatString string, formatData []string, data map[interface{}]interface{})
}

type RequestContext

type RequestContext struct {
	Responder

	// The unique id of the current request
	Id string

	// An opaque session token
	SessionToken string
	Jwt          *jwt.Token
	Claims       *common.AccessClaims
	ApiSession   *model.ApiSession

	Identity          *model.Identity
	AuthPolicy        *model.AuthPolicy
	AuthQueries       rest_model.AuthQueryList
	ActivePermissions []string
	ResponseWriter    http.ResponseWriter
	Request           *http.Request

	Body      []byte
	StartTime time.Time
	// contains filtered or unexported fields
}

func (*RequestContext) GetBody

func (rc *RequestContext) GetBody() []byte

func (*RequestContext) GetEntityId

func (rc *RequestContext) GetEntityId() (string, error)

func (*RequestContext) GetEntitySubId

func (rc *RequestContext) GetEntitySubId() (string, error)

func (*RequestContext) GetId

func (rc *RequestContext) GetId() string

func (*RequestContext) GetRequest

func (rc *RequestContext) GetRequest() *http.Request

func (*RequestContext) GetResponseWriter

func (rc *RequestContext) GetResponseWriter() http.ResponseWriter

func (*RequestContext) NewChangeContext

func (rc *RequestContext) NewChangeContext() *change.Context

func (*RequestContext) SetEntityId

func (rc *RequestContext) SetEntityId(id string)

func (*RequestContext) SetEntitySubId

func (rc *RequestContext) SetEntitySubId(id string)

type Responder

type Responder interface {
	api.Responder
	RespondWithOk(data interface{}, meta *rest_model.Meta)
	RespondWithCreatedId(id string, link rest_model.Link)
}

todo: rename to Responder, remove old Responder and RequestResponder

type ResponderImpl

type ResponderImpl struct {
	api.Responder
}

func NewResponder

func NewResponder(rc *RequestContext) *ResponderImpl

func (*ResponderImpl) RespondWithCreatedId

func (responder *ResponderImpl) RespondWithCreatedId(id string, link rest_model.Link)

func (*ResponderImpl) RespondWithOk

func (responder *ResponderImpl) RespondWithOk(data interface{}, meta *rest_model.Meta)

Jump to

Keyboard shortcuts

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