Documentation ¶
Overview ¶
Package pkg1 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/jKiler/oapi-codegen version v1.0.0-00010101000000-000000000000 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewTestRequest(server string) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router gin.IRouter, si ServerInterface)
- func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type GinServerOptions
- type HttpRequestDoer
- type MiddlewareFunc
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
- type Test200MultipartResponse
- type TestRequestObject
- type TestResponse
- type TestResponseObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
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 NewTestRequest ¶
NewTestRequest generates requests for Test
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router gin.IRouter, si ServerInterface)
RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)
RegisterHandlersWithOptions creates http.Handler with additional options
Types ¶
type Client ¶
type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn }
Client which conforms to the OpenAPI3 specification for this service.
type ClientInterface ¶
type ClientInterface interface { // Test request Test(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) TestWithResponse ¶
func (c *ClientWithResponses) TestWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TestResponse, error)
TestWithResponse request returning *TestResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // TestWithResponse request TestWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TestResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type GinServerOptions ¶
type GinServerOptions struct { BaseURL string Middlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
GinServerOptions provides options for the Gin server.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type MiddlewareFunc ¶
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
ServerInterface represents all server handlers.
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandler func(*gin.Context, error, int) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) Test ¶
func (siw *ServerInterfaceWrapper) Test(c *gin.Context)
Test operation middleware
type StrictHandlerFunc ¶
type StrictHandlerFunc = strictgin.StrictGinHandlerFunc
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc
type StrictServerInterface ¶
type StrictServerInterface interface { // (GET /test) Test(ctx context.Context, request TestRequestObject) (TestResponseObject, error) }
StrictServerInterface represents all server handlers.
type Test200MultipartResponse ¶
type Test200MultipartResponse externalRef0.TestMultipartResponse
func (Test200MultipartResponse) VisitTestResponse ¶
func (response Test200MultipartResponse) VisitTestResponse(w http.ResponseWriter) error
type TestRequestObject ¶
type TestRequestObject struct { }
type TestResponse ¶
func ParseTestResponse ¶
func ParseTestResponse(rsp *http.Response) (*TestResponse, error)
ParseTestResponse parses an HTTP response from a TestWithResponse call
func (TestResponse) Status ¶
func (r TestResponse) Status() string
Status returns HTTPResponse.Status
func (TestResponse) StatusCode ¶
func (r TestResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type TestResponseObject ¶
type TestResponseObject interface {
VisitTestResponse(w http.ResponseWriter) error
}