operations

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPageOKCode int = 200

DefaultPageOKCode is the HTTP code returned for type DefaultPageOK

View Source
const GetResourceNotFoundCode int = 404

GetResourceNotFoundCode is the HTTP code returned for type GetResourceNotFound

View Source
const GetResourceOKCode int = 200

GetResourceOKCode is the HTTP code returned for type GetResourceOK

Variables

This section is empty.

Functions

This section is empty.

Types

type DeWebAPI

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

	// DefaultPageHandler sets the operation handler for the default page operation
	DefaultPageHandler DefaultPageHandler
	// GetResourceHandler sets the operation handler for the get resource operation
	GetResourceHandler GetResourceHandler

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

DeWebAPI DeWeb API used to browse decentralized websites

func NewDeWebAPI

func NewDeWebAPI(spec *loads.Document) *DeWebAPI

NewDeWebAPI creates a new DeWeb instance

func (*DeWebAPI) AddMiddlewareFor

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

AddMiddlewareFor adds a http middleware to existing handler

func (*DeWebAPI) AuthenticatorsFor

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

AuthenticatorsFor gets the authenticators for the specified security schemes

func (*DeWebAPI) Authorizer

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

Authorizer returns the registered authorizer

func (*DeWebAPI) ConsumersFor

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

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

func (*DeWebAPI) Context

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

Context returns the middleware context for the de web API

func (*DeWebAPI) DefaultConsumes

func (o *DeWebAPI) DefaultConsumes() string

DefaultConsumes returns the default consumes media type

func (*DeWebAPI) DefaultProduces

func (o *DeWebAPI) DefaultProduces() string

DefaultProduces returns the default produces media type

func (*DeWebAPI) Formats

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

Formats returns the registered string formats

func (*DeWebAPI) HandlerFor

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

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

func (*DeWebAPI) Init

func (o *DeWebAPI) Init()

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

func (*DeWebAPI) ProducersFor

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

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

func (*DeWebAPI) RegisterConsumer

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

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

func (*DeWebAPI) RegisterFormat

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

RegisterFormat registers a custom format validator

func (*DeWebAPI) RegisterProducer

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

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

func (*DeWebAPI) Serve

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

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

ServeErrorFor gets a error handler for a given operation id

func (*DeWebAPI) SetDefaultConsumes

func (o *DeWebAPI) SetDefaultConsumes(mediaType string)

SetDefaultConsumes returns the default consumes media type

func (*DeWebAPI) SetDefaultProduces

func (o *DeWebAPI) SetDefaultProduces(mediaType string)

SetDefaultProduces sets the default produces media type

func (*DeWebAPI) SetSpec

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

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

func (*DeWebAPI) UseRedoc

func (o *DeWebAPI) UseRedoc()

UseRedoc for documentation at /docs

func (*DeWebAPI) UseSwaggerUI

func (o *DeWebAPI) UseSwaggerUI()

UseSwaggerUI for documentation at /docs

func (*DeWebAPI) Validate

func (o *DeWebAPI) Validate() error

Validate validates the registrations in the DeWebAPI

type DefaultPage

type DefaultPage struct {
	Context *middleware.Context
	Handler DefaultPageHandler
}
DefaultPage swagger:route GET / defaultPage

DefaultPage default page API

func NewDefaultPage

func NewDefaultPage(ctx *middleware.Context, handler DefaultPageHandler) *DefaultPage

NewDefaultPage creates a new http.Handler for the default page operation

func (*DefaultPage) ServeHTTP

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

type DefaultPageHandler

type DefaultPageHandler interface {
	Handle(DefaultPageParams) middleware.Responder
}

DefaultPageHandler interface for that can handle valid default page params

type DefaultPageHandlerFunc

type DefaultPageHandlerFunc func(DefaultPageParams) middleware.Responder

DefaultPageHandlerFunc turns a function with the right signature into a default page handler

func (DefaultPageHandlerFunc) Handle

Handle executing the request and returning a response

type DefaultPageOK

type DefaultPageOK struct {
}

DefaultPageOK Shows the default page

swagger:response defaultPageOK

