client

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

Install Codegen

go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.12.4 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 NewGetSpecRequest

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

NewGetSpecRequest generates requests for GetSpec

func NewPostCompleteNameRequest

func NewPostCompleteNameRequest(server string, name string, body PostCompleteNameJSONRequestBody) (*http.Request, error)

NewPostCompleteNameRequest calls the generic PostCompleteName builder with application/json body

func NewPostCompleteNameRequestWithBody

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

NewPostCompleteNameRequestWithBody generates requests for PostCompleteName with any type of body

func NewPostInitRequest

func NewPostInitRequest(server string, body PostInitJSONRequestBody) (*http.Request, error)

NewPostInitRequest calls the generic PostInit builder with application/json body

func NewPostInitRequestWithBody

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

NewPostInitRequestWithBody generates requests for PostInit with any type of body

func NewPostStagesNameRequest

func NewPostStagesNameRequest(server string, name string, body PostStagesNameJSONRequestBody) (*http.Request, error)

NewPostStagesNameRequest calls the generic PostStagesName builder with application/json body

func NewPostStagesNameRequestWithBody

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

NewPostStagesNameRequestWithBody generates requests for PostStagesName 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 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) GetSpec

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

func (*Client) PostCompleteName

func (c *Client) PostCompleteName(ctx context.Context, name string, body PostCompleteNameJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostCompleteNameWithBody

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

func (*Client) PostInit

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

func (*Client) PostInitWithBody

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

func (*Client) PostStagesName

func (c *Client) PostStagesName(ctx context.Context, name string, body PostStagesNameJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) PostStagesNameWithBody

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

type ClientInterface

type ClientInterface interface {
	// PostCompleteName request with any body
	PostCompleteNameWithBody(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	PostCompleteName(ctx context.Context, name string, body PostCompleteNameJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

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

	PostInit(ctx context.Context, body PostInitJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

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

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

	PostStagesName(ctx context.Context, name string, body PostStagesNameJSONRequestBody, 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) GetSpecWithResponse

func (c *ClientWithResponses) GetSpecWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetSpecResponse, error)

GetSpecWithResponse request returning *GetSpecResponse

func (*ClientWithResponses) PostCompleteNameWithBodyWithResponse

func (c *ClientWithResponses) PostCompleteNameWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostCompleteNameResponse, error)

PostCompleteNameWithBodyWithResponse request with arbitrary body returning *PostCompleteNameResponse

func (*ClientWithResponses) PostCompleteNameWithResponse

func (c *ClientWithResponses) PostCompleteNameWithResponse(ctx context.Context, name string, body PostCompleteNameJSONRequestBody, reqEditors ...RequestEditorFn) (*PostCompleteNameResponse, error)

func (*ClientWithResponses) PostInitWithBodyWithResponse

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

PostInitWithBodyWithResponse request with arbitrary body returning *PostInitResponse

func (*ClientWithResponses) PostInitWithResponse

func (c *ClientWithResponses) PostInitWithResponse(ctx context.Context, body PostInitJSONRequestBody, reqEditors ...RequestEditorFn) (*PostInitResponse, error)

func (*ClientWithResponses) PostStagesNameWithBodyWithResponse

func (c *ClientWithResponses) PostStagesNameWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStagesNameResponse, error)

PostStagesNameWithBodyWithResponse request with arbitrary body returning *PostStagesNameResponse

func (*ClientWithResponses) PostStagesNameWithResponse

func (c *ClientWithResponses) PostStagesNameWithResponse(ctx context.Context, name string, body PostStagesNameJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStagesNameResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// PostCompleteName request with any body
	PostCompleteNameWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostCompleteNameResponse, error)

	PostCompleteNameWithResponse(ctx context.Context, name string, body PostCompleteNameJSONRequestBody, reqEditors ...RequestEditorFn) (*PostCompleteNameResponse, error)

	// PostInit request with any body
	PostInitWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostInitResponse, error)

	PostInitWithResponse(ctx context.Context, body PostInitJSONRequestBody, reqEditors ...RequestEditorFn) (*PostInitResponse, error)

	// GetSpec request
	GetSpecWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetSpecResponse, error)

	// PostStagesName request with any body
	PostStagesNameWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostStagesNameResponse, error)

	PostStagesNameWithResponse(ctx context.Context, name string, body PostStagesNameJSONRequestBody, reqEditors ...RequestEditorFn) (*PostStagesNameResponse, error)
}

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

type CompleteStage

type CompleteStage struct {
	Inputs []string          `json:"inputs"`
	Name   string            `json:"name"`
	Type   CompleteStageType `json:"type"`
}

CompleteStage defines model for completeStage.

type CompleteStageResponse

type CompleteStageResponse struct {
	Logs    *[]Log   `json:"logs,omitempty"`
	Outputs []Output `json:"outputs"`
}

CompleteStageResponse defines model for completeStageResponse.

type CompleteStageType

type CompleteStageType string

CompleteStageType defines model for CompleteStage.Type.

const (
	Complete CompleteStageType = "complete"
)

Defines values for CompleteStageType.

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 Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error defines model for error.

type ErrorStage

type ErrorStage struct {
	Code     string                  `json:"code"`
	Message  string                  `json:"message"`
	Metadata *map[string]interface{} `json:"metadata,omitempty"`
	Retry    *RetryStrategy          `json:"retry,omitempty"`
}

ErrorStage defines model for errorStage.

type GetSpecResponse

type GetSpecResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Spec
	JSON500      *Error
}

func ParseGetSpecResponse

func ParseGetSpecResponse(rsp *http.Response) (*GetSpecResponse, error)

ParseGetSpecResponse parses an HTTP response from a GetSpecWithResponse call

func (GetSpecResponse) Status

func (r GetSpecResponse) Status() string

