api

package
v0.0.0-...-876f98b Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.Swagger, 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 NewGetInventoryRequest

func NewGetInventoryRequest(server string) (*http.Request, error)

NewGetInventoryRequest generates requests for GetInventory

func NewListProductStocksRequest

func NewListProductStocksRequest(server string) (*http.Request, error)

NewListProductStocksRequest generates requests for ListProductStocks

func NewListProductsRequest

func NewListProductsRequest(server string) (*http.Request, error)

NewListProductsRequest generates requests for ListProducts

func NewSellFromInventoryRequest

func NewSellFromInventoryRequest(server string, body SellFromInventoryJSONRequestBody) (*http.Request, error)

NewSellFromInventoryRequest calls the generic SellFromInventory builder with application/json body

func NewSellFromInventoryRequestWithBody

func NewSellFromInventoryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewSellFromInventoryRequestWithBody generates requests for SellFromInventory with any type of body

func NewUpsertInventoryRequest

func NewUpsertInventoryRequest(server string, body UpsertInventoryJSONRequestBody) (*http.Request, error)

NewUpsertInventoryRequest calls the generic UpsertInventory builder with application/json body

func NewUpsertInventoryRequestWithBody

func NewUpsertInventoryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewUpsertInventoryRequestWithBody generates requests for UpsertInventory with any type of body

func NewUpsertProductsRequest

func NewUpsertProductsRequest(server string, body UpsertProductsJSONRequestBody) (*http.Request, error)

NewUpsertProductsRequest calls the generic UpsertProducts builder with application/json body

func NewUpsertProductsRequestWithBody

func NewUpsertProductsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewUpsertProductsRequestWithBody generates requests for UpsertProducts with any type of body

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 EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type Article

type Article struct {
	AmountOf string `json:"amount_of"`
	ArtId    string `json:"art_id"`
}

Article defines model for Article.

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.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetInventory

func (c *Client) GetInventory(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListProductStocks

func (c *Client) ListProductStocks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListProducts

func (c *Client) ListProducts(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SellFromInventory

func (c *Client) SellFromInventory(ctx context.Context, body SellFromInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SellFromInventoryWithBody

func (c *Client) SellFromInventoryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpsertInventory

func (c *Client) UpsertInventory(ctx context.Context, body UpsertInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpsertInventoryWithBody

func (c *Client) UpsertInventoryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpsertProducts

func (c *Client) UpsertProducts(ctx context.Context, body UpsertProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpsertProductsWithBody

func (c *Client) UpsertProductsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetInventory request
	GetInventory(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpsertInventory request  with any body
	UpsertInventoryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpsertInventory(ctx context.Context, body UpsertInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListProducts request
	ListProducts(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpsertProducts request  with any body
	UpsertProductsWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpsertProducts(ctx context.Context, body UpsertProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListProductStocks request
	ListProductStocks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SellFromInventory request  with any body
	SellFromInventoryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SellFromInventory(ctx context.Context, body SellFromInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

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) GetInventoryWithResponse

func (c *ClientWithResponses) GetInventoryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetInventoryResponse, error)

GetInventoryWithResponse request returning *GetInventoryResponse

func (*ClientWithResponses) ListProductStocksWithResponse

func (c *ClientWithResponses) ListProductStocksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProductStocksResponse, error)

ListProductStocksWithResponse request returning *ListProductStocksResponse

func (*ClientWithResponses) ListProductsWithResponse

func (c *ClientWithResponses) ListProductsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProductsResponse, error)

ListProductsWithResponse request returning *ListProductsResponse

func (*ClientWithResponses) SellFromInventoryWithBodyWithResponse

func (c *ClientWithResponses) SellFromInventoryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SellFromInventoryResponse, error)

SellFromInventoryWithBodyWithResponse request with arbitrary body returning *SellFromInventoryResponse

func (*ClientWithResponses) SellFromInventoryWithResponse

func (c *ClientWithResponses) SellFromInventoryWithResponse(ctx context.Context, body SellFromInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*SellFromInventoryResponse, error)

func (*ClientWithResponses) UpsertInventoryWithBodyWithResponse

func (c *ClientWithResponses) UpsertInventoryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertInventoryResponse, error)

UpsertInventoryWithBodyWithResponse request with arbitrary body returning *UpsertInventoryResponse

func (*ClientWithResponses) UpsertInventoryWithResponse

func (c *ClientWithResponses) UpsertInventoryWithResponse(ctx context.Context, body UpsertInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertInventoryResponse, error)

func (*ClientWithResponses) UpsertProductsWithBodyWithResponse

func (c *ClientWithResponses) UpsertProductsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertProductsResponse, error)

UpsertProductsWithBodyWithResponse request with arbitrary body returning *UpsertProductsResponse

func (*ClientWithResponses) UpsertProductsWithResponse

func (c *ClientWithResponses) UpsertProductsWithResponse(ctx context.Context, body UpsertProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertProductsResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetInventory request
	GetInventoryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetInventoryResponse, error)

	// UpsertInventory request  with any body
	UpsertInventoryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertInventoryResponse, error)

	UpsertInventoryWithResponse(ctx context.Context, body UpsertInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertInventoryResponse, error)

	// ListProducts request
	ListProductsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProductsResponse, error)

	// UpsertProducts request  with any body
	UpsertProductsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertProductsResponse, error)

	UpsertProductsWithResponse(ctx context.Context, body UpsertProductsJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertProductsResponse, error)

	// ListProductStocks request
	ListProductStocksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListProductStocksResponse, error)

	// SellFromInventory request  with any body
	SellFromInventoryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SellFromInventoryResponse, error)

	SellFromInventoryWithResponse(ctx context.Context, body SellFromInventoryJSONRequestBody, reqEditors ...RequestEditorFn) (*SellFromInventoryResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetInventoryResponse

type GetInventoryResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Inventory
	JSON400      *Message
}

