rest

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointFunc

type EndpointFunc interface{}

EndpointFunc is a function with following signature

  • one or two input parameters with the 1st as context.Context and the 2nd as <request>
  • at least two output parameters with the 2nd last as <response> and the last as error

where <request>: a struct or a pointer to a struct whose fields are properly tagged <response>: supported types are (will support more in the future):

  • a struct or a pointer to a struct whose fields are properly tagged.
  • interface{}, if decoding is not supported (rest not used by any go client)
  • map[string]interface{}
  • string
  • []byte

e.g.: func(context.Context, request *AnyStructWithTag) (response *AnyStructWithTag, error) {...}

type MappingBuilder

type MappingBuilder struct {
	// contains filtered or unexported fields
}

MappingBuilder builds web.EndpointMapping using web.GinBindingRequestDecoder, web.JsonResponseEncoder and web.JsonErrorEncoder MappingBuilder.Path, MappingBuilder.Method and MappingBuilder.EndpointFunc are required to successfully build a mapping. See EndpointFunc for supported strongly typed function signatures. Example: <code> rest.Put("/path/to/api").EndpointFunc(func...).Build() </code>

func Any

func Any(path string) *MappingBuilder

func Delete

func Delete(path string) *MappingBuilder

func Get

func Get(path string) *MappingBuilder
func Head(path string) *MappingBuilder

func New

func New(names ...string) *MappingBuilder

func Options

func Options(path string) *MappingBuilder

func Patch

func Patch(path string) *MappingBuilder

func Post

func Post(path string) *MappingBuilder

func Put

func Put(path string) *MappingBuilder

func (*MappingBuilder) Build

func (b *MappingBuilder) Build() web.EndpointMapping

func (*MappingBuilder) Condition

func (b *MappingBuilder) Condition(condition web.RequestMatcher) *MappingBuilder

func (*MappingBuilder) DecodeRequestFunc

func (b *MappingBuilder) DecodeRequestFunc(f web.DecodeRequestFunc) *MappingBuilder

func (*MappingBuilder) Delete

func (b *MappingBuilder) Delete(path string) *MappingBuilder

func (*MappingBuilder) EncodeErrorFunc added in v0.14.0

func (b *MappingBuilder) EncodeErrorFunc(f web.EncodeErrorFunc) *MappingBuilder

func (*MappingBuilder) EncodeResponseFunc

func (b *MappingBuilder) EncodeResponseFunc(f web.EncodeResponseFunc) *MappingBuilder

func (*MappingBuilder) EndpointFunc

func (b *MappingBuilder) EndpointFunc(endpointFunc EndpointFunc) *MappingBuilder

func (*MappingBuilder) Get

func (b *MappingBuilder) Get(path string) *MappingBuilder

func (*MappingBuilder) Group

func (b *MappingBuilder) Group(group string) *MappingBuilder

func (*MappingBuilder) Head

func (b *MappingBuilder) Head(path string) *MappingBuilder

func (*MappingBuilder) Method

func (b *MappingBuilder) Method(method string) *MappingBuilder

func (*MappingBuilder) Name

func (b *MappingBuilder) Name(name string) *MappingBuilder

func (*MappingBuilder) Options

func (b *MappingBuilder) Options(path string) *MappingBuilder

func (*MappingBuilder) Patch

func (b *MappingBuilder) Patch(path string) *MappingBuilder

func (*MappingBuilder) Path

func (b *MappingBuilder) Path(path string) *MappingBuilder

func (*MappingBuilder) Post

func (b *MappingBuilder) Post(path string) *MappingBuilder

func (*MappingBuilder) Put

func (b *MappingBuilder) Put(path string) *MappingBuilder

Jump to

Keyboard shortcuts

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