operations

package
v0.0.0-...-f928e90 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const GetHelloOKCode int = 200

GetHelloOKCode is the HTTP code returned for type GetHelloOK

View Source
const PostEchoOKCode int = 200

PostEchoOKCode is the HTTP code returned for type PostEchoOK

Variables

This section is empty.

Functions

This section is empty.

Types

type EchoServerAPI

type EchoServerAPI struct {
	Middleware func(middleware.Builder) http.Handler

	// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator

	// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator

	// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
	// It has a default implementation in the security package, however you can replace it for your particular usage.
	BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator

	// JSONConsumer registers a consumer for the following mime types:
	//   - application/json
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for the following mime types:
	//   - application/json
	JSONProducer runtime.Producer

	// GetHelloHandler sets the operation handler for the get hello operation
	GetHelloHandler GetHelloHandler
	// BoardListMessageHandler sets the operation handler for the list message operation
	BoardListMessageHandler board.ListMessageHandler
	// PostEchoHandler sets the operation handler for the post echo operation
	PostEchoHandler PostEchoHandler
	// BoardPostMessageHandler sets the operation handler for the post message operation
	BoardPostMessageHandler board.PostMessageHandler

	// ServeError is called when an error is received, there is a default handler
	// but you can set your own with this
	ServeError func(http.ResponseWriter, *http.Request, error)

	// PreServerShutdown is called before the HTTP(S) server is shutdown
	// This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
	PreServerShutdown func()

	// ServerShutdown is called when the HTTP(S) server is shut down and done
	// handling all active connections and does not accept connections any more
	ServerShutdown func()

	// Custom command line argument groups with their descriptions
	CommandLineOptionsGroups []swag.CommandLineOptionsGroup

	// User defined logger function.
	Logger func(string, ...interface{})
	// contains filtered or unexported fields
}

EchoServerAPI the echo server API

func NewEchoServerAPI

func NewEchoServerAPI(spec *loads.Document) *EchoServerAPI

NewEchoServerAPI creates a new EchoServer instance

func (*EchoServerAPI) AddMiddlewareFor

func (o *EchoServerAPI) AddMiddlewareFor(method, path string, builder middleware.Builder)

AddMiddlewareFor adds a http middleware to existing handler

func (*EchoServerAPI) AuthenticatorsFor

func (o *EchoServerAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*EchoServerAPI) Authorizer

func (o *EchoServerAPI) Authorizer() runtime.Authorizer

Authorizer returns the registered authorizer

func (*EchoServerAPI) ConsumersFor

