customersapi

package
v0.0.0-...-7934b4f Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

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

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

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

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

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

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

Index

Constants

View Source
const (
	Sigv4Scopes = "sigv4.Scopes"
)

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 NewCustomersRequest

func NewCustomersRequest(server string, params *CustomersParams) (*http.Request, error)

NewCustomersRequest generates requests for Customers

func NewGetCustomerRequest

func NewGetCustomerRequest(server string, id string) (*http.Request, error)

NewGetCustomerRequest generates requests for GetCustomer

func NewNewCustomerRequest

func NewNewCustomerRequest(server string, body NewCustomerJSONRequestBody) (*http.Request, error)

NewNewCustomerRequest calls the generic NewCustomer builder with application/json body

func NewNewCustomerRequestWithBody

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

NewNewCustomerRequestWithBody generates requests for NewCustomer with any type of body

func NewUpdateCustomerRequest

func NewUpdateCustomerRequest(server string, id string, body UpdateCustomerJSONRequestBody) (*http.Request, error)

NewUpdateCustomerRequest calls the generic UpdateCustomer builder with application/json body

func NewUpdateCustomerRequestWithBody

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

NewUpdateCustomerRequestWithBody generates requests for UpdateCustomer 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, m ...echo.MiddlewareFunc)

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

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

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

func (*Client) GetCustomer

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

func (*Client) NewCustomer

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

func (*Client) NewCustomerWithBody

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

func (*Client) UpdateCustomer

func (c *Client) UpdateCustomer(ctx context.Context, id string, body UpdateCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateCustomerWithBody

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

type ClientInterface

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

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

	NewCustomer(ctx context.Context, body NewCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetCustomer request
	GetCustomer(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	UpdateCustomer(ctx context.Context, id string, body UpdateCustomerJSONRequestBody, 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) CustomersWithResponse

func (c *ClientWithResponses) CustomersWithResponse(ctx context.Context, params *CustomersParams, reqEditors ...RequestEditorFn) (*CustomersResponse, error)

CustomersWithResponse request returning *CustomersResponse

func (*ClientWithResponses) GetCustomerWithResponse

func (c *ClientWithResponses) GetCustomerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetCustomerResponse, error)

GetCustomerWithResponse request returning *GetCustomerResponse

func (*ClientWithResponses) NewCustomerWithBodyWithResponse

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

NewCustomerWithBodyWithResponse request with arbitrary body returning *NewCustomerResponse

func (*ClientWithResponses) NewCustomerWithResponse

func (c *ClientWithResponses) NewCustomerWithResponse(ctx context.Context, body NewCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*NewCustomerResponse, error)

func (*ClientWithResponses) UpdateCustomerWithBodyWithResponse

func (c *ClientWithResponses) UpdateCustomerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateCustomerResponse, error)

UpdateCustomerWithBodyWithResponse request with arbitrary body returning *UpdateCustomerResponse

func (*ClientWithResponses) UpdateCustomerWithResponse

func (c *ClientWithResponses) UpdateCustomerWithResponse(ctx context.Context, id string, body UpdateCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateCustomerResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// Customers request
	CustomersWithResponse(ctx context.Context, params *CustomersParams, reqEditors ...RequestEditorFn) (*CustomersResponse, error)

	// NewCustomer request with any body
	NewCustomerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*NewCustomerResponse, error)

	NewCustomerWithResponse(ctx context.Context, body NewCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*NewCustomerResponse, error)

	// GetCustomer request
	GetCustomerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetCustomerResponse, error)

	// UpdateCustomer request with any body
	UpdateCustomerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateCustomerResponse, error)

	UpdateCustomerWithResponse(ctx context.Context, id string, body UpdateCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateCustomerResponse, error)
}

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

type Customer

type Customer struct {
	// The timestamp the customer was created
	CreatedAt time.Time `json:"created_at"`

	// A description of the customer, with some background.
	Description *string `json:"description,omitempty"`

	// Customer identifier.
	Id string `json:"id"`

	// Labels assigned to an entity.
	Labels []string `json:"labels"`

	// The name of the customer.
	Name string `json:"name"`

	// The timestamp the customer was last updated
	UpdatedAt time.Time `json:"updated_at"`
}

Customer response.

type CustomersPage

type CustomersPage struct {
	Customers []Customer `json:"customers"`
	NextToken *string    `json:"nextToken,omitempty"`
}

Customer page response.

type CustomersParams

type CustomersParams struct {
	NextToken *string `form:"nextToken,omitempty" json:"nextToken,omitempty"`
	MaxItems  *int    `form:"maxItems,omitempty" json:"maxItems,omitempty"`
}

CustomersParams defines parameters for Customers.

type CustomersResponse

type CustomersResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *CustomersPage
}

func ParseCustomersResponse

func ParseCustomersResponse(rsp *http.Response) (*CustomersResponse, error)

ParseCustomersResponse parses an HTTP response from a CustomersWithResponse call

func (CustomersResponse) Status

func (r CustomersResponse) Status() string

Status returns HTTPResponse.Status

func (CustomersResponse) StatusCode

func (r CustomersResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

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 GetCustomerResponse

type GetCustomerResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Customer
}

func ParseGetCustomerResponse

func ParseGetCustomerResponse(rsp *http.Response) (*GetCustomerResponse, error)

ParseGetCustomerResponse parses an HTTP response from a GetCustomerWithResponse call

func (GetCustomerResponse) Status

func (r GetCustomerResponse) Status() string

Status returns HTTPResponse.Status

func (GetCustomerResponse) StatusCode

func (r GetCustomerResponse) 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 NewCustomer

type NewCustomer struct {
	// A description of the customer, with some background.
	Description *string `json:"description,omitempty"`

	// Labels assigned to an entity.
	Labels []string `json:"labels"`

	// The name of the customer, this must be unique.
	Name string `json:"name"`
}

New Customer.

type NewCustomerJSONBody

type NewCustomerJSONBody = NewCustomer

NewCustomerJSONBody defines parameters for NewCustomer.

type NewCustomerJSONRequestBody

type NewCustomerJSONRequestBody = NewCustomerJSONBody

NewCustomerJSONRequestBody defines body for NewCustomer for application/json ContentType.

type NewCustomerResponse

type NewCustomerResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Customer
}

func ParseNewCustomerResponse

func ParseNewCustomerResponse(rsp *http.Response) (*NewCustomerResponse, error)

ParseNewCustomerResponse parses an HTTP response from a NewCustomerWithResponse call

func (NewCustomerResponse) Status

func (r NewCustomerResponse) Status() string

Status returns HTTPResponse.Status

func (NewCustomerResponse) StatusCode

func (r NewCustomerResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type ServerInterface

type ServerInterface interface {
	// Get a list of customers.
	// (GET /customers)
	Customers(ctx echo.Context, params CustomersParams) error
	// Create a customer.
	// (POST /customers)
	NewCustomer(ctx echo.Context) error

	// (GET /customers/{id})
	GetCustomer(ctx echo.Context, id string) error
	// Update a customer.
	// (PUT /customers/{id})
	UpdateCustomer(ctx echo.Context, id string) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) Customers

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

Customers converts echo context to params.

func (*ServerInterfaceWrapper) GetCustomer

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

GetCustomer converts echo context to params.

func (*ServerInterfaceWrapper) NewCustomer

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

NewCustomer converts echo context to params.

func (*ServerInterfaceWrapper) UpdateCustomer

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

UpdateCustomer converts echo context to params.

type UpdateCustomerJSONBody

type UpdateCustomerJSONBody = UpdatedCustomer

UpdateCustomerJSONBody defines parameters for UpdateCustomer.

type UpdateCustomerJSONRequestBody

type UpdateCustomerJSONRequestBody = UpdateCustomerJSONBody

UpdateCustomerJSONRequestBody defines body for UpdateCustomer for application/json ContentType.

type UpdateCustomerResponse

type UpdateCustomerResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Customer
}

func ParseUpdateCustomerResponse

func ParseUpdateCustomerResponse(rsp *http.Response) (*UpdateCustomerResponse, error)

ParseUpdateCustomerResponse parses an HTTP response from a UpdateCustomerWithResponse call

func (UpdateCustomerResponse) Status

func (r UpdateCustomerResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateCustomerResponse) StatusCode

func (r UpdateCustomerResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type UpdatedCustomer

type UpdatedCustomer struct {
	// A description of the customer, with some background.
	Description *string `json:"description,omitempty"`

	// Labels assigned to an entity.
	Labels []string `json:"labels"`

	// The name of the customer, this must be unique.
	Name    string `json:"name"`
	Version int64  `json:"version"`
}

UpdatedCustomer defines model for UpdatedCustomer.

Jump to

Keyboard shortcuts

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