openapi3

package
v0.0.0-...-1363f68 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

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

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

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFlushRequest

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

NewFlushRequest generates requests for Flush

func NewGetValueUsingKeyRequest

func NewGetValueUsingKeyRequest(server string, key string) (*http.Request, error)

NewGetValueUsingKeyRequest generates requests for GetValueUsingKey

func NewSaveDataRequest

func NewSaveDataRequest(server string, body SaveDataJSONRequestBody) (*http.Request, error)

NewSaveDataRequest calls the generic SaveData builder with application/json body

func NewSaveDataRequestWithBody

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

NewSaveDataRequestWithBody generates requests for SaveData with any type of body

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

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

func (*Client) GetValueUsingKey

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

func (*Client) SaveData

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

func (*Client) SaveDataWithBody

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

type ClientInterface

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

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

	SaveData(ctx context.Context, body SaveDataJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetValueUsingKey request
	GetValueUsingKey(ctx context.Context, key string, 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) FlushWithResponse

func (c *ClientWithResponses) FlushWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*FlushResponse, error)

FlushWithResponse request returning *FlushResponse

func (*ClientWithResponses) GetValueUsingKeyWithResponse

func (c *ClientWithResponses) GetValueUsingKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetValueUsingKeyResponse, error)

GetValueUsingKeyWithResponse request returning *GetValueUsingKeyResponse

func (*ClientWithResponses) SaveDataWithBodyWithResponse

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

SaveDataWithBodyWithResponse request with arbitrary body returning *SaveDataResponse

func (*ClientWithResponses) SaveDataWithResponse

func (c *ClientWithResponses) SaveDataWithResponse(ctx context.Context, body SaveDataJSONRequestBody, reqEditors ...RequestEditorFn) (*SaveDataResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// Flush request
	FlushWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*FlushResponse, error)

	// SaveData request with any body
	SaveDataWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SaveDataResponse, error)

	SaveDataWithResponse(ctx context.Context, body SaveDataJSONRequestBody, reqEditors ...RequestEditorFn) (*SaveDataResponse, error)

	// GetValueUsingKey request
	GetValueUsingKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetValueUsingKeyResponse, error)
}

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

type CreateStoreDataResponse

type CreateStoreDataResponse struct {
	Data *Data `json:"data,omitempty"`
}

CreateStoreDataResponse defines model for CreateStoreDataResponse.

type Data

type Data struct {
	Key   *string `json:"key,omitempty"`
	Value *string `json:"value,omitempty"`
}

Data defines model for Data.

type ErrorResponse

type ErrorResponse struct {
	Error *string `json:"error,omitempty"`
}

ErrorResponse defines model for ErrorResponse.

type FlushResponse

type FlushResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *struct {
		Data *Data `json:"data,omitempty"`
	}
	JSON400 *struct {
		Error *string `json:"error,omitempty"`
	}
	JSON500 *struct {
		Error *string `json:"error,omitempty"`
	}
}

func ParseFlushResponse

func ParseFlushResponse(rsp *http.Response) (*FlushResponse, error)

ParseFlushResponse parses an HTTP response from a FlushWithResponse call

func (FlushResponse) Status

func (r FlushResponse) Status() string

Status returns HTTPResponse.Status

func (FlushResponse) StatusCode

func (r FlushResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetValueUsingKeyResponse

type GetValueUsingKeyResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *struct {
		Data *Data `json:"data,omitempty"`
	}
	JSON400 *struct {
		Error *string `json:"error,omitempty"`
	}
	JSON500 *struct {
		Error *string `json:"error,omitempty"`
	}
}

func ParseGetValueUsingKeyResponse

func ParseGetValueUsingKeyResponse(rsp *http.Response) (*GetValueUsingKeyResponse, error)

ParseGetValueUsingKeyResponse parses an HTTP response from a GetValueUsingKeyWithResponse call

func (GetValueUsingKeyResponse) Status

func (r GetValueUsingKeyResponse) Status() string

Status returns HTTPResponse.Status

func (GetValueUsingKeyResponse) StatusCode

func (r GetValueUsingKeyResponse) 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 RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type SaveDataJSONRequestBody

type SaveDataJSONRequestBody SaveStoreDataRequest

SaveDataJSONRequestBody defines body for SaveData for application/json ContentType.

type SaveDataResponse

type SaveDataResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *struct {
		Data *Data `json:"data,omitempty"`
	}
	JSON400 *struct {
		Error *string `json:"error,omitempty"`
	}
	JSON500 *struct {
		Error *string `json:"error,omitempty"`
	}
}

func ParseSaveDataResponse

func ParseSaveDataResponse(rsp *http.Response) (*SaveDataResponse, error)

ParseSaveDataResponse parses an HTTP response from a SaveDataWithResponse call

func (SaveDataResponse) Status

func (r SaveDataResponse) Status() string

Status returns HTTPResponse.Status

func (SaveDataResponse) StatusCode

func (r SaveDataResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SaveStoreDataRequest

type SaveStoreDataRequest struct {
	Key   *string `json:"key,omitempty"`
	Value *string `json:"value,omitempty"`
}

SaveStoreDataRequest defines model for SaveStoreDataRequest.

Jump to

Keyboard shortcuts

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