Documentation ¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/xenking/oapi-codegen version (devel) DO NOT EDIT.
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/xenking/oapi-codegen version (devel) DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func NewAddPetRequest(server string, body models.AddPetJSONRequestBody) (*http.Request, error)
- func NewAddPetRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewDeletePetRequest(server string, id int64) (*http.Request, error)
- func NewFindPetByIDRequest(server string, id int64) (*http.Request, error)
- func NewFindPetsRequest(server string, params *models.FindPetsParams) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func QueryParams(ctx *fiber.Ctx) url.Values
- func RegisterHandlers(router FiberRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router FiberRouter, si ServerInterface, baseURL string)
- type AddPetResponse
- type Client
- func (c *Client) AddPet(ctx context.Context, body models.AddPetJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) AddPetWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) DeletePet(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) FindPetByID(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) FindPets(ctx context.Context, params *models.FindPetsParams, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*AddPetResponse, error)
- func (c *ClientWithResponses) AddPetWithResponse(ctx context.Context, body models.AddPetJSONRequestBody, ...) (*AddPetResponse, error)
- func (c *ClientWithResponses) DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error)
- func (c *ClientWithResponses) FindPetByIDWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIDResponse, error)
- func (c *ClientWithResponses) FindPetsWithResponse(ctx context.Context, params *models.FindPetsParams, ...) (*FindPetsResponse, error)
- type ClientWithResponsesInterface
- type DeletePetResponse
- type FiberRouter
- type FindPetByIDResponse
- type FindPetsResponse
- type HttpRequestDoer
- type PetStore
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
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 NewAddPetRequest ¶ added in v1.9.9
NewAddPetRequest calls the generic AddPet builder with application/json body
func NewAddPetRequestWithBody ¶ added in v1.9.9
func NewAddPetRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewAddPetRequestWithBody generates requests for AddPet with any type of body
func NewDeletePetRequest ¶ added in v1.9.9
NewDeletePetRequest generates requests for DeletePet
func NewFindPetByIDRequest ¶ added in v1.9.9
NewFindPetByIDRequest generates requests for FindPetByID
func NewFindPetsRequest ¶ added in v1.9.9
NewFindPetsRequest generates requests for FindPets
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func QueryParams ¶
func RegisterHandlers ¶
func RegisterHandlers(router FiberRouter, si ServerInterface)
RegisterHandlers adds each server route to the FiberRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router FiberRouter, si ServerInterface, baseURL string)
Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.
Types ¶
type AddPetResponse ¶ added in v1.9.9
type AddPetResponse struct { Body []byte HTTPResponse *http.Response JSON200 *models.Pet JSONDefault *models.Error }
func ParseAddPetResponse ¶ added in v1.9.9
func ParseAddPetResponse(rsp *http.Response) (*AddPetResponse, error)
ParseAddPetResponse parses an HTTP response from a AddPetWithResponse call
func (AddPetResponse) Status ¶ added in v1.9.9
func (r AddPetResponse) Status() string
Status returns HTTPResponse.Status
func (AddPetResponse) StatusCode ¶ added in v1.9.9
func (r AddPetResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Client ¶ added in v1.9.9
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.
func NewClient ¶ added in v1.9.9
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) AddPet ¶ added in v1.9.9
func (c *Client) AddPet(ctx context.Context, body models.AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) AddPetWithBody ¶ added in v1.9.9
func (*Client) FindPetByID ¶ added in v1.9.9
type ClientInterface ¶ added in v1.9.9
type ClientInterface interface { // FindPets request FindPets(ctx context.Context, params *models.FindPetsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // AddPet request with any body AddPetWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) AddPet(ctx context.Context, body models.AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // DeletePet request DeletePet(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error) // FindPetByID request FindPetByID(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶ added in v1.9.9
ClientOption allows setting custom parameters during construction
func WithBaseURL ¶ added in v1.9.9
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the baseURL.
func WithHTTPClient ¶ added in v1.9.9
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 ¶ added in v1.9.9
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 ¶ added in v1.9.9
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶ added in v1.9.9
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) AddPetWithBodyWithResponse ¶ added in v1.9.9
func (c *ClientWithResponses) AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
AddPetWithBodyWithResponse request with arbitrary body returning *AddPetResponse
func (*ClientWithResponses) AddPetWithResponse ¶ added in v1.9.9
func (c *ClientWithResponses) AddPetWithResponse(ctx context.Context, body models.AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*AddPetResponse, error)
func (*ClientWithResponses) DeletePetWithResponse ¶ added in v1.9.9
func (c *ClientWithResponses) DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error)
DeletePetWithResponse request returning *DeletePetResponse
func (*ClientWithResponses) FindPetByIDWithResponse ¶ added in v1.9.9
func (c *ClientWithResponses) FindPetByIDWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIDResponse, error)
FindPetByIDWithResponse request returning *FindPetByIDResponse
func (*ClientWithResponses) FindPetsWithResponse ¶ added in v1.9.9
func (c *ClientWithResponses) FindPetsWithResponse(ctx context.Context, params *models.FindPetsParams, reqEditors ...RequestEditorFn) (*FindPetsResponse, error)
FindPetsWithResponse request returning *FindPetsResponse
type ClientWithResponsesInterface ¶ added in v1.9.9
type ClientWithResponsesInterface interface { // FindPets request FindPetsWithResponse(ctx context.Context, params *models.FindPetsParams, reqEditors ...RequestEditorFn) (*FindPetsResponse, error) // AddPet request with any body AddPetWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddPetResponse, error) AddPetWithResponse(ctx context.Context, body models.AddPetJSONRequestBody, reqEditors ...RequestEditorFn) (*AddPetResponse, error) // DeletePet request DeletePetWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*DeletePetResponse, error) // FindPetByID request FindPetByIDWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*FindPetByIDResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type DeletePetResponse ¶ added in v1.9.9
func ParseDeletePetResponse ¶ added in v1.9.9
func ParseDeletePetResponse(rsp *http.Response) (*DeletePetResponse, error)
ParseDeletePetResponse parses an HTTP response from a DeletePetWithResponse call
func (DeletePetResponse) Status ¶ added in v1.9.9
func (r DeletePetResponse) Status() string
Status returns HTTPResponse.Status
func (DeletePetResponse) StatusCode ¶ added in v1.9.9
func (r DeletePetResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type FiberRouter ¶
type FiberRouter interface { Connect(path string, handlers ...fiber.Handler) fiber.Router Delete(path string, handlers ...fiber.Handler) fiber.Router Get(path string, handlers ...fiber.Handler) fiber.Router Head(path string, handlers ...fiber.Handler) fiber.Router Options(path string, handlers ...fiber.Handler) fiber.Router Patch(path string, handlers ...fiber.Handler) fiber.Router Post(path string, handlers ...fiber.Handler) fiber.Router Put(path string, handlers ...fiber.Handler) fiber.Router Trace(path string, handlers ...fiber.Handler) fiber.Router }
This is a simple interface which specifies fiber.Route addition functions which are present on both fiber.App and fiber.Router, since we want to allow using either of them for path registration
type FindPetByIDResponse ¶ added in v1.9.9
type FindPetByIDResponse struct { Body []byte HTTPResponse *http.Response JSON200 *models.Pet JSONDefault *models.Error }
func ParseFindPetByIDResponse ¶ added in v1.9.9
func ParseFindPetByIDResponse(rsp *http.Response) (*FindPetByIDResponse, error)
ParseFindPetByIDResponse parses an HTTP response from a FindPetByIDWithResponse call
func (FindPetByIDResponse) Status ¶ added in v1.9.9
func (r FindPetByIDResponse) Status() string
Status returns HTTPResponse.Status
func (FindPetByIDResponse) StatusCode ¶ added in v1.9.9
func (r FindPetByIDResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type FindPetsResponse ¶ added in v1.9.9
type FindPetsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *[]models.Pet JSONDefault *models.Error }
func ParseFindPetsResponse ¶ added in v1.9.9
func ParseFindPetsResponse(rsp *http.Response) (*FindPetsResponse, error)
ParseFindPetsResponse parses an HTTP response from a FindPetsWithResponse call
func (FindPetsResponse) Status ¶ added in v1.9.9
func (r FindPetsResponse) Status() string
Status returns HTTPResponse.Status
func (FindPetsResponse) StatusCode ¶ added in v1.9.9
func (r FindPetsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶ added in v1.9.9
Doer performs HTTP requests.
The standard http.Client implements this interface.
type RequestEditorFn ¶ added in v1.9.9
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Returns all pets // (GET /pets) FindPets(ctx *fiber.Ctx, params models.FindPetsParams) error // Creates a new pet // (POST /pets) AddPet(ctx *fiber.Ctx) error // Deletes a pet by ID // (DELETE /pets/{id}) DeletePet(ctx *fiber.Ctx, id int64) error // Returns a pet by ID // (GET /pets/{id}) FindPetByID(ctx *fiber.Ctx, id int64) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts fiber contexts to parameters.
func (*ServerInterfaceWrapper) AddPet ¶
func (w *ServerInterfaceWrapper) AddPet(ctx *fiber.Ctx) error
AddPet converts fiber context to params.
func (*ServerInterfaceWrapper) DeletePet ¶
func (w *ServerInterfaceWrapper) DeletePet(ctx *fiber.Ctx) error
DeletePet converts fiber context to params.
func (*ServerInterfaceWrapper) FindPetByID ¶
func (w *ServerInterfaceWrapper) FindPetByID(ctx *fiber.Ctx) error
FindPetByID converts fiber context to params.
func (*ServerInterfaceWrapper) FindPets ¶
func (w *ServerInterfaceWrapper) FindPets(ctx *fiber.Ctx) error
FindPets converts fiber context to params.