contract

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 7

Documentation

Index

Constants

View Source
const (
	FormatQuery = "_format"
)

Variables

This section is empty.

Functions

func DataOutputParameter

func DataOutputParameter(name string) *state.Parameter

func DefaultDataOutputParameter

func DefaultDataOutputParameter() *state.Parameter

func DefaultStatusOutputParameter

func DefaultStatusOutputParameter() *state.Parameter

func EnsureParameterTypes

func EnsureParameterTypes(parameters []*state.Parameter, aView *view.View, doc state.Documentation, filterDoc state.Documentation)

EnsureParameterTypes update output kind parameter type

func StatusSuccess

func StatusSuccess(state *expand.State) response.Status

TODO move it to some other package

func UpdateOutputParameterType

func UpdateOutputParameterType(parameter *state.Parameter)

func UpdateParameterAsyncType

func UpdateParameterAsyncType(parameter *state.Parameter)

func UpdateParameterMetaType

func UpdateParameterMetaType(parameter *state.Parameter)

Types

type BodySelector

type BodySelector struct {
	StateValue string
}

BodySelector deprecated, use output parameter instead deprecated

type Contract

type Contract struct {
	Name       string `json:",omitempty" yaml:",omitempty"`
	Input      Input
	Output     Output
	ModulePath string
	Service    service.Type `json:",omitempty"`
}

func (*Contract) BodyType

func (c *Contract) BodyType() reflect.Type

func (*Contract) Init

func (c *Contract) Init(ctx context.Context, path *Path, aView *view.View, resource *view.Resource) (err error)

func (*Contract) OutputType

func (c *Contract) OutputType() reflect.Type

func (*Contract) Types

func (c *Contract) Types() []*state.Type

Types returns all types

type Dispatcher

type Dispatcher interface {
	Dispatch(ctx context.Context, path *Path, request *http.Request, form *state.Form) (interface{}, error)
}

type Input

type Input struct {
	Body                       state.Type
	Type                       state.Type
	CustomValidation           bool `json:",omitempty"`
	IgnoreEmptyQueryParameters bool `json:",omitempty"`
}

func (*Input) Init

func (i *Input) Init(ctx context.Context, aView *view.View) error

type Output

type Output struct {
	Cardinality state.Cardinality `json:",omitempty"`
	CaseFormat  text.CaseFormat   `json:",omitempty"`
	OmitEmpty   bool              `json:",omitempty"`
	Style       Style             `json:",omitempty"`
	Title       string            `json:",omitempty"`
	//Filed defines optional main view data holder
	//deprecated
	Field            string `json:",omitempty"`
	Exclude          []string
	NormalizeExclude *bool

	DebugKind view.MetaKind

	DataFormat string `json:",omitempty"` //default data format

	ResponseBody *BodySelector
	RevealMetric *bool
	Type         state.Type
	Doc          state.Documentation
	FilterDoc    state.Documentation
	// contains filtered or unexported fields
}

func (*Output) ContentType

func (o *Output) ContentType(format string) string

func (*Output) Excluded

func (o *Output) Excluded() map[string]bool

func (*Output) Format

func (o *Output) Format(query url.Values) string

func (*Output) GetTitle

func (o *Output) GetTitle() string

func (*Output) Init

func (o *Output) Init(ctx context.Context, aView *view.View, inputType *state.Type, isReader bool) (err error)

func (*Output) IsRevealMetric

func (o *Output) IsRevealMetric() bool

func (*Output) ShouldNormalizeExclude

func (o *Output) ShouldNormalizeExclude() bool

type Path

type Path struct {
	URI    string `json:",omitempty" yaml:"URI"`
	Method string `json:",omitempty" yaml:"Method"`
	// contains filtered or unexported fields
}

func NewPath

func NewPath(method, uri string) *Path

func (*Path) Equals

func (r *Path) Equals(candidate *Path) bool

func (*Path) HttpMethod

func (r *Path) HttpMethod() string

func (*Path) Key

func (r *Path) Key() string

type Style

type Style string

Style defines style TODO deprecate with function on input parameters to determine style

const (
	BasicStyle         Style = "Basic"
	ComprehensiveStyle Style = "Comprehensive"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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