operations

package
v0.0.0-...-bd6edc4 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AddItemAcceptedCode int = 202

AddItemAcceptedCode is the HTTP code returned for type AddItemAccepted

View Source
const ListItemsOKCode int = 200

ListItemsOKCode is the HTTP code returned for type ListItemsOK

View Source
const RemoveItemOKCode int = 200

RemoveItemOKCode is the HTTP code returned for type RemoveItemOK

Variables

This section is empty.

Functions

This section is empty.

Types

type AddItem

type AddItem struct {
	Context *middleware.Context
	Handler AddItemHandler
}

AddItem swagger:route POST /add/{itemTitle} addItem

Add a new todo item

func NewAddItem

func NewAddItem(ctx *middleware.Context, handler AddItemHandler) *AddItem

NewAddItem creates a new http.Handler for the add item operation

func (*AddItem) ServeHTTP

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

type AddItemAccepted

type AddItemAccepted struct {

	/*
	  In: Body
	*/
	Payload *models.AddResponse `json:"body,omitempty"`
}

AddItemAccepted Accepted

swagger:response addItemAccepted

func NewAddItemAccepted

func NewAddItemAccepted() *AddItemAccepted

NewAddItemAccepted creates AddItemAccepted with default headers values

func (*AddItemAccepted) SetPayload

func (o *AddItemAccepted) SetPayload(payload *models.AddResponse)

SetPayload sets the payload to the add item accepted response

func (*AddItemAccepted) WithPayload

func (o *AddItemAccepted) WithPayload(payload *models.AddResponse) *AddItemAccepted

WithPayload adds the payload to the add item accepted response

func (*AddItemAccepted) WriteResponse

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

WriteResponse to the client

type AddItemDefault

type AddItemDefault struct {

	/*
	  In: Body
	*/
	Payload models.ErrorResponse `json:"body,omitempty"`
	// contains filtered or unexported fields
}

AddItemDefault Error

swagger:response addItemDefault

func NewAddItemDefault

func NewAddItemDefault(code int) *AddItemDefault

NewAddItemDefault creates AddItemDefault with default headers values

func (*AddItemDefault) SetPayload

func (o *AddItemDefault) SetPayload(payload models.ErrorResponse)

SetPayload sets the payload to the add item default response

func (*AddItemDefault) SetStatusCode

func (o *AddItemDefault) SetStatusCode(code int)

SetStatusCode sets the status to the add item default response

func (*AddItemDefault) WithPayload

func (o *AddItemDefault) WithPayload(payload models.ErrorResponse) *AddItemDefault

WithPayload adds the payload to the add item default response

func (*AddItemDefault) WithStatusCode

func (o *AddItemDefault) WithStatusCode(code int) *AddItemDefault

WithStatusCode adds the status to the add item default response

func (*AddItemDefault) WriteResponse

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

WriteResponse to the client

type AddItemHandler

type AddItemHandler interface {
	Handle(AddItemParams) middleware.Responder
}

AddItemHandler interface for that can handle valid add item params

type AddItemHandlerFunc

type AddItemHandlerFunc func(AddItemParams) middleware.Responder

AddItemHandlerFunc turns a function with the right signature into a add item handler

func (AddItemHandlerFunc) Handle

Handle executing the request and returning a response

type AddItemParams

type AddItemParams struct {

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

	/*
	  Required: true
	  In: path
	*/
	ItemTitle string
}

AddItemParams contains all the bound params for the add item operation typically these are obtained from a http.Request

swagger:parameters addItem

func NewAddItemParams

func NewAddItemParams() AddItemParams

NewAddItemParams creates a new AddItemParams object no default values defined in spec.

func (*AddItemParams) BindRequest

func (o *AddItemParams) 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 NewAddItemParams() beforehand.

type AddItemURL

type AddItemURL struct {
	ItemTitle string
	// contains filtered or unexported fields
}

AddItemURL generates an URL for the add item operation

func (*AddItemURL) Build

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

Build a url path and query string

func (*AddItemURL) BuildFull

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

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

func (*AddItemURL) Must

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

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

func (*AddItemURL) SetBasePath

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

func (o *AddItemURL) String() string

String returns the string representation of the path with query string

func (*AddItemURL) StringFull

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

StringFull returns the string representation of a complete url

func (*AddItemURL) WithBasePath

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

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 ListItems

type ListItems struct {
	Context *middleware.Context
	Handler ListItemsHandler
}

ListItems swagger:route GET /list listItems

List all todo items

func NewListItems

func NewListItems(ctx *middleware.Context, handler ListItemsHandler) *ListItems

NewListItems creates a new http.Handler for the list items operation

func (*ListItems) ServeHTTP

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

