op

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AddContactCreatedCode int = 201

AddContactCreatedCode is the HTTP code returned for type AddContactCreated

View Source
const ListContactsOKCode int = 200

ListContactsOKCode is the HTTP code returned for type ListContactsOK

Variables

This section is empty.

Functions

This section is empty.

Types

type AddContact

type AddContact struct {
	Context *middleware.Context
	Handler AddContactHandler
}

AddContact swagger:route POST /contacts addContact

Add new contact.

func NewAddContact

func NewAddContact(ctx *middleware.Context, handler AddContactHandler) *AddContact

NewAddContact creates a new http.Handler for the add contact operation

func (*AddContact) ServeHTTP

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

type AddContactCreated

type AddContactCreated struct {

	/*
	  In: Body
	*/
	Payload *model.Contact `json:"body,omitempty"`
}

AddContactCreated Contact added.

swagger:response addContactCreated

func NewAddContactCreated

func NewAddContactCreated() *AddContactCreated

NewAddContactCreated creates AddContactCreated with default headers values

func (*AddContactCreated) AddContactResponder

func (o *AddContactCreated) AddContactResponder()

func (*AddContactCreated) SetPayload

func (o *AddContactCreated) SetPayload(payload *model.Contact)

SetPayload sets the payload to the add contact created response

func (*AddContactCreated) WithPayload

func (o *AddContactCreated) WithPayload(payload *model.Contact) *AddContactCreated

WithPayload adds the payload to the add contact created response

func (*AddContactCreated) WriteResponse

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

WriteResponse to the client

type AddContactDefault

type AddContactDefault struct {

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

AddContactDefault - 409.1000: contact already exists

swagger:response addContactDefault

func NewAddContactDefault

func NewAddContactDefault(code int) *AddContactDefault

NewAddContactDefault creates AddContactDefault with default headers values

func (*AddContactDefault) AddContactResponder

func (o *AddContactDefault) AddContactResponder()

func (*AddContactDefault) SetPayload

func (o *AddContactDefault) SetPayload(payload *model.Error)

SetPayload sets the payload to the add contact default response

func (*AddContactDefault) SetStatusCode

func (o *AddContactDefault) SetStatusCode(code int)

SetStatusCode sets the status to the add contact default response

func (*AddContactDefault) WithPayload

func (o *AddContactDefault) WithPayload(payload *model.Error) *AddContactDefault

WithPayload adds the payload to the add contact default response

func (*AddContactDefault) WithStatusCode

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

WithStatusCode adds the status to the add contact default response

func (*AddContactDefault) WriteResponse

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

WriteResponse to the client

type AddContactHandler

type AddContactHandler interface {
	Handle(AddContactParams, *app.Auth) AddContactResponder
}

AddContactHandler interface for that can handle valid add contact params

type AddContactHandlerFunc

type AddContactHandlerFunc func(AddContactParams, *app.Auth) AddContactResponder

AddContactHandlerFunc turns a function with the right signature into a add contact handler

func (AddContactHandlerFunc) Handle

func (fn AddContactHandlerFunc) Handle(params AddContactParams, principal *app.Auth) AddContactResponder

Handle executing the request and returning a response

type AddContactNotImplementedResponder

type AddContactNotImplementedResponder struct {
	middleware.Responder
}

func (*AddContactNotImplementedResponder) AddContactResponder

func (*AddContactNotImplementedResponder) AddContactResponder()

type AddContactParams

type AddContactParams struct {

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

	/*
	  Required: true
	  In: body
	*/
	Contact *model.Contact
}

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

swagger:parameters addContact

func NewAddContactParams

func NewAddContactParams() AddContactParams

NewAddContactParams creates a new AddContactParams object no default values defined in spec.

func (*AddContactParams) BindRequest

func (o *AddContactParams) 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 NewAddContactParams() beforehand.

type AddContactResponder

type AddContactResponder interface {
	middleware.Responder
	AddContactResponder()
}

func AddContactNotImplemented

func AddContactNotImplemented() AddContactResponder

type AddContactURL

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

AddContactURL generates an URL for the add contact operation

func (*AddContactURL) Build

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

Build a url path and query string

func (*AddContactURL) BuildFull

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

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

func (*AddContactURL) Must

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

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

func (*AddContactURL) SetBasePath

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

func (o *AddContactURL) String() string

String returns the string representation of the path with query string

func (*AddContactURL) StringFull

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

StringFull returns the string representation of a complete url

func (*AddContactURL) WithBasePath

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

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 AddressBookAPI

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

	// APIKeyAuth registers a function that takes a token and returns a principal
	// it performs authentication based on an api key API-Key provided in the header
	APIKeyAuth func(string) (*app.Auth, error)

	// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
	APIAuthorizer runtime.Authorizer

	// AddContactHandler sets the operation handler for the add contact operation
	AddContactHandler AddContactHandler
	// ListContactsHandler sets the operation handler for the list contacts operation
	ListContactsHandler ListContactsHandler
	// 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
}

AddressBookAPI # ... ## List of all custom errors First number is HTTP Status code, second is value of "code" field in returned JSON object, text description may or may not match "message" field in returned JSON object. - 409.1000: contact already exists

func NewAddressBookAPI

func NewAddressBookAPI(spec *loads.Document) *AddressBookAPI

NewAddressBookAPI creates a new AddressBook instance

func (*AddressBookAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*AddressBookAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*AddressBookAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*AddressBookAPI) ConsumersFor

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

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