func NewDefaultPageOK

func NewDefaultPageOK() *DefaultPageOK

NewDefaultPageOK creates DefaultPageOK with default headers values

func (*DefaultPageOK) WriteResponse

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

WriteResponse to the client

type DefaultPageParams

type DefaultPageParams struct {

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

DefaultPageParams contains all the bound params for the default page operation typically these are obtained from a http.Request

swagger:parameters defaultPage

func NewDefaultPageParams

func NewDefaultPageParams() DefaultPageParams

NewDefaultPageParams creates a new DefaultPageParams object

There are no default values defined in the spec.

func (*DefaultPageParams) BindRequest

func (o *DefaultPageParams) 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 NewDefaultPageParams() beforehand.

type DefaultPageURL

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

DefaultPageURL generates an URL for the default page operation

func (*DefaultPageURL) Build

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

Build a url path and query string

func (*DefaultPageURL) BuildFull

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

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

func (*DefaultPageURL) Must

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

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

func (*DefaultPageURL) SetBasePath

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

func (o *DefaultPageURL) String() string

String returns the string representation of the path with query string

func (*DefaultPageURL) StringFull

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

StringFull returns the string representation of a complete url

func (*DefaultPageURL) WithBasePath

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

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 GetResource

type GetResource struct {
	Context *middleware.Context
	Handler GetResourceHandler
}
GetResource swagger:route GET /{resource} getResource

GetResource get resource API

func NewGetResource

func NewGetResource(ctx *middleware.Context, handler GetResourceHandler) *GetResource

NewGetResource creates a new http.Handler for the get resource operation

func (*GetResource) ServeHTTP

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

type GetResourceHandler

type GetResourceHandler interface {
	Handle(GetResourceParams) middleware.Responder
}

GetResourceHandler interface for that can handle valid get resource params

type GetResourceHandlerFunc

type GetResourceHandlerFunc func(GetResourceParams) middleware.Responder

GetResourceHandlerFunc turns a function with the right signature into a get resource handler

func (GetResourceHandlerFunc) Handle

Handle executing the request and returning a response

type GetResourceNotFound

type GetResourceNotFound struct {

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

GetResourceNotFound Resource not found

swagger:response getResourceNotFound

func NewGetResourceNotFound

func NewGetResourceNotFound() *GetResourceNotFound

NewGetResourceNotFound creates GetResourceNotFound with default headers values

func (*GetResourceNotFound) SetPayload

func (o *GetResourceNotFound) SetPayload(payload *models.Error)

SetPayload sets the payload to the get resource not found response

func (*GetResourceNotFound) WithPayload

func (o *GetResourceNotFound) WithPayload(payload *models.Error) *GetResourceNotFound

WithPayload adds the payload to the get resource not found response

func (*GetResourceNotFound) WriteResponse

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

WriteResponse to the client

type GetResourceOK

type GetResourceOK struct {
}

GetResourceOK Successful response

swagger:response getResourceOK

func NewGetResourceOK

func NewGetResourceOK() *GetResourceOK

NewGetResourceOK creates GetResourceOK with default headers values

func (*GetResourceOK) WriteResponse

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

WriteResponse to the client

type GetResourceParams

type GetResourceParams struct {

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

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

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

swagger:parameters getResource

func NewGetResourceParams

func NewGetResourceParams() GetResourceParams

NewGetResourceParams creates a new GetResourceParams object

There are no default values defined in the spec.

func (*GetResourceParams) BindRequest

func (o *GetResourceParams) 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 NewGetResourceParams() beforehand.

type GetResourceURL

type GetResourceURL struct {
	Resource string
	// contains filtered or unexported fields
}

GetResourceURL generates an URL for the get resource operation

func (*GetResourceURL) Build

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

Build a url path and query string

func (*GetResourceURL) BuildFull

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

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

func (*GetResourceURL) Must

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

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

func (*GetResourceURL) SetBasePath

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

func (o *GetResourceURL) String() string

String returns the string representation of the path with query string

func (*GetResourceURL) StringFull

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

StringFull returns the string representation of a complete url

func (*GetResourceURL) WithBasePath

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

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