func ParseGetInventoryResponse

func ParseGetInventoryResponse(rsp *http.Response) (*GetInventoryResponse, error)

ParseGetInventoryResponse parses an HTTP response from a GetInventoryWithResponse call

func (GetInventoryResponse) Status

func (r GetInventoryResponse) Status() string

Status returns HTTPResponse.Status

func (GetInventoryResponse) StatusCode

func (r GetInventoryResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Inventory

type Inventory struct {
	Inventory *[]Stock `json:"inventory,omitempty"`
}

Inventory defines model for Inventory.

type ListProductStocksResponse

type ListProductStocksResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ProductStocks
	JSON400      *Message
}

func ParseListProductStocksResponse

func ParseListProductStocksResponse(rsp *http.Response) (*ListProductStocksResponse, error)

ParseListProductStocksResponse parses an HTTP response from a ListProductStocksWithResponse call

func (ListProductStocksResponse) Status

func (r ListProductStocksResponse) Status() string

Status returns HTTPResponse.Status

func (ListProductStocksResponse) StatusCode

func (r ListProductStocksResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListProductsResponse

type ListProductsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Products
	JSON400      *Message
}

func ParseListProductsResponse

func ParseListProductsResponse(rsp *http.Response) (*ListProductsResponse, error)

ParseListProductsResponse parses an HTTP response from a ListProductsWithResponse call

func (ListProductsResponse) Status

func (r ListProductsResponse) Status() string

Status returns HTTPResponse.Status

func (ListProductsResponse) StatusCode

func (r ListProductsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Message

type Message struct {
	Message string `json:"message"`
}

Message defines model for Message.

type Order

type Order struct {
	Number      int    `json:"number"`
	ProductName string `json:"product_name"`
}

Order defines model for Order.

type Product

type Product struct {
	ContainArticles *[]Article `json:"contain_articles,omitempty"`
	Name            string     `json:"name"`
}

Product defines model for Product.

type ProductStock

type ProductStock struct {
	Product Product `json:"product"`
	Stock   int     `json:"stock"`
}

ProductStock defines model for ProductStock.

type ProductStocks

type ProductStocks struct {
	Products *[]ProductStock `json:"products,omitempty"`
}

ProductStocks defines model for ProductStocks.

type Products

type Products struct {
	Products *[]Product `json:"products,omitempty"`
}

Products defines model for Products.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type SellFromInventoryJSONBody

type SellFromInventoryJSONBody SellOrder

SellFromInventoryJSONBody defines parameters for SellFromInventory.

type SellFromInventoryJSONRequestBody

type SellFromInventoryJSONRequestBody SellFromInventoryJSONBody

SellFromInventoryJSONRequestBody defines body for SellFromInventory for application/json ContentType.

type SellFromInventoryResponse

type SellFromInventoryResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Message
	JSON400      *Message
}

