Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err 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 CreateProductJSONBody
- type CreateProductJSONRequestBody
- type CreateProductParams
- type DeleteProductParams
- type GetProductsParams
- type GinServerOptions
- type Goods
- type MiddlewareFunc
- type PatchGoodsReprioritizeJSONBody
- type PatchGoodsReprioritizeJSONRequestBody
- type PatchGoodsReprioritizeParams
- type Product
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateProduct(c *gin.Context)
- func (siw *ServerInterfaceWrapper) DeleteProduct(c *gin.Context)
- func (siw *ServerInterfaceWrapper) GetProducts(c *gin.Context)
- func (siw *ServerInterfaceWrapper) PatchGoodsReprioritize(c *gin.Context)
- func (siw *ServerInterfaceWrapper) UpdateProduct(c *gin.Context)
- type UpdateProductJSONBody
- type UpdateProductJSONRequestBody
- type UpdateProductParams
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 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 CreateProductJSONBody ¶
type CreateProductJSONBody struct {
Name string `binding:"required,min=1" json:"name"`
}
CreateProductJSONBody defines parameters for CreateProduct.
type CreateProductJSONRequestBody ¶
type CreateProductJSONRequestBody CreateProductJSONBody
CreateProductJSONRequestBody defines body for CreateProduct for application/json ContentType.
type CreateProductParams ¶
type CreateProductParams struct {
// ProjectId Product project Id.
ProjectId int `form:"projectId" json:"projectId"`
}
CreateProductParams defines parameters for CreateProduct.
type DeleteProductParams ¶
type DeleteProductParams struct {
// Id ID of product.
Id int `form:"id" json:"id"`
// ProjectId Product project ID.
ProjectId int `form:"projectId" json:"projectId"`
}
DeleteProductParams defines parameters for DeleteProduct.
type GetProductsParams ¶
type GetProductsParams struct {
// Limit Product display limit. Default to 10.
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
// Offset From which position to display. Default to 0.
Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}
GetProductsParams defines parameters for GetProducts.
type GinServerOptions ¶
type GinServerOptions struct {
BaseURL string
Middlewares []MiddlewareFunc
ErrorHandler func(*gin.Context, error, int)
}
GinServerOptions provides options for the Gin server.
type Goods ¶
type Goods struct {
Goods *[]Product `json:"goods,omitempty"`
Meta *struct {
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
Removed *int `json:"removed,omitempty"`
Total *int `json:"total,omitempty"`
} `json:"meta,omitempty"`
}
Goods defines model for Goods.
type MiddlewareFunc ¶
type PatchGoodsReprioritizeJSONBody ¶
type PatchGoodsReprioritizeJSONBody struct {
NewPriority int `json:"newPriority"`
}
PatchGoodsReprioritizeJSONBody defines parameters for PatchGoodsReprioritize.
type PatchGoodsReprioritizeJSONRequestBody ¶
type PatchGoodsReprioritizeJSONRequestBody PatchGoodsReprioritizeJSONBody
PatchGoodsReprioritizeJSONRequestBody defines body for PatchGoodsReprioritize for application/json ContentType.
type PatchGoodsReprioritizeParams ¶
type PatchGoodsReprioritizeParams struct {
// Id Product ID.
Id int `form:"id" json:"id"`
// ProjectId Project ID.
ProjectId int `form:"projectId" json:"projectId"`
}
PatchGoodsReprioritizeParams defines parameters for PatchGoodsReprioritize.
type Product ¶
type Product struct {
// CreatedAt Product creation date.
CreatedAt *string `json:"created_at,omitempty"`
// Description Description of product.
Description *string `json:"description,omitempty"`
// Id ID of product.
Id *int `json:"id,omitempty"`
// Name Name of product.
Name *string `json:"name,omitempty"`
// Priority Priority of product.
Priority *int `json:"priority,omitempty"`
// ProjectId Product project id.
ProjectId *int `json:"projectId,omitempty"`
// Removed Product deletion status.
Removed *bool `json:"removed,omitempty"`
}
Product defines model for Product.
type ServerInterface ¶
type ServerInterface interface {
// Create product
// (POST /good/create)
CreateProduct(c *gin.Context, params CreateProductParams)
// Delete product
// (DELETE /good/remove)
DeleteProduct(c *gin.Context, params DeleteProductParams)
// Update existing product
// (PATCH /good/update)
UpdateProduct(c *gin.Context, params UpdateProductParams)
// Get goods list
// (GET /goods/list)
GetProducts(c *gin.Context, params GetProductsParams)
// UpdateProductPriority
// (PATCH /goods/reprioritize)
PatchGoodsReprioritize(c *gin.Context, params PatchGoodsReprioritizeParams)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandler func(*gin.Context, error, int)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateProduct ¶
func (siw *ServerInterfaceWrapper) CreateProduct(c *gin.Context)
CreateProduct operation middleware
func (*ServerInterfaceWrapper) DeleteProduct ¶
func (siw *ServerInterfaceWrapper) DeleteProduct(c *gin.Context)
DeleteProduct operation middleware
func (*ServerInterfaceWrapper) GetProducts ¶
func (siw *ServerInterfaceWrapper) GetProducts(c *gin.Context)
GetProducts operation middleware
func (*ServerInterfaceWrapper) PatchGoodsReprioritize ¶
func (siw *ServerInterfaceWrapper) PatchGoodsReprioritize(c *gin.Context)
PatchGoodsReprioritize operation middleware
func (*ServerInterfaceWrapper) UpdateProduct ¶
func (siw *ServerInterfaceWrapper) UpdateProduct(c *gin.Context)
UpdateProduct operation middleware
type UpdateProductJSONBody ¶
type UpdateProductJSONBody struct {
Description *string `json:"description,omitempty"`
Name string `binding:"required,min=1" json:"name"`
}
UpdateProductJSONBody defines parameters for UpdateProduct.
type UpdateProductJSONRequestBody ¶
type UpdateProductJSONRequestBody UpdateProductJSONBody
UpdateProductJSONRequestBody defines body for UpdateProduct for application/json ContentType.
type UpdateProductParams ¶
type UpdateProductParams struct {
// Id ID of product.
Id int `form:"id" json:"id"`
// ProjectId Product project ID.
ProjectId int `form:"projectId" json:"projectId"`
}
UpdateProductParams defines parameters for UpdateProduct.