Status returns HTTPResponse.Status

func (GetSpecResponse) StatusCode

func (r GetSpecResponse) 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 Input

type Input struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

Input defines model for input.

type Log

type Log struct {
	Level   LogLevel `json:"level"`
	Message string   `json:"message"`
}

Log defines model for log.

type LogLevel

type LogLevel string

LogLevel defines model for Log.Level.

const (
	LogLevelDebug LogLevel = "debug"
	LogLevelError LogLevel = "error"
	LogLevelInfo  LogLevel = "info"
)

Defines values for LogLevel.

type Output

type Output struct {
	Mimetype OutputMimetype `json:"mimetype"`
	Name     string         `json:"name"`

	// Value Any type of value
	Value interface{} `json:"value"`
}

Output defines model for output.

type OutputMimetype

type OutputMimetype string

OutputMimetype defines model for Output.Mimetype.

const (
	Applicationjson        OutputMimetype = "application/json"
	ApplicationoctetStream OutputMimetype = "application/octet-stream"
	Applicationtext        OutputMimetype = "application/text"
)

Defines values for OutputMimetype.

type PostCompleteNameJSONRequestBody

type PostCompleteNameJSONRequestBody = StageRequest

PostCompleteNameJSONRequestBody defines body for PostCompleteName for application/json ContentType.

type PostCompleteNameResponse

type PostCompleteNameResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *CompleteStageResponse
	JSON500      *ErrorStage
}

func ParsePostCompleteNameResponse

func ParsePostCompleteNameResponse(rsp *http.Response) (*PostCompleteNameResponse, error)

ParsePostCompleteNameResponse parses an HTTP response from a PostCompleteNameWithResponse call

func (PostCompleteNameResponse) Status

func (r PostCompleteNameResponse) Status() string

Status returns HTTPResponse.Status

func (PostCompleteNameResponse) StatusCode

func (r PostCompleteNameResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostInitJSONBody

type PostInitJSONBody struct {
	// Config Full user defined config to configure spark on initialise
	Config *string `json:"config,omitempty"`
}

PostInitJSONBody defines parameters for PostInit.

type PostInitJSONRequestBody

type PostInitJSONRequestBody PostInitJSONBody

PostInitJSONRequestBody defines body for PostInit for application/json ContentType.

type PostInitResponse

type PostInitResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON500      *Error
}

func ParsePostInitResponse

func ParsePostInitResponse(rsp *http.Response) (*PostInitResponse, error)

ParsePostInitResponse parses an HTTP response from a PostInitWithResponse call

func (PostInitResponse) Status

func (r PostInitResponse) Status() string

Status returns HTTPResponse.Status

func (PostInitResponse) StatusCode

func (r PostInitResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PostStagesNameJSONRequestBody

type PostStagesNameJSONRequestBody = StageRequest

PostStagesNameJSONRequestBody defines body for PostStagesName for application/json ContentType.

type PostStagesNameResponse

type PostStagesNameResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *StageResponse
	JSON500      *ErrorStage
}

func ParsePostStagesNameResponse

func ParsePostStagesNameResponse(rsp *http.Response) (*PostStagesNameResponse, error)

ParsePostStagesNameResponse parses an HTTP response from a PostStagesNameWithResponse call

func (PostStagesNameResponse) Status

func (r PostStagesNameResponse) Status() string

Status returns HTTPResponse.Status

func (PostStagesNameResponse) StatusCode

func (r PostStagesNameResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type PreviousStageResult

type PreviousStageResult struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

PreviousStageResult defines model for previousStageResult.

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type RetryStrategy

type RetryStrategy struct {
	// BackoffMultiplier Backoff Multiplier to increment after each failure attempt
	BackoffMultiplier int `json:"backoffMultiplier"`

	// FirstBackoffWait First time to backoff wait in milliseconds
	FirstBackoffWait int `json:"firstBackoffWait"`
	Times            int `json:"times"`
}

RetryStrategy defines model for retryStrategy.

type ServerInterface

type ServerInterface interface {

	// (POST /complete/{name})
	PostCompleteName(ctx echo.Context, name string) error

	// (POST /init)
	PostInit(ctx echo.Context) error

	// (GET /spec)
	GetSpec(ctx echo.Context) error

	// (POST /stages/{name})
	PostStagesName(ctx echo.Context, name string) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetSpec

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

GetSpec converts echo context to params.

func (*ServerInterfaceWrapper) PostCompleteName

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

PostCompleteName converts echo context to params.

func (*ServerInterfaceWrapper) PostInit

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

PostInit converts echo context to params.

func (*ServerInterfaceWrapper) PostStagesName

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

PostStagesName converts echo context to params.

type Spec

type Spec struct {
	Complete CompleteStage `json:"complete"`
	Stages   []Stage       `json:"stages"`
}

Spec defines model for spec.

type Stage

type Stage struct {
	Inputs []string  `json:"inputs"`
	Name   string    `json:"name"`
	Type   StageType `json:"type"`
}

Stage defines model for stage.

type StageRequest

type StageRequest struct {
	CorrelationID  string                `json:"correlationID"`
	Inputs         *[]Input              `json:"inputs,omitempty"`
	JobKey         string                `json:"jobKey"`
	PreviousStages []PreviousStageResult `json:"previousStages"`
	TransactionID  string                `json:"transactionID"`
}

StageRequest defines model for stageRequest.

type StageResponse

type StageResponse struct {
	Logs  *[]Log      `json:"logs,omitempty"`
	Value interface{} `json:"value"`
}

StageResponse defines model for stageResponse.

type StageType

type StageType string

StageType defines model for Stage.Type.

const (
	StageTypeStage StageType = "stage"
)

Defines values for StageType.

Jump to

Keyboard shortcuts

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