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 APIDiffs

type APIDiffs struct {
	ApiInfo externalRef0.ApiInfo `json:"apiInfo"`
	Diffs   []Diff               `json:"diffs"`
}

APIDiffs defines model for APIDiffs.

type ChiServerOptions

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

type Diff

type Diff struct {
	DiffType externalRef0.DiffType `json:"diffType"`

	// Timestamp of the time that the diff was last seen
	LastSeen int64                    `json:"lastSeen"`
	Method   *externalRef0.HttpMethod `json:"method,omitempty"`

	// New spec json string
	NewSpec string `json:"newSpec"`

	// Old spec json string
	OldSpec string `json:"oldSpec"`

	// Path of the diff element
	Path     *string                `json:"path,omitempty"`
	SpecType *externalRef0.SpecType `json:"specType,omitempty"`
}

Diff defines model for Diff.

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 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 {
	// Start Differ for an API
	// (POST /{apiID}/start)
	StartDiffer(w http.ResponseWriter, r *http.Request, apiID externalRef0.ApiID)
	// Stop Differ for an API
	// (POST /{apiID}/stop)
	StopDiffer(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) StartDiffer

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

StartDiffer operation middleware

func (*ServerInterfaceWrapper) StopDiffer

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

StopDiffer operation middleware

type SpecDiffs

type SpecDiffs struct {
	Diffs APIDiffs `json:"diffs"`
}

SpecDiffs defines model for SpecDiffs.

type SpecDiffsNotification

type SpecDiffsNotification struct {
	Diffs            APIDiffs `json:"diffs"`
	NotificationType string   `json:"notificationType"`
}

SpecDiffsNotification defines model for SpecDiffsNotification.

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