type ListItemsDefault

type ListItemsDefault struct {

	/*
	  In: Body
	*/
	Payload models.ErrorResponse `json:"body,omitempty"`
	// contains filtered or unexported fields
}

ListItemsDefault Error

swagger:response listItemsDefault

func NewListItemsDefault

func NewListItemsDefault(code int) *ListItemsDefault

NewListItemsDefault creates ListItemsDefault with default headers values

func (*ListItemsDefault) SetPayload

func (o *ListItemsDefault) SetPayload(payload models.ErrorResponse)

SetPayload sets the payload to the list items default response

func (*ListItemsDefault) SetStatusCode

func (o *ListItemsDefault) SetStatusCode(code int)

SetStatusCode sets the status to the list items default response

func (*ListItemsDefault) WithPayload

func (o *ListItemsDefault) WithPayload(payload models.ErrorResponse) *ListItemsDefault

WithPayload adds the payload to the list items default response

func (*ListItemsDefault) WithStatusCode

func (o *ListItemsDefault) WithStatusCode(code int) *ListItemsDefault

WithStatusCode adds the status to the list items default response

func (*ListItemsDefault) WriteResponse

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

WriteResponse to the client

type ListItemsHandler

type ListItemsHandler interface {
	Handle(ListItemsParams) middleware.Responder
}

ListItemsHandler interface for that can handle valid list items params

type ListItemsHandlerFunc

type ListItemsHandlerFunc func(ListItemsParams) middleware.Responder

ListItemsHandlerFunc turns a function with the right signature into a list items handler

func (ListItemsHandlerFunc) Handle

Handle executing the request and returning a response

type ListItemsOK

type ListItemsOK struct {

	/*
	  In: Body
	*/
	Payload *models.ListResponse `json:"body,omitempty"`
}

ListItemsOK Success

swagger:response listItemsOK

func NewListItemsOK

func NewListItemsOK() *ListItemsOK

NewListItemsOK creates ListItemsOK with default headers values

func (*ListItemsOK) SetPayload

func (o *ListItemsOK) SetPayload(payload *models.ListResponse)

SetPayload sets the payload to the list items o k response

func (*ListItemsOK) WithPayload

func (o *ListItemsOK) WithPayload(payload *models.ListResponse) *ListItemsOK

WithPayload adds the payload to the list items o k response

func (*ListItemsOK) WriteResponse

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

WriteResponse to the client

type ListItemsParams