func ParseSellFromInventoryResponse

func ParseSellFromInventoryResponse(rsp *http.Response) (*SellFromInventoryResponse, error)

ParseSellFromInventoryResponse parses an HTTP response from a SellFromInventoryWithResponse call

func (SellFromInventoryResponse) Status

func (r SellFromInventoryResponse) Status() string

Status returns HTTPResponse.Status

func (SellFromInventoryResponse) StatusCode

func (r SellFromInventoryResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SellOrder

type SellOrder struct {
	Orders []Order `json:"orders"`
}

SellOrder defines model for SellOrder.

type ServerInterface

type ServerInterface interface {
	// Get current inventory
	// (GET /inventory)
	GetInventory(ctx echo.Context) error
	// Inserts or Updates stocks in Inventory
	// (POST /inventory)
	UpsertInventory(ctx echo.Context) error
	// Lists products
	// (GET /products)
	ListProducts(ctx echo.Context) error
	// Insert or Update products
	// (POST /products)
	UpsertProducts(ctx echo.Context) error
	// Lists products with stock
	// (GET /productstock)
	ListProductStocks(ctx echo.Context) error
	// Sell specified products and update Inventory
	// (POST /sell)
	SellFromInventory(ctx echo.Context) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetInventory

func (w *ServerInterfaceWrapper) GetInventory(ctx echo.Context) error

GetInventory converts echo context to params.

func (*ServerInterfaceWrapper) ListProductStocks

func (w *ServerInterfaceWrapper) ListProductStocks(ctx echo.Context) error

ListProductStocks converts echo context to params.

func (*ServerInterfaceWrapper) ListProducts

func (w *ServerInterfaceWrapper) ListProducts(ctx echo.Context) error

ListProducts converts echo context to params.

func (*ServerInterfaceWrapper) SellFromInventory

func (w *ServerInterfaceWrapper) SellFromInventory(ctx echo.Context) error

SellFromInventory converts echo context to params.

func (*ServerInterfaceWrapper) UpsertInventory

func (w *ServerInterfaceWrapper) UpsertInventory(ctx echo.Context) error

UpsertInventory converts echo context to params.

func (*ServerInterfaceWrapper) UpsertProducts

func (w *ServerInterfaceWrapper) UpsertProducts(ctx echo.Context) error

UpsertProducts converts echo context to params.

type Stock

type Stock struct {
	ArtId string `json:"art_id"`
	Name  string `json:"name"`
	Stock string `json:"stock"`
}

Stock defines model for Stock.

type UpsertInventoryJSONBody

type UpsertInventoryJSONBody Inventory

UpsertInventoryJSONBody defines parameters for UpsertInventory.

type UpsertInventoryJSONRequestBody

type UpsertInventoryJSONRequestBody UpsertInventoryJSONBody

UpsertInventoryJSONRequestBody defines body for UpsertInventory for application/json ContentType.

type UpsertInventoryResponse

type UpsertInventoryResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Message
	JSON400      *Message
}

func ParseUpsertInventoryResponse

func ParseUpsertInventoryResponse(rsp *http.Response) (*UpsertInventoryResponse, error)

ParseUpsertInventoryResponse parses an HTTP response from a UpsertInventoryWithResponse call

func (UpsertInventoryResponse) Status

func (r UpsertInventoryResponse) Status() string

Status returns HTTPResponse.Status

func (UpsertInventoryResponse) StatusCode

func (r UpsertInventoryResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UpsertProductsJSONBody

type UpsertProductsJSONBody Products

UpsertProductsJSONBody defines parameters for UpsertProducts.

type UpsertProductsJSONRequestBody

type UpsertProductsJSONRequestBody UpsertProductsJSONBody

UpsertProductsJSONRequestBody defines body for UpsertProducts for application/json ContentType.

type UpsertProductsResponse

type UpsertProductsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Message
	JSON400      *Message
}

func ParseUpsertProductsResponse

func ParseUpsertProductsResponse(rsp *http.Response) (*UpsertProductsResponse, error)

ParseUpsertProductsResponse parses an HTTP response from a UpsertProductsWithResponse call

func (UpsertProductsResponse) Status

func (r UpsertProductsResponse) Status() string

Status returns HTTPResponse.Status

func (UpsertProductsResponse) StatusCode

func (r UpsertProductsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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