func (*AddressBookAPI) Context

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

Context returns the middleware context for the address book API

func (*AddressBookAPI) DefaultConsumes

func (o *AddressBookAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*AddressBookAPI) DefaultProduces

func (o *AddressBookAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*AddressBookAPI) Formats

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

Formats returns the registered string formats

func (*AddressBookAPI) HandlerFor

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

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

func (*AddressBookAPI) Init

func (o *AddressBookAPI) Init()

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

func (*AddressBookAPI) ProducersFor

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

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

func (*AddressBookAPI) RegisterConsumer

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

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

func (*AddressBookAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*AddressBookAPI) RegisterProducer

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

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

func (*AddressBookAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*AddressBookAPI) SetDefaultConsumes

func (o *AddressBookAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*AddressBookAPI) SetDefaultProduces

func (o *AddressBookAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*AddressBookAPI) SetSpec

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

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

func (*AddressBookAPI) UseRedoc

func (o *AddressBookAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*AddressBookAPI) UseSwaggerUI

func (o *AddressBookAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*AddressBookAPI) Validate

func (o *AddressBookAPI) Validate() error

Validate validates the registrations in the AddressBookAPI

type ListContacts

type ListContacts struct {
	Context *middleware.Context
	Handler ListContactsHandler
}

ListContacts swagger:route GET /contacts listContacts

Return all contacts ordered by ID.

func NewListContacts

func NewListContacts(ctx *middleware.Context, handler ListContactsHandler) *ListContacts

NewListContacts creates a new http.Handler for the list contacts operation

func (*ListContacts) ServeHTTP

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

type ListContactsDefault

type ListContactsDefault struct {

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

ListContactsDefault Generic error response.

swagger:response listContactsDefault

func NewListContactsDefault

func NewListContactsDefault(code int) *ListContactsDefault

NewListContactsDefault creates ListContactsDefault with default headers values

func (*ListContactsDefault) ListContactsResponder

func (o *ListContactsDefault) ListContactsResponder()

func (*ListContactsDefault) SetPayload

func (o *ListContactsDefault) SetPayload(payload *model.Error)

SetPayload sets the payload to the list contacts default response

func (*ListContactsDefault) SetStatusCode

func (o *ListContactsDefault) SetStatusCode(code int)

SetStatusCode sets the status to the list contacts default response

func (*ListContactsDefault) WithPayload

func (o *ListContactsDefault) WithPayload(payload *model.Error) *ListContactsDefault

WithPayload adds the payload to the list contacts default response

func (*ListContactsDefault) WithStatusCode

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

WithStatusCode adds the status to the list contacts default response

func (*ListContactsDefault) WriteResponse

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

WriteResponse to the client

type ListContactsHandler

type ListContactsHandler interface {
	Handle(ListContactsParams, *app.Auth) ListContactsResponder
}

ListContactsHandler interface for that can handle valid list contacts params

type ListContactsHandlerFunc

type ListContactsHandlerFunc func(ListContactsParams, *app.Auth) ListContactsResponder

ListContactsHandlerFunc turns a function with the right signature into a list contacts handler

func (ListContactsHandlerFunc) Handle

Handle executing the request and returning a response

type ListContactsNotImplementedResponder

type ListContactsNotImplementedResponder struct {
	middleware.Responder
}

func (*ListContactsNotImplementedResponder) ListContactsResponder

func (*ListContactsNotImplementedResponder) ListContactsResponder()

type ListContactsOK

type ListContactsOK struct {

	/*
	  In: Body
	*/
	Payload []*model.Contact `json:"body,omitempty"`
}

ListContactsOK OK

swagger:response listContactsOK

func NewListContactsOK

func NewListContactsOK() *ListContactsOK

NewListContactsOK creates ListContactsOK with default headers values

func (*ListContactsOK) ListContactsResponder

func (o *ListContactsOK) ListContactsResponder()

func (*ListContactsOK) SetPayload

func (o *ListContactsOK) SetPayload(payload []*model.Contact)

SetPayload sets the payload to the list contacts o k response

func (*ListContactsOK) WithPayload

func (o *ListContactsOK) WithPayload(payload []*model.Contact) *ListContactsOK

WithPayload adds the payload to the list contacts o k response

func (*ListContactsOK) WriteResponse

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

WriteResponse to the client

type ListContactsParams

type ListContactsParams struct {

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

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

swagger:parameters listContacts

func NewListContactsParams

func NewListContactsParams() ListContactsParams

NewListContactsParams creates a new ListContactsParams object no default values defined in spec.

func (*ListContactsParams) BindRequest

func (o *ListContactsParams) 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 NewListContactsParams() beforehand.

type ListContactsResponder

type ListContactsResponder interface {
	middleware.Responder
	ListContactsResponder()
}

func ListContactsNotImplemented

func ListContactsNotImplemented() ListContactsResponder

type ListContactsURL

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

ListContactsURL generates an URL for the list contacts operation

func (*ListContactsURL) Build

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

Build a url path and query string

func (*ListContactsURL) BuildFull

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

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

func (*ListContactsURL) Must

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

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

func (*ListContactsURL) SetBasePath

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

func (o *ListContactsURL) String() string

String returns the string representation of the path with query string

func (*ListContactsURL) StringFull

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

StringFull returns the string representation of a complete url

func (*ListContactsURL) WithBasePath

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

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

Jump to

Keyboard shortcuts

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