type ListItemsParams struct {

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

ListItemsParams contains all the bound params for the list items operation typically these are obtained from a http.Request

swagger:parameters listItems

func NewListItemsParams

func NewListItemsParams() ListItemsParams

NewListItemsParams creates a new ListItemsParams object no default values defined in spec.

func (*ListItemsParams) BindRequest

func (o *ListItemsParams) 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 NewListItemsParams() beforehand.

type ListItemsURL

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

ListItemsURL generates an URL for the list items operation

func (*ListItemsURL) Build

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

Build a url path and query string

func (*ListItemsURL) BuildFull

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

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

func (*ListItemsURL) Must

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

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

func (*ListItemsURL) SetBasePath

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

func (o *ListItemsURL) String() string

String returns the string representation of the path with query string

func (*ListItemsURL) StringFull

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

StringFull returns the string representation of a complete url

func (*ListItemsURL) WithBasePath

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

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 RemoveItem

type RemoveItem struct {
	Context *middleware.Context
	Handler RemoveItemHandler
}

RemoveItem swagger:route DELETE /remove/{id} removeItem

Delete all todo items

func NewRemoveItem

func NewRemoveItem(ctx *middleware.Context, handler RemoveItemHandler) *RemoveItem

NewRemoveItem creates a new http.Handler for the remove item operation

func (*RemoveItem) ServeHTTP

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

type RemoveItemDefault

type RemoveItemDefault struct {

	/*
	  In: Body
	*/
	Payload models.ErrorResponse `json:"body,omitempty"`
	// contains filtered or unexported fields
}

RemoveItemDefault Error

swagger:response removeItemDefault

func NewRemoveItemDefault

func NewRemoveItemDefault(code int) *RemoveItemDefault

NewRemoveItemDefault creates RemoveItemDefault with default headers values

func (*RemoveItemDefault) SetPayload

func (o *RemoveItemDefault) SetPayload(payload models.ErrorResponse)

SetPayload sets the payload to the remove item default response

func (*RemoveItemDefault) SetStatusCode

func (o *RemoveItemDefault) SetStatusCode(code int)

SetStatusCode sets the status to the remove item default response

func (*RemoveItemDefault) WithPayload

func (o *RemoveItemDefault) WithPayload(payload models.ErrorResponse) *RemoveItemDefault

WithPayload adds the payload to the remove item default response

func (*RemoveItemDefault) WithStatusCode

func (o *RemoveItemDefault) WithStatusCode(code int) *RemoveItemDefault

WithStatusCode adds the status to the remove item default response

func (*RemoveItemDefault) WriteResponse

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

WriteResponse to the client

type RemoveItemHandler

type RemoveItemHandler interface {
	Handle(RemoveItemParams) middleware.Responder
}

RemoveItemHandler interface for that can handle valid remove item params

type RemoveItemHandlerFunc

type RemoveItemHandlerFunc func(RemoveItemParams) middleware.Responder

RemoveItemHandlerFunc turns a function with the right signature into a remove item handler

func (RemoveItemHandlerFunc) Handle

Handle executing the request and returning a response

type RemoveItemOK

type RemoveItemOK struct {

	/*
	  In: Body
	*/
	Payload *models.RemoveResponse `json:"body,omitempty"`
}

RemoveItemOK Success

swagger:response removeItemOK

func NewRemoveItemOK

func NewRemoveItemOK() *RemoveItemOK

NewRemoveItemOK creates RemoveItemOK with default headers values

func (*RemoveItemOK) SetPayload

func (o *RemoveItemOK) SetPayload(payload *models.RemoveResponse)

SetPayload sets the payload to the remove item o k response

func (*RemoveItemOK) WithPayload

func (o *RemoveItemOK) WithPayload(payload *models.RemoveResponse) *RemoveItemOK

WithPayload adds the payload to the remove item o k response

func (*RemoveItemOK) WriteResponse

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

WriteResponse to the client

type RemoveItemParams

type RemoveItemParams struct {

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

	/*
	  Required: true
	  In: path
	*/
	ID string
}

RemoveItemParams contains all the bound params for the remove item operation typically these are obtained from a http.Request

swagger:parameters removeItem

func NewRemoveItemParams

func NewRemoveItemParams() RemoveItemParams

NewRemoveItemParams creates a new RemoveItemParams object no default values defined in spec.

func (*RemoveItemParams) BindRequest

func (o *RemoveItemParams) 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 NewRemoveItemParams() beforehand.

type RemoveItemURL

type RemoveItemURL struct {
	ID string
	// contains filtered or unexported fields
}

RemoveItemURL generates an URL for the remove item operation

func (*RemoveItemURL) Build

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

Build a url path and query string

func (*RemoveItemURL) BuildFull

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

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

func (*RemoveItemURL) Must

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

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

func (*RemoveItemURL) SetBasePath

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

func (o *RemoveItemURL) String() string

String returns the string representation of the path with query string

func (*RemoveItemURL) StringFull

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

StringFull returns the string representation of a complete url

func (*RemoveItemURL) WithBasePath

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

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 TodoAPI

type TodoAPI 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 a "application/json" mime type
	JSONConsumer runtime.Consumer

	// JSONProducer registers a producer for a "application/json" mime type
	JSONProducer runtime.Producer

	// AddItemHandler sets the operation handler for the add item operation
	AddItemHandler AddItemHandler
	// ListItemsHandler sets the operation handler for the list items operation
	ListItemsHandler ListItemsHandler
	// RemoveItemHandler sets the operation handler for the remove item operation
	RemoveItemHandler RemoveItemHandler

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

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

TodoAPI the todo API

func NewTodoAPI

func NewTodoAPI(spec *loads.Document) *TodoAPI

NewTodoAPI creates a new Todo instance

func (*TodoAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*TodoAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*TodoAPI) ConsumersFor

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

ConsumersFor gets the consumers for the specified media types

func (*TodoAPI) Context

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

Context returns the middleware context for the todo API

func (*TodoAPI) DefaultConsumes

func (o *TodoAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*TodoAPI) DefaultProduces

func (o *TodoAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*TodoAPI) Formats

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

Formats returns the registered string formats

func (*TodoAPI) HandlerFor

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

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

func (*TodoAPI) Init

func (o *TodoAPI) Init()

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

func (*TodoAPI) ProducersFor

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

ProducersFor gets the producers for the specified media types

func (*TodoAPI) RegisterConsumer

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

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

func (*TodoAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*TodoAPI) RegisterProducer

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

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

func (*TodoAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*TodoAPI) SetDefaultConsumes

func (o *TodoAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*TodoAPI) SetDefaultProduces

func (o *TodoAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*TodoAPI) SetSpec

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

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

func (*TodoAPI) Validate

func (o *TodoAPI) Validate() error

Validate validates the registrations in the TodoAPI

Jump to

Keyboard shortcuts

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