func (o *EchoServerAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer

ConsumersFor gets the consumers for the specified media types. MIME type parameters are ignored here.

func (*EchoServerAPI) Context

func (o *EchoServerAPI) Context() *middleware.Context

Context returns the middleware context for the echo server API

func (*EchoServerAPI) DefaultConsumes

func (o *EchoServerAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*EchoServerAPI) DefaultProduces

func (o *EchoServerAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*EchoServerAPI) Formats

func (o *EchoServerAPI) Formats() strfmt.Registry

Formats returns the registered string formats

func (*EchoServerAPI) HandlerFor

func (o *EchoServerAPI) HandlerFor(method, path string) (http.Handler, bool)

HandlerFor gets a http.Handler for the provided operation method and path

func (*EchoServerAPI) Init

func (o *EchoServerAPI) Init()

Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit

func (*EchoServerAPI) ProducersFor

func (o *EchoServerAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer

ProducersFor gets the producers for the specified media types. MIME type parameters are ignored here.

func (*EchoServerAPI) RegisterConsumer

func (o *EchoServerAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer)

RegisterConsumer allows you to add (or override) a consumer for a media type.

func (*EchoServerAPI) RegisterFormat

func (o *EchoServerAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator)

RegisterFormat registers a custom format validator

func (*EchoServerAPI) RegisterProducer

func (o *EchoServerAPI) RegisterProducer(mediaType string, producer runtime.Producer)

RegisterProducer allows you to add (or override) a producer for a media type.

func (*EchoServerAPI) Serve

func (o *EchoServerAPI) Serve(builder middleware.Builder) http.Handler

Serve creates a http handler to serve the API over HTTP can be used directly in http.ListenAndServe(":8000", api.Serve(nil))

func (*EchoServerAPI) ServeErrorFor

func (o *EchoServerAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error)

ServeErrorFor gets a error handler for a given operation id

func (*EchoServerAPI) SetDefaultConsumes

func (o *EchoServerAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*EchoServerAPI) SetDefaultProduces

func (o *EchoServerAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*EchoServerAPI) SetSpec

func (o *EchoServerAPI) SetSpec(spec *loads.Document)

SetSpec sets a spec that will be served for the clients.

func (*EchoServerAPI) UseRedoc

func (o *EchoServerAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*EchoServerAPI) UseSwaggerUI

func (o *EchoServerAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*EchoServerAPI) Validate

func (o *EchoServerAPI) Validate() error

Validate validates the registrations in the EchoServerAPI

type GetHello

type GetHello struct {
	Context *middleware.Context
	Handler GetHelloHandler
}
GetHello swagger:route GET /hello getHello

returning hello world.

returning hello world for test.

func NewGetHello

func NewGetHello(ctx *middleware.Context, handler GetHelloHandler) *GetHello

NewGetHello creates a new http.Handler for the get hello operation

func (*GetHello) ServeHTTP

func (o *GetHello) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type GetHelloHandler

type GetHelloHandler interface {
	Handle(GetHelloParams) middleware.Responder
}

GetHelloHandler interface for that can handle valid get hello params

type GetHelloHandlerFunc

type GetHelloHandlerFunc func(GetHelloParams) middleware.Responder

GetHelloHandlerFunc turns a function with the right signature into a get hello handler

func (GetHelloHandlerFunc) Handle

Handle executing the request and returning a response

type GetHelloOK

type GetHelloOK struct {

	/*
	  In: Body
	*/
	Payload string `json:"body,omitempty"`
}

GetHelloOK return hellow world.

swagger:response getHelloOK

func NewGetHelloOK

func NewGetHelloOK() *GetHelloOK

NewGetHelloOK creates GetHelloOK with default headers values

func (*GetHelloOK) SetPayload

func (o *GetHelloOK) SetPayload(payload string)

SetPayload sets the payload to the get hello o k response

func (*GetHelloOK) WithPayload

func (o *GetHelloOK) WithPayload(payload string) *GetHelloOK

WithPayload adds the payload to the get hello o k response

func (*GetHelloOK) WriteResponse

func (o *GetHelloOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type GetHelloParams

type GetHelloParams struct {

	// HTTP Request Object
	HTTPRequest *http.Request `json:"-"`
}

GetHelloParams contains all the bound params for the get hello operation typically these are obtained from a http.Request

swagger:parameters GetHello

func NewGetHelloParams

func NewGetHelloParams() GetHelloParams

NewGetHelloParams creates a new GetHelloParams object

There are no default values defined in the spec.

func (*GetHelloParams) BindRequest

func (o *GetHelloParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewGetHelloParams() beforehand.

type GetHelloURL

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

GetHelloURL generates an URL for the get hello operation

func (*GetHelloURL) Build

func (o *GetHelloURL) Build() (*url.URL, error)

Build a url path and query string

func (*GetHelloURL) BuildFull

func (o *GetHelloURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*GetHelloURL) Must

func (o *GetHelloURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*GetHelloURL) SetBasePath

func (o *GetHelloURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*GetHelloURL) String

func (o *GetHelloURL) String() string

String returns the string representation of the path with query string

func (*GetHelloURL) StringFull

func (o *GetHelloURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*GetHelloURL) WithBasePath

func (o *GetHelloURL) WithBasePath(bp string) *GetHelloURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

type PostEcho

type PostEcho struct {
	Context *middleware.Context
	Handler PostEchoHandler
}
PostEcho swagger:route POST /echo postEcho

echo.

echo.

func NewPostEcho

func NewPostEcho(ctx *middleware.Context, handler PostEchoHandler) *PostEcho

NewPostEcho creates a new http.Handler for the post echo operation

func (*PostEcho) ServeHTTP

func (o *PostEcho) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type PostEchoHandler

type PostEchoHandler interface {
	Handle(PostEchoParams) middleware.Responder
}

PostEchoHandler interface for that can handle valid post echo params

type PostEchoHandlerFunc

type PostEchoHandlerFunc func(PostEchoParams) middleware.Responder

PostEchoHandlerFunc turns a function with the right signature into a post echo handler

func (PostEchoHandlerFunc) Handle

Handle executing the request and returning a response

type PostEchoOK

type PostEchoOK struct {

	/*
	  In: Body
	*/
	Payload string `json:"body,omitempty"`
}

PostEchoOK return the message.

swagger:response postEchoOK

func NewPostEchoOK

func NewPostEchoOK() *PostEchoOK

NewPostEchoOK creates PostEchoOK with default headers values

func (*PostEchoOK) SetPayload

func (o *PostEchoOK) SetPayload(payload string)

SetPayload sets the payload to the post echo o k response

func (*PostEchoOK) WithPayload

func (o *PostEchoOK) WithPayload(payload string) *PostEchoOK

WithPayload adds the payload to the post echo o k response

func (*PostEchoOK) WriteResponse

func (o *PostEchoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client

type PostEchoParams

type PostEchoParams struct {

	// HTTP Request Object
	HTTPRequest *http.Request `json:"-"`

	/*
	  Required: true
	  In: body
	*/
	Message string
}

PostEchoParams contains all the bound params for the post echo operation typically these are obtained from a http.Request

swagger:parameters PostEcho

func NewPostEchoParams

func NewPostEchoParams() PostEchoParams

NewPostEchoParams creates a new PostEchoParams object

There are no default values defined in the spec.

func (*PostEchoParams) BindRequest

func (o *PostEchoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error

BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface for simple values it will use straight method calls.

To ensure default values, the struct must have been initialized with NewPostEchoParams() beforehand.

type PostEchoURL

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

PostEchoURL generates an URL for the post echo operation

func (*PostEchoURL) Build

func (o *PostEchoURL) Build() (*url.URL, error)

Build a url path and query string

func (*PostEchoURL) BuildFull

func (o *PostEchoURL) BuildFull(scheme, host string) (*url.URL, error)

BuildFull builds a full url with scheme, host, path and query string

func (*PostEchoURL) Must

func (o *PostEchoURL) Must(u *url.URL, err error) *url.URL

Must is a helper function to panic when the url builder returns an error

func (*PostEchoURL) SetBasePath

func (o *PostEchoURL) SetBasePath(bp string)

SetBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

func (*PostEchoURL) String

func (o *PostEchoURL) String() string

String returns the string representation of the path with query string

func (*PostEchoURL) StringFull

func (o *PostEchoURL) StringFull(scheme, host string) string

StringFull returns the string representation of a complete url

func (*PostEchoURL) WithBasePath

func (o *PostEchoURL) WithBasePath(bp string) *PostEchoURL

WithBasePath sets the base path for this url builder, only required when it's different from the base path specified in the swagger spec. When the value of the base path is an empty string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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