operations

package
v0.0.0-...-a784d27 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const GetGreetingOKCode int = 200

GetGreetingOKCode is the HTTP code returned for type GetGreetingOK

Variables

This section is empty.

Functions

This section is empty.

Types

type GetGreeting

type GetGreeting struct {
	Context *middleware.Context
	Handler GetGreetingHandler
}
GetGreeting swagger:route GET /hello getGreeting

GetGreeting get greeting API

func NewGetGreeting

func NewGetGreeting(ctx *middleware.Context, handler GetGreetingHandler) *GetGreeting

NewGetGreeting creates a new http.Handler for the get greeting operation

func (*GetGreeting) ServeHTTP

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

type GetGreetingHandler

type GetGreetingHandler interface {
	Handle(GetGreetingParams) middleware.Responder
}

GetGreetingHandler interface for that can handle valid get greeting params

type GetGreetingHandlerFunc

type GetGreetingHandlerFunc func(GetGreetingParams) middleware.Responder

GetGreetingHandlerFunc turns a function with the right signature into a get greeting handler

func (GetGreetingHandlerFunc) Handle

Handle executing the request and returning a response

type GetGreetingOK

type GetGreetingOK struct {

	/*contains the actual greeting as plain text
	  In: Body
	*/
	Payload string `json:"body,omitempty"`
}

GetGreetingOK returns a greeting

swagger:response getGreetingOK

func NewGetGreetingOK

func NewGetGreetingOK() *GetGreetingOK

NewGetGreetingOK creates GetGreetingOK with default headers values

func (*GetGreetingOK) SetPayload

func (o *GetGreetingOK) SetPayload(payload string)

SetPayload sets the payload to the get greeting o k response

func (*GetGreetingOK) WithPayload

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

WithPayload adds the payload to the get greeting o k response

func (*GetGreetingOK) WriteResponse

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

WriteResponse to the client

type GetGreetingParams

type GetGreetingParams struct {

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

	/*defaults to World if not given
	  In: query
	*/
	Name *string
}

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

swagger:parameters getGreeting

func NewGetGreetingParams

func NewGetGreetingParams() GetGreetingParams

NewGetGreetingParams creates a new GetGreetingParams object

There are no default values defined in the spec.

func (*GetGreetingParams) BindRequest

func (o *GetGreetingParams) 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 NewGetGreetingParams() beforehand.

type GetGreetingURL

type GetGreetingURL struct {
	Name *string
	// contains filtered or unexported fields
}

GetGreetingURL generates an URL for the get greeting operation

func (*GetGreetingURL) Build

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

Build a url path and query string

func (*GetGreetingURL) BuildFull

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

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

func (*GetGreetingURL) Must

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

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

func (*GetGreetingURL) SetBasePath

func (o *GetGreetingURL) 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 (*GetGreetingURL) String

func (o *GetGreetingURL) String() string

String returns the string representation of the path with query string

func (*GetGreetingURL) StringFull

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

StringFull returns the string representation of a complete url

func (*GetGreetingURL) WithBasePath

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

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 GreeterAPI

type GreeterAPI 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

	// TxtProducer registers a producer for the following mime types:
	//   - text/plain
	TxtProducer runtime.Producer

	// GetGreetingHandler sets the operation handler for the get greeting operation
	GetGreetingHandler GetGreetingHandler

	// 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
}

GreeterAPI the greeter API

func NewGreeterAPI

func NewGreeterAPI(spec *loads.Document) *GreeterAPI

NewGreeterAPI creates a new Greeter instance

func (*GreeterAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*GreeterAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*GreeterAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*GreeterAPI) ConsumersFor

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

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

func (*GreeterAPI) Context

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

Context returns the middleware context for the greeter API

func (*GreeterAPI) DefaultConsumes

func (o *GreeterAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*GreeterAPI) DefaultProduces

func (o *GreeterAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*GreeterAPI) Formats

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

Formats returns the registered string formats

func (*GreeterAPI) HandlerFor

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

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

func (*GreeterAPI) Init

func (o *GreeterAPI) Init()

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

func (*GreeterAPI) ProducersFor

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

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

func (*GreeterAPI) RegisterConsumer

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

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

func (*GreeterAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*GreeterAPI) RegisterProducer

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

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

func (*GreeterAPI) Serve

func (o *GreeterAPI) 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 (*GreeterAPI) ServeErrorFor

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

ServeErrorFor gets a error handler for a given operation id

func (*GreeterAPI) SetDefaultConsumes

func (o *GreeterAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*GreeterAPI) SetDefaultProduces

func (o *GreeterAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*GreeterAPI) SetSpec

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

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

func (*GreeterAPI) UseRedoc

func (o *GreeterAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*GreeterAPI) UseSwaggerUI

func (o *GreeterAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*GreeterAPI) Validate

func (o *GreeterAPI) Validate() error

Validate validates the registrations in the GreeterAPI

Jump to

Keyboard shortcuts

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