productwebclient

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package productwebclient provides primitives to interact the openapi HTTP API.

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

Package productwebclient provides primitives to interact 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 NewCreateProductRequest

func NewCreateProductRequest(server string, body CreateProductJSONRequestBody) (*http.Request, error)

NewCreateProductRequest calls the generic CreateProduct builder with application/json body

func NewCreateProductRequestWithBody

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

NewCreateProductRequestWithBody generates requests for CreateProduct with any type of body

func NewGetAllProductsRequest added in v1.6.0

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

NewGetAllProductsRequest generates requests for GetAllProducts

func NewGetProductByIdRequest

func NewGetProductByIdRequest(server string, productId ProductIdParameter) (*http.Request, error)

NewGetProductByIdRequest generates requests for GetProductById

Types

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

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

func (*Client) CreateProductWithBody

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

func (*Client) GetAllProducts added in v1.6.0

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

func (*Client) GetProductById

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

type ClientInterface

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

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

	CreateProduct(ctx context.Context, body CreateProductJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetProductById request
	GetProductById(ctx context.Context, productId ProductIdParameter, 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) CreateProductWithBodyWithResponse

func (c *ClientWithResponses) CreateProductWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateProductResponse, error)

CreateProductWithBodyWithResponse request with arbitrary body returning *CreateProductResponse

func (*ClientWithResponses) CreateProductWithResponse

func (c *ClientWithResponses) CreateProductWithResponse(ctx context.Context, body CreateProductJSONRequestBody) (*CreateProductResponse, error)

func (*ClientWithResponses) GetAllProductsWithResponse added in v1.6.0

func (c *ClientWithResponses) GetAllProductsWithResponse(ctx context.Context) (*GetAllProductsResponse, error)

GetAllProductsWithResponse request returning *GetAllProductsResponse

func (*ClientWithResponses) GetProductByIdWithResponse

func (c *ClientWithResponses) GetProductByIdWithResponse(ctx context.Context, productId ProductIdParameter) (*GetProductByIdResponse, error)

GetProductByIdWithResponse request returning *GetProductByIdResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetAllProducts request
	GetAllProductsWithResponse(ctx context.Context) (*GetAllProductsResponse, error)

	// CreateProduct request  with any body
	CreateProductWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateProductResponse, error)

	CreateProductWithResponse(ctx context.Context, body CreateProductJSONRequestBody) (*CreateProductResponse, error)

	// GetProductById request
	GetProductByIdWithResponse(ctx context.Context, productId ProductIdParameter) (*GetProductByIdResponse, error)
}

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

type CreateProductJSONBody

type CreateProductJSONBody Product

CreateProductJSONBody defines parameters for CreateProduct.

type CreateProductJSONRequestBody

type CreateProductJSONRequestBody CreateProductJSONBody

CreateProductJSONRequestBody defines body for CreateProduct for application/json ContentType.

type CreateProductResponse

type CreateProductResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *ProductCreated
}

func ParseCreateProductResponse

func ParseCreateProductResponse(rsp *http.Response) (*CreateProductResponse, error)

ParseCreateProductResponse parses an HTTP response from a CreateProductWithResponse call

func (CreateProductResponse) Status

func (r CreateProductResponse) Status() string

Status returns HTTPResponse.Status

func (CreateProductResponse) StatusCode

func (r CreateProductResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetAllProductsResponse added in v1.6.0

type GetAllProductsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]Product
}

func ParseGetAllProductsResponse added in v1.6.0

func ParseGetAllProductsResponse(rsp *http.Response) (*GetAllProductsResponse, error)

ParseGetAllProductsResponse parses an HTTP response from a GetAllProductsWithResponse call

func (GetAllProductsResponse) Status added in v1.6.0

func (r GetAllProductsResponse) Status() string

Status returns HTTPResponse.Status

func (GetAllProductsResponse) StatusCode added in v1.6.0

func (r GetAllProductsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetAllProductsSuccessResponse added in v1.6.0

type GetAllProductsSuccessResponse []Product

GetAllProductsSuccessResponse defines model for GetAllProductsSuccessResponse.

type GetProductByIdResponse

type GetProductByIdResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Product
}

func ParseGetProductByIdResponse

func ParseGetProductByIdResponse(rsp *http.Response) (*GetProductByIdResponse, error)

ParseGetProductByIdResponse parses an HTTP response from a GetProductByIdWithResponse call

func (GetProductByIdResponse) Status

func (r GetProductByIdResponse) Status() string

Status returns HTTPResponse.Status

func (GetProductByIdResponse) StatusCode

func (r GetProductByIdResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetProductByIdSuccessResponse

type GetProductByIdSuccessResponse Product

GetProductByIdSuccessResponse defines model for GetProductByIdSuccessResponse.

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Product

type Product struct {
	CategoryRef *string    `json:"categoryRef,omitempty"`
	Id          *string    `json:"id,omitempty"`
	Name        *string    `json:"name,omitempty"`
	Variants    *[]Variant `json:"variants,omitempty"`
}

Product defines model for Product.

type ProductCreated

type ProductCreated struct {
	Id *string `json:"id,omitempty"`
}

ProductCreated defines model for ProductCreated.

type ProductCreationSuccessResponse

type ProductCreationSuccessResponse ProductCreated

ProductCreationSuccessResponse defines model for ProductCreationSuccessResponse.

type ProductIdParameter

type ProductIdParameter string

ProductIdParameter defines model for ProductIdParameter.

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type Variant

type Variant struct {
	Code  *string  `json:"code,omitempty"`
	Id    *string  `json:"id,omitempty"`
	Name  *string  `json:"name,omitempty"`
	Price *float32 `json:"price,omitempty"`
}

Variant defines model for Variant.

Jump to

Keyboard shortcuts

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