restapi

package
v0.0.0-...-6cfc1b2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package restapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.1-0.20220609223533-7da811e1cf30 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type FeatureEnable

type FeatureEnable struct {
	// enable flag
	Enable *bool `json:"enable,omitempty"`
}

Enable/disable a feature

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type PostEnableJSONBody

type PostEnableJSONBody = FeatureEnable

PostEnableJSONBody defines parameters for PostEnable.

type PostEnableJSONRequestBody

type PostEnableJSONRequestBody = PostEnableJSONBody

PostEnableJSONRequestBody defines body for PostEnable for application/json ContentType.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// enable/disable the spec reconstruction
	// (POST /enable)
	PostEnable(w http.ResponseWriter, r *http.Request)
	// Get the version of this Plugin
	// (GET /version)
	GetVersion(w http.ResponseWriter, r *http.Request)
	// Start the spec reconstruction for this API.
	// (POST /{apiID}/start)
	PostAPIIDStart(w http.ResponseWriter, r *http.Request, apiID externalRef0.ApiID)
	// Stop the spec reconstruction for this API.
	// (POST /{apiID}/stop)
	PostAPIIDStop(w http.ResponseWriter, r *http.Request, apiID externalRef0.ApiID)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetVersion

func (siw *ServerInterfaceWrapper) GetVersion(w http.ResponseWriter, r *http.Request)

GetVersion operation middleware

func (*ServerInterfaceWrapper) PostAPIIDStart

func (siw *ServerInterfaceWrapper) PostAPIIDStart(w http.ResponseWriter, r *http.Request)

PostAPIIDStart operation middleware

func (*ServerInterfaceWrapper) PostAPIIDStop

func (siw *ServerInterfaceWrapper) PostAPIIDStop(w http.ResponseWriter, r *http.Request)

PostAPIIDStop operation middleware

func (*ServerInterfaceWrapper) PostEnable

func (siw *ServerInterfaceWrapper) PostEnable(w http.ResponseWriter, r *http.Request)

PostEnable operation middleware

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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