service

package
v1.29.0-mobile.11 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2018 License: BSD-2-Clause Imports: 12 Imported by: 24

Documentation

Index

Constants

View Source
const (
	HTTPHeaderTraceRequest = "X-Tidepool-Trace-Request"
	HTTPHeaderTraceSession = "X-Tidepool-Trace-Session"
)

Variables

This section is empty.

Functions

func AddDateHeader added in v1.10.0

func AddDateHeader(response rest.ResponseWriter)

func CopyRequestTrace

func CopyRequestTrace(sourceRequest *rest.Request, destinationRequest *http.Request) error

func GetRequestAuthDetails added in v1.20.0

func GetRequestAuthDetails(req *rest.Request) request.Details

func GetRequestLogger

func GetRequestLogger(req *rest.Request) log.Logger

func GetRequestTraceRequest

func GetRequestTraceRequest(req *rest.Request) string

func GetRequestTraceSession

func GetRequestTraceSession(req *rest.Request) string

func QuoteIfString added in v1.20.0

func QuoteIfString(interfaceValue interface{}) interface{}

func SetRequestAuthDetails added in v1.20.0

func SetRequestAuthDetails(req *rest.Request, details request.Details)

func SetRequestErrors

func SetRequestErrors(req *rest.Request, errs []*Error)

func SetRequestLogger

func SetRequestLogger(req *rest.Request, logger log.Logger)

func SetRequestTraceRequest

func SetRequestTraceRequest(req *rest.Request, traceRequest string)

func SetRequestTraceSession

func SetRequestTraceSession(req *rest.Request, traceSession string)

Types

type API added in v1.0.0

type API interface {
	InitializeMiddleware() error
	InitializeRouters(routers ...Router) error

	Status() *rest.Status

	Handler() http.Handler
}

type Context

type Context interface {
	Response() rest.ResponseWriter
	Request() *rest.Request

	RespondWithError(err *Error)
	RespondWithInternalServerFailure(message string, failure ...interface{})
	RespondWithStatusAndErrors(statusCode int, errors []*Error)
	RespondWithStatusAndData(statusCode int, data interface{})
}

type Error

type Error struct {
	Code   string      `json:"code,omitempty"`
	Title  string      `json:"title,omitempty"`
	Detail string      `json:"detail,omitempty"`
	Status int         `json:"status,string,omitempty"`
	Source *Source     `json:"source,omitempty"`
	Meta   interface{} `json:"meta,omitempty"`
}

func ErrorInternalServerFailure

func ErrorInternalServerFailure() *Error

func ErrorJSONMalformed added in v1.0.0

func ErrorJSONMalformed() *Error

func ErrorTypeNotArray added in v1.0.0

func ErrorTypeNotArray(value interface{}) *Error

func ErrorTypeNotBoolean added in v1.0.0

func ErrorTypeNotBoolean(value interface{}) *Error

func ErrorTypeNotFloat added in v1.0.0

func ErrorTypeNotFloat(value interface{}) *Error

func ErrorTypeNotInteger added in v1.0.0

func ErrorTypeNotInteger(value interface{}) *Error

func ErrorTypeNotObject added in v1.0.0

func ErrorTypeNotObject(value interface{}) *Error

func ErrorTypeNotString added in v1.0.0

func ErrorTypeNotString(value interface{}) *Error

func ErrorTypeNotTime added in v1.26.0

func ErrorTypeNotTime(value interface{}) *Error

func ErrorUnauthenticated added in v1.0.0

func ErrorUnauthenticated() *Error

func ErrorUnauthorized added in v1.0.0

func ErrorUnauthorized() *Error

func ErrorValueNotExists added in v1.0.0

func ErrorValueNotExists() *Error

func ErrorValueNotGreaterThanOrEqualTo added in v1.0.0

func ErrorValueNotGreaterThanOrEqualTo(value interface{}, limit interface{}) *Error

func ErrorValueNotInRange added in v1.0.0

func ErrorValueNotInRange(value interface{}, lowerLimit interface{}, upperLimit interface{}) *Error

func ErrorValueStringNotOneOf added in v1.0.0

func ErrorValueStringNotOneOf(value string, allowedValues []string) *Error

func ErrorValueTimeNotParsable added in v1.26.0

func ErrorValueTimeNotParsable(value string, layout string) *Error

func GetRequestErrors

func GetRequestErrors(req *rest.Request) []*Error

func (*Error) WithMeta

func (e *Error) WithMeta(meta interface{}) *Error

func (*Error) WithSourceParameter

func (e *Error) WithSourceParameter(parameter string) *Error

func (*Error) WithSourcePointer

func (e *Error) WithSourcePointer(pointer string) *Error

type Meta added in v1.20.0

type Meta struct {
	Trace *Trace `json:"trace,omitempty"`
}

type Router added in v1.20.0

type Router interface {
	Routes() []*rest.Route
}

type Service added in v1.0.0

type Service interface {
	VersionReporter() version.Reporter
	ConfigReporter() config.Reporter
	Logger() log.Logger

	Secret() string
	AuthClient() auth.Client
}

type Source

type Source struct {
	Parameter string `json:"parameter,omitempty"`
	Pointer   string `json:"pointer,omitempty"`
}

type Trace added in v1.20.0

type Trace struct {
	Request string `json:"request,omitempty"`
	Session string `json:"session,omitempty"`
}

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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