api

package
v0.0.0-...-7b47575 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 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 *mux.Router) http.Handler

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

func HandlerFromMuxWithBaseURL

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

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) 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 Client

type Client struct {
	Name string `json:"name"`
}

Client defines model for Client.

type ClientAndMaybeIdentity

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

ClientAndMaybeIdentity defines model for ClientAndMaybeIdentity.

func (ClientAndMaybeIdentity) AsClient

func (t ClientAndMaybeIdentity) AsClient() (Client, error)

AsClient returns the union data inside the ClientAndMaybeIdentity as a Client

func (ClientAndMaybeIdentity) AsIdentity

func (t ClientAndMaybeIdentity) AsIdentity() (Identity, error)

AsIdentity returns the union data inside the ClientAndMaybeIdentity as a Identity

func (*ClientAndMaybeIdentity) FromClient

func (t *ClientAndMaybeIdentity) FromClient(v Client) error

FromClient overwrites any union data inside the ClientAndMaybeIdentity as the provided Client

func (*ClientAndMaybeIdentity) FromIdentity

func (t *ClientAndMaybeIdentity) FromIdentity(v Identity) error

FromIdentity overwrites any union data inside the ClientAndMaybeIdentity as the provided Identity

func (ClientAndMaybeIdentity) MarshalJSON

func (t ClientAndMaybeIdentity) MarshalJSON() ([]byte, error)

func (*ClientAndMaybeIdentity) MergeClient

func (t *ClientAndMaybeIdentity) MergeClient(v Client) error

MergeClient performs a merge with any union data inside the ClientAndMaybeIdentity, using the provided Client

func (*ClientAndMaybeIdentity) MergeIdentity

func (t *ClientAndMaybeIdentity) MergeIdentity(v Identity) error

MergeIdentity performs a merge with any union data inside the ClientAndMaybeIdentity, using the provided Identity

func (*ClientAndMaybeIdentity) UnmarshalJSON

func (t *ClientAndMaybeIdentity) UnmarshalJSON(b []byte) error

type ClientWithId

type ClientWithId struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

ClientWithId defines model for ClientWithId.

type CustomServer

type CustomServer struct {
	Lock sync.Mutex
}

func NewCustomServer

func NewCustomServer() *CustomServer

func (*CustomServer) GetClientAndMaybeIdentity

GET /client-and-maybe-identity

func (*CustomServer) GetClientWithId

GET /client-with-id

func (*CustomServer) GetIdentityWithDuplicateField

GET /identity-with-duplicate-field

type GetClientAndMaybeIdentity200JSONResponse

type GetClientAndMaybeIdentity200JSONResponse ClientAndMaybeIdentity

func (GetClientAndMaybeIdentity200JSONResponse) VisitGetClientAndMaybeIdentityResponse

func (response GetClientAndMaybeIdentity200JSONResponse) VisitGetClientAndMaybeIdentityResponse(w http.ResponseWriter) error

type GetClientAndMaybeIdentityRequestObject

type GetClientAndMaybeIdentityRequestObject struct {
}

type GetClientAndMaybeIdentityResponseObject

type GetClientAndMaybeIdentityResponseObject interface {
	VisitGetClientAndMaybeIdentityResponse(w http.ResponseWriter) error
}

type GetClientWithId200JSONResponse

type GetClientWithId200JSONResponse ClientWithId

func (GetClientWithId200JSONResponse) VisitGetClientWithIdResponse

func (response GetClientWithId200JSONResponse) VisitGetClientWithIdResponse(w http.ResponseWriter) error

type GetClientWithIdRequestObject

type GetClientWithIdRequestObject struct {
}

type GetClientWithIdResponseObject

type GetClientWithIdResponseObject interface {
	VisitGetClientWithIdResponse(w http.ResponseWriter) error
}

type GetIdentityWithDuplicateField200JSONResponse

type GetIdentityWithDuplicateField200JSONResponse IdentityWithDuplicateField

func (GetIdentityWithDuplicateField200JSONResponse) VisitGetIdentityWithDuplicateFieldResponse

func (response GetIdentityWithDuplicateField200JSONResponse) VisitGetIdentityWithDuplicateFieldResponse(w http.ResponseWriter) error

type GetIdentityWithDuplicateFieldRequestObject

type GetIdentityWithDuplicateFieldRequestObject struct {
}

type GetIdentityWithDuplicateFieldResponseObject

type GetIdentityWithDuplicateFieldResponseObject interface {
	VisitGetIdentityWithDuplicateFieldResponse(w http.ResponseWriter) error
}

type GorillaServerOptions

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

type Identity

type Identity struct {
	Issuer string `json:"issuer"`
}

Identity defines model for Identity.

type IdentityWithDuplicateField

type IdentityWithDuplicateField struct {
	Issuer struct {
		Name string `json:"name"`
	} `json:"issuer"`
}

IdentityWithDuplicateField defines model for IdentityWithDuplicateField.

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 {
	// Get identity-with-duplicate-field
	// (GET /client-and-maybe-identity)
	GetClientAndMaybeIdentity(w http.ResponseWriter, r *http.Request)
	// Get client-with-id
	// (GET /client-with-id)
	GetClientWithId(w http.ResponseWriter, r *http.Request)
	// Get identity-with-duplicate-field
	// (GET /identity-with-duplicate-field)
	GetIdentityWithDuplicateField(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

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

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

GetClientAndMaybeIdentity operation middleware

func (*ServerInterfaceWrapper) GetClientWithId

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

GetClientWithId operation middleware

func (*ServerInterfaceWrapper) GetIdentityWithDuplicateField

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

GetIdentityWithDuplicateField operation middleware

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictServerInterface

type StrictServerInterface interface {
	// Get identity-with-duplicate-field
	// (GET /client-and-maybe-identity)
	GetClientAndMaybeIdentity(ctx context.Context, request GetClientAndMaybeIdentityRequestObject) (GetClientAndMaybeIdentityResponseObject, error)
	// Get client-with-id
	// (GET /client-with-id)
	GetClientWithId(ctx context.Context, request GetClientWithIdRequestObject) (GetClientWithIdResponseObject, error)
	// Get identity-with-duplicate-field
	// (GET /identity-with-duplicate-field)
	GetIdentityWithDuplicateField(ctx context.Context, request GetIdentityWithDuplicateFieldRequestObject) (GetIdentityWithDuplicateFieldResponseObject, error)
}

StrictServerInterface represents all server handlers.

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