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.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err 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 FiberRouter
- type PetStore
- 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 PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
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 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 PetStore ¶
func NewPetStore ¶
func NewPetStore() *PetStore
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.