api

package
v0.0.0-...-b088c74 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 11 Imported by: 0

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

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 PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

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 MiddlewareFunc func(c *gin.Context)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL