Documentation ¶
Index ¶
- Constants
- func CopyTrace(ctx context.Context, req *http.Request) error
- func DecodeObject(source structure.Source, reader io.Reader, object interface{}) error
- func DecodeOptionalRequestPathParameter(req *rest.Request, key string, validator func(value string) bool) (*string, error)
- func DecodeRequestBody(req *http.Request, object interface{}) error
- func DecodeRequestPathParameter(req *rest.Request, key string, validator func(value string) bool) (string, error)
- func DecodeRequestQuery(req *http.Request, objectParsables ...structure.ObjectParsable) error
- func DecodeResponseBody(res *http.Response, object interface{}) error
- func DecodeValues(values map[string][]string, objectParsables ...structure.ObjectParsable) error
- func ErrorBadRequest() error
- func ErrorDigestsNotEqual(value string, calculated string) error
- func ErrorExtensionNotSupported(value string) error
- func ErrorHeaderInvalid(key string) error
- func ErrorHeaderMissing(key string) error
- func ErrorInternalServerError(err error) error
- func ErrorJSONMalformed() error
- func ErrorJSONNotFound() error
- func ErrorMediaTypeNotSupported(value string) error
- func ErrorParameterInvalid(key string) error
- func ErrorParameterMissing(key string) error
- func ErrorResourceNotFound() error
- func ErrorResourceNotFoundWithID(id string) error
- func ErrorResourceNotFoundWithIDAndOptionalRevision(id string, revision *int) error
- func ErrorResourceNotFoundWithIDAndRevision(id string, revision int) error
- func ErrorResourceTooLarge() error
- func ErrorTooManyRequests() error
- func ErrorUnauthenticated() error
- func ErrorUnauthorized() error
- func ErrorUnexpectedResponse(res *http.Response, req *http.Request) error
- func GetErrorFromContext(ctx context.Context) error
- func IsErrorInternalServerError(err error) bool
- func IsErrorResourceNotFound(err error) bool
- func IsErrorUnauthenticated(err error) bool
- func IsErrorUnauthorized(err error) bool
- func IsStatusCodeClientError(statusCode int) bool
- func IsStatusCodeRedirection(statusCode int) bool
- func IsStatusCodeSuccess(statusCode int) bool
- func NewContextWithContextError(ctx context.Context) context.Context
- func NewContextWithDetails(ctx context.Context, details Details) context.Context
- func NewContextWithTraceRequest(ctx context.Context, traceRequest string) context.Context
- func NewContextWithTraceSession(ctx context.Context, traceSession string) context.Context
- func NormalizeObjects(source structure.Source, objects ...interface{}) error
- func ParseArrayParseableStreamObject(source structure.Source, reader io.Reader, ...) error
- func ParseDigestMD5Header(header http.Header, key string) (*string, error)
- func ParseIntHeader(header http.Header, key string) (*int, error)
- func ParseMediaTypeHeader(header http.Header, key string) (*string, error)
- func ParseObjectParseableStreamObject(source structure.Source, reader io.Reader, ...) error
- func ParseSimpleStreamObject(reader io.Reader, object interface{}) error
- func ParseSingletonHeader(header http.Header, key string) (*string, error)
- func ParseStreamObject(source structure.Source, reader io.Reader, object interface{}) error
- func ParseValuesObjects(values map[string][]string, objectParsables ...structure.ObjectParsable) error
- func SetErrorToContext(ctx context.Context, err error)
- func StatusCodeForError(err error) int
- func TraceRequestFromContext(ctx context.Context) string
- func TraceSessionFromContext(ctx context.Context) string
- func ValidateObjects(source structure.Source, objects ...interface{}) error
- type ArrayParametersMutator
- type Condition
- type ContextError
- type Details
- type HeaderMutator
- type HeadersInspector
- type Method
- type ParameterMutator
- type ParametersMutator
- type RequestMutator
- type Responder
- func (r *Responder) Bytes(statusCode int, bites []byte, mutators ...ResponseMutator)
- func (r *Responder) Data(statusCode int, data interface{}, mutators ...ResponseMutator)
- func (r *Responder) Empty(statusCode int, mutators ...ResponseMutator)
- func (r *Responder) Error(statusCode int, err error, mutators ...ResponseMutator)
- func (r *Responder) InternalServerError(err error, mutators ...ResponseMutator)
- func (r *Responder) Reader(statusCode int, reader io.Reader, mutators ...ResponseMutator)
- func (r *Responder) Redirect(statusCode int, url string, mutators ...ResponseMutator)
- func (r *Responder) RespondIfError(err error, mutators ...ResponseMutator) bool
- func (r *Responder) SetCookie(cookie *http.Cookie)
- func (r *Responder) String(statusCode int, str string, mutators ...ResponseMutator)
- type ResponseInspector
- type ResponseMutator
- type Sanitizable
- type Values
- func (v *Values) Array(reference string) *[]interface{}
- func (v *Values) Bool(reference string) *bool
- func (v *Values) Error() error
- func (v *Values) Exists() bool
- func (v *Values) Float64(reference string) *float64
- func (v *Values) ForgivingTime(reference string, layout string) *time.Time
- func (v *Values) HasError() bool
- func (v *Values) HasMeta() bool
- func (v *Values) HasSource() bool
- func (v *Values) Int(reference string) *int
- func (v *Values) Interface(reference string) *interface{}
- func (v *Values) Meta() interface{}
- func (v *Values) NotParsed() error
- func (v *Values) Object(reference string) *map[string]interface{}
- func (v *Values) Origin() structure.Origin
- func (v *Values) Parse(objectParsable structure.ObjectParsable) error
- func (v *Values) ReferenceExists(reference string) bool
- func (v *Values) References() []string
- func (v *Values) ReportError(err error)
- func (v *Values) Source() structure.Source
- func (v *Values) String(reference string) *string
- func (v *Values) StringArray(reference string) *[]string
- func (v *Values) Time(reference string, layout string) *time.Time
- func (v *Values) WithMeta(meta interface{}) structure.ObjectParser
- func (v *Values) WithOrigin(origin structure.Origin) structure.ObjectParser
- func (v *Values) WithReferenceArrayParser(reference string) structure.ArrayParser
- func (v *Values) WithReferenceErrorReporter(reference string) structure.ErrorReporter
- func (v *Values) WithReferenceObjectParser(reference string) structure.ObjectParser
- func (v *Values) WithSource(source structure.Source) structure.ObjectParser
Constants ¶
View Source
const ( ErrorCodeInternalServerError = "internal-server-error" ErrorCodeUnexpectedResponse = "unexpected-response" ErrorCodeTooManyRequests = "too-many-requests" ErrorCodeBadRequest = "bad-request" ErrorCodeUnauthenticated = "unauthenticated" ErrorCodeResourceNotFound = "resource-not-found" ErrorCodeResourceTooLarge = "resource-too-large" ErrorCodeHeaderMissing = "header-missing" ErrorCodeHeaderInvalid = "header-invalid" ErrorCodeParameterMissing = "parameter-missing" ErrorCodeParameterInvalid = "parameter-invalid" ErrorCodeJSONNotFound = "json-not-found" ErrorCodeJSONMalformed = "json-malformed" ErrorCodeDigestsNotEqual = "digests-not-equal" ErrorCodeMediaTypeNotSupported = "media-type-not-supported" ErrorCodeExtensionNotSupported = "extension-not-supported" )
View Source
const ( HTTPHeaderTraceRequest = "X-Tidepool-Trace-Request" HTTPHeaderTraceSession = "X-Tidepool-Trace-Session" )
Variables ¶
This section is empty.
Functions ¶
func DecodeObject ¶
func DecodeOptionalRequestPathParameter ¶ added in v1.31.0
func DecodeRequestBody ¶
func DecodeRequestPathParameter ¶ added in v1.27.0
func DecodeRequestQuery ¶
func DecodeRequestQuery(req *http.Request, objectParsables ...structure.ObjectParsable) error
func DecodeResponseBody ¶
func DecodeValues ¶
func DecodeValues(values map[string][]string, objectParsables ...structure.ObjectParsable) error
func ErrorBadRequest ¶
func ErrorBadRequest() error
func ErrorDigestsNotEqual ¶ added in v1.31.0
func ErrorExtensionNotSupported ¶ added in v1.31.0
func ErrorHeaderInvalid ¶ added in v1.27.0
func ErrorHeaderMissing ¶ added in v1.27.0
func ErrorInternalServerError ¶ added in v1.27.0
func ErrorJSONMalformed ¶
func ErrorJSONMalformed() error
func ErrorJSONNotFound ¶ added in v1.31.0
func ErrorJSONNotFound() error
func ErrorMediaTypeNotSupported ¶ added in v1.31.0
func ErrorParameterInvalid ¶ added in v1.27.0
func ErrorParameterMissing ¶
func ErrorResourceNotFound ¶
func ErrorResourceNotFound() error
func ErrorResourceNotFoundWithIDAndOptionalRevision ¶ added in v1.29.0
func ErrorResourceNotFoundWithIDAndRevision ¶ added in v1.27.0
func ErrorResourceTooLarge ¶ added in v1.31.0
func ErrorResourceTooLarge() error
func ErrorTooManyRequests ¶ added in v1.24.0
func ErrorTooManyRequests() error
func ErrorUnauthenticated ¶
func ErrorUnauthenticated() error
func ErrorUnauthorized ¶
func ErrorUnauthorized() error
func ErrorUnexpectedResponse ¶
func GetErrorFromContext ¶ added in v1.28.0
func IsErrorInternalServerError ¶ added in v1.27.0
func IsErrorResourceNotFound ¶ added in v1.27.0
func IsErrorUnauthenticated ¶ added in v1.27.0
func IsErrorUnauthorized ¶ added in v1.27.0
func IsStatusCodeClientError ¶ added in v1.27.0
func IsStatusCodeRedirection ¶ added in v1.27.0
func IsStatusCodeSuccess ¶ added in v1.27.0
func NewContextWithContextError ¶ added in v1.28.0
func NewContextWithDetails ¶
func NormalizeObjects ¶
func ParseDigestMD5Header ¶ added in v1.27.0
func ParseIntHeader ¶ added in v1.27.0
func ParseMediaTypeHeader ¶ added in v1.27.0
func ParseSimpleStreamObject ¶
func ParseSingletonHeader ¶ added in v1.31.0
func ParseStreamObject ¶
func ParseValuesObjects ¶
func ParseValuesObjects(values map[string][]string, objectParsables ...structure.ObjectParsable) error
func SetErrorToContext ¶ added in v1.28.0
func StatusCodeForError ¶
func TraceRequestFromContext ¶
func TraceSessionFromContext ¶
func ValidateObjects ¶
Types ¶
type ArrayParametersMutator ¶ added in v1.27.0
func NewArrayParametersMutator ¶ added in v1.27.0
func NewArrayParametersMutator(parameters map[string][]string) *ArrayParametersMutator
func (*ArrayParametersMutator) MutateRequest ¶ added in v1.27.0
func (p *ArrayParametersMutator) MutateRequest(req *http.Request) error
type Condition ¶ added in v1.29.0
type Condition struct {
Revision *int `json:"revision,omitempty"`
}
func NewCondition ¶ added in v1.29.0
func NewCondition() *Condition
func (*Condition) MutateRequest ¶ added in v1.29.0
func (*Condition) Parse ¶ added in v1.29.0
func (c *Condition) Parse(parser structure.ObjectParser)
type ContextError ¶ added in v1.28.0
type ContextError struct {
// contains filtered or unexported fields
}
func ContextErrorFromContext ¶ added in v1.28.0
func ContextErrorFromContext(ctx context.Context) *ContextError
func NewContextError ¶ added in v1.28.0
func NewContextError() *ContextError
func (*ContextError) Get ¶ added in v1.28.0
func (c *ContextError) Get() error
func (*ContextError) Set ¶ added in v1.28.0
func (c *ContextError) Set(err error)
type Details ¶
type Details interface { Method() Method IsService() bool IsUser() bool UserID() string HasToken() bool Token() string }
func DetailsFromContext ¶
type HeaderMutator ¶ added in v1.26.0
func NewHeaderMutator ¶ added in v1.26.0
func NewHeaderMutator(key string, value string) *HeaderMutator
func (*HeaderMutator) MutateRequest ¶ added in v1.27.0
func (h *HeaderMutator) MutateRequest(req *http.Request) error
func (*HeaderMutator) MutateResponse ¶ added in v1.27.0
func (h *HeaderMutator) MutateResponse(res http.ResponseWriter) error
type HeadersInspector ¶ added in v1.27.0
func NewHeadersInspector ¶ added in v1.27.0
func NewHeadersInspector() *HeadersInspector
func (*HeadersInspector) InspectResponse ¶ added in v1.27.0
func (h *HeadersInspector) InspectResponse(res *http.Response) error
type ParameterMutator ¶ added in v1.26.0
func NewParameterMutator ¶ added in v1.26.0
func NewParameterMutator(key string, value string) *ParameterMutator
func (*ParameterMutator) MutateRequest ¶ added in v1.27.0
func (p *ParameterMutator) MutateRequest(req *http.Request) error
type ParametersMutator ¶ added in v1.26.0
func NewParametersMutator ¶ added in v1.26.0
func NewParametersMutator(parameters map[string]string) *ParametersMutator
func (*ParametersMutator) MutateRequest ¶ added in v1.27.0
func (p *ParametersMutator) MutateRequest(req *http.Request) error
type RequestMutator ¶ added in v1.27.0
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
func MustNewResponder ¶
func MustNewResponder(res rest.ResponseWriter, req *rest.Request) *Responder
func NewResponder ¶
func (*Responder) Bytes ¶ added in v1.27.0
func (r *Responder) Bytes(statusCode int, bites []byte, mutators ...ResponseMutator)
func (*Responder) Data ¶
func (r *Responder) Data(statusCode int, data interface{}, mutators ...ResponseMutator)
func (*Responder) Empty ¶
func (r *Responder) Empty(statusCode int, mutators ...ResponseMutator)
func (*Responder) Error ¶
func (r *Responder) Error(statusCode int, err error, mutators ...ResponseMutator)
func (*Responder) InternalServerError ¶ added in v1.27.0
func (r *Responder) InternalServerError(err error, mutators ...ResponseMutator)
func (*Responder) Reader ¶ added in v1.27.0
func (r *Responder) Reader(statusCode int, reader io.Reader, mutators ...ResponseMutator)
func (*Responder) Redirect ¶
func (r *Responder) Redirect(statusCode int, url string, mutators ...ResponseMutator)
func (*Responder) RespondIfError ¶ added in v1.27.0
func (r *Responder) RespondIfError(err error, mutators ...ResponseMutator) bool
type ResponseInspector ¶ added in v1.27.0
type ResponseMutator ¶ added in v1.27.0
type ResponseMutator interface {
MutateResponse(res http.ResponseWriter) error
}
type Sanitizable ¶
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
func NewValuesParser ¶
func NewValuesParser(base *structureBase.Base, values *map[string][]string) *Values
func (*Values) ForgivingTime ¶ added in v1.32.2
ForgivingTime is a parser added specifically to handle https://tidepool.atlassian.net/browse/BACK-1161 It should be deprecated once Dexcom fixes their API.
func (*Values) ReferenceExists ¶
func (*Values) References ¶
func (*Values) ReportError ¶ added in v1.24.0
func (*Values) StringArray ¶
func (*Values) WithMeta ¶
func (v *Values) WithMeta(meta interface{}) structure.ObjectParser
func (*Values) WithOrigin ¶ added in v1.24.0
func (v *Values) WithOrigin(origin structure.Origin) structure.ObjectParser
func (*Values) WithReferenceArrayParser ¶
func (v *Values) WithReferenceArrayParser(reference string) structure.ArrayParser
func (*Values) WithReferenceErrorReporter ¶ added in v1.31.0
func (v *Values) WithReferenceErrorReporter(reference string) structure.ErrorReporter
func (*Values) WithReferenceObjectParser ¶
func (v *Values) WithReferenceObjectParser(reference string) structure.ObjectParser
func (*Values) WithSource ¶
func (v *Values) WithSource(source structure.Source) structure.ObjectParser
Source Files ¶
Click to show internal directories.
Click to hide internal directories.