nonce

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package nonce 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 (
	BearerAuthScopes = "bearerAuth.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 NewGetNonceRequest

func NewGetNonceRequest(server string, chainId uint64, address Address) (*http.Request, error)

NewGetNonceRequest generates requests for GetNonce

func NewGetNonceWithSignerRequest

func NewGetNonceWithSignerRequest(server string, chainId uint64, address Address, params *GetNonceWithSignerParams) (*http.Request, error)

NewGetNonceWithSignerRequest generates requests for GetNonceWithSigner

func NewReturnNonceRequest

func NewReturnNonceRequest(server string, chainId uint64, address Address, nonce uint64) (*http.Request, error)

NewReturnNonceRequest generates requests for ReturnNonce

func NewReturnNonceWithSignerRequest

func NewReturnNonceWithSignerRequest(server string, chainId uint64, address Address, nonce uint64, params *ReturnNonceWithSignerParams) (*http.Request, error)

NewReturnNonceWithSignerRequest generates requests for ReturnNonceWithSigner

func NewSyncNonceRequest

func NewSyncNonceRequest(server string, chainId uint64, address Address) (*http.Request, error)

NewSyncNonceRequest generates requests for SyncNonce

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 Address

type Address = string

Address defines model for Address.

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

func (c *Client) GetNonce(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetNonceWithSigner

func (c *Client) GetNonceWithSigner(ctx context.Context, chainId uint64, address Address, params *GetNonceWithSignerParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ReturnNonce

func (c *Client) ReturnNonce(ctx context.Context, chainId uint64, address Address, nonce uint64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ReturnNonceWithSigner

func (c *Client) ReturnNonceWithSigner(ctx context.Context, chainId uint64, address Address, nonce uint64, params *ReturnNonceWithSignerParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SyncNonce

func (c *Client) SyncNonce(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetNonce request
	GetNonce(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetNonceWithSigner request
	GetNonceWithSigner(ctx context.Context, chainId uint64, address Address, params *GetNonceWithSignerParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SyncNonce request
	SyncNonce(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ReturnNonce request
	ReturnNonce(ctx context.Context, chainId uint64, address Address, nonce uint64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ReturnNonceWithSigner request
	ReturnNonceWithSigner(ctx context.Context, chainId uint64, address Address, nonce uint64, params *ReturnNonceWithSignerParams, 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) GetNonceWithResponse

func (c *ClientWithResponses) GetNonceWithResponse(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

GetNonceWithResponse request returning *GetNonceResponse

func (*ClientWithResponses) GetNonceWithSignerWithResponse

func (c *ClientWithResponses) GetNonceWithSignerWithResponse(ctx context.Context, chainId uint64, address Address, params *GetNonceWithSignerParams, reqEditors ...RequestEditorFn) (*GetNonceWithSignerResponse, error)

GetNonceWithSignerWithResponse request returning *GetNonceWithSignerResponse

func (*ClientWithResponses) ReturnNonceWithResponse

func (c *ClientWithResponses) ReturnNonceWithResponse(ctx context.Context, chainId uint64, address Address, nonce uint64, reqEditors ...RequestEditorFn) (*ReturnNonceResponse, error)

ReturnNonceWithResponse request returning *ReturnNonceResponse

func (*ClientWithResponses) ReturnNonceWithSignerWithResponse

func (c *ClientWithResponses) ReturnNonceWithSignerWithResponse(ctx context.Context, chainId uint64, address Address, nonce uint64, params *ReturnNonceWithSignerParams, reqEditors ...RequestEditorFn) (*ReturnNonceWithSignerResponse, error)

ReturnNonceWithSignerWithResponse request returning *ReturnNonceWithSignerResponse

func (*ClientWithResponses) SyncNonceWithResponse

func (c *ClientWithResponses) SyncNonceWithResponse(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*SyncNonceResponse, error)

SyncNonceWithResponse request returning *SyncNonceResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetNonce request
	GetNonceWithResponse(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*GetNonceResponse, error)

	// GetNonceWithSigner request
	GetNonceWithSignerWithResponse(ctx context.Context, chainId uint64, address Address, params *GetNonceWithSignerParams, reqEditors ...RequestEditorFn) (*GetNonceWithSignerResponse, error)

	// SyncNonce request
	SyncNonceWithResponse(ctx context.Context, chainId uint64, address Address, reqEditors ...RequestEditorFn) (*SyncNonceResponse, error)

	// ReturnNonce request
	ReturnNonceWithResponse(ctx context.Context, chainId uint64, address Address, nonce uint64, reqEditors ...RequestEditorFn) (*ReturnNonceResponse, error)

	// ReturnNonceWithSigner request
	ReturnNonceWithSignerWithResponse(ctx context.Context, chainId uint64, address Address, nonce uint64, params *ReturnNonceWithSignerParams, reqEditors ...RequestEditorFn) (*ReturnNonceWithSignerResponse, error)
}

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

type ClientWithSigner

type ClientWithSigner struct {
	// contains filtered or unexported fields
}

func NewNonceClientWithSigner

func NewNonceClientWithSigner(server string, insecureSkipVerify bool) (*ClientWithSigner, error)

func (*ClientWithSigner) GetNonceWithSigner

func (c *ClientWithSigner) GetNonceWithSigner(chainId uint64, address string, apiKey string) (uint64, func() error, error)

func (*ClientWithSigner) ReturnNonce

func (c *ClientWithSigner) ReturnNonce(chainId uint64, address string, apiKey string, nonce uint64) error

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 GetNonceResponse

type GetNonceResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *NonceResponse
}

func ParseGetNonceResponse

func ParseGetNonceResponse(rsp *http.Response) (*GetNonceResponse, error)

ParseGetNonceResponse parses an HTTP response from a GetNonceWithResponse call

func (GetNonceResponse) Status

func (r GetNonceResponse) Status() string

Status returns HTTPResponse.Status

func (GetNonceResponse) StatusCode

func (r GetNonceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetNonceWithSignerParams

type GetNonceWithSignerParams struct {
	XNONCEAUTHHASH      XNonceAuthHash      `json:"X-NONCE-AUTH-HASH"`
	XNONCEAUTHSIGNATURE XNonceAuthSignature `json:"X-NONCE-AUTH-SIGNATURE"`
	XNONCEAUTHSIGNER    XNonceAuthSigner    `json:"X-NONCE-AUTH-SIGNER"`
}

GetNonceWithSignerParams defines parameters for GetNonceWithSigner.

type GetNonceWithSignerResponse

type GetNonceWithSignerResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *NonceResponse
}

func ParseGetNonceWithSignerResponse

func ParseGetNonceWithSignerResponse(rsp *http.Response) (*GetNonceWithSignerResponse, error)

ParseGetNonceWithSignerResponse parses an HTTP response from a GetNonceWithSignerWithResponse call

func (GetNonceWithSignerResponse) Status

Status returns HTTPResponse.Status

func (GetNonceWithSignerResponse) StatusCode

func (r GetNonceWithSignerResponse) 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 NonceClient

type NonceClient struct {
	// contains filtered or unexported fields
}

func NewNonceClient

func NewNonceClient(server string, config *tlsconfig.TLSCertConfig, apiKey string) (*NonceClient, error)

func (*NonceClient) GetNonce

func (c *NonceClient) GetNonce(chainId uint64, address string) (uint64, func() error, error)

func (*NonceClient) ReturnNonce

func (c *NonceClient) ReturnNonce(chainId uint64, address string, nonce uint64) error

type NonceResponse

type NonceResponse struct {
	Address *Address `json:"address,omitempty"`
	ChainId *uint64  `json:"chainId,omitempty"`
	Nonce   *uint64  `json:"nonce,omitempty"`
}

NonceResponse defines model for NonceResponse.

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type ReturnNonceResponse

type ReturnNonceResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseReturnNonceResponse

func ParseReturnNonceResponse(rsp *http.Response) (*ReturnNonceResponse, error)

ParseReturnNonceResponse parses an HTTP response from a ReturnNonceWithResponse call

func (ReturnNonceResponse) Status

func (r ReturnNonceResponse) Status() string

Status returns HTTPResponse.Status

func (ReturnNonceResponse) StatusCode

func (r ReturnNonceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ReturnNonceWithSignerParams

type ReturnNonceWithSignerParams struct {
	XNONCEAUTHHASH      XNonceAuthHash      `json:"X-NONCE-AUTH-HASH"`
	XNONCEAUTHSIGNATURE XNonceAuthSignature `json:"X-NONCE-AUTH-SIGNATURE"`
	XNONCEAUTHSIGNER    XNonceAuthSigner    `json:"X-NONCE-AUTH-SIGNER"`
}

ReturnNonceWithSignerParams defines parameters for ReturnNonceWithSigner.

type ReturnNonceWithSignerResponse

type ReturnNonceWithSignerResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseReturnNonceWithSignerResponse

func ParseReturnNonceWithSignerResponse(rsp *http.Response) (*ReturnNonceWithSignerResponse, error)

ParseReturnNonceWithSignerResponse parses an HTTP response from a ReturnNonceWithSignerWithResponse call

func (ReturnNonceWithSignerResponse) Status

Status returns HTTPResponse.Status

func (ReturnNonceWithSignerResponse) StatusCode

func (r ReturnNonceWithSignerResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ServerInterface

type ServerInterface interface {
	// Retrieves the next available nonce
	// (POST /nonce/{chainId}/{address})
	GetNonce(ctx echo.Context, chainId uint64, address Address) error
	// Retrieves the next available nonce
	// (POST /nonce/{chainId}/{address}/signed)
	GetNonceWithSigner(ctx echo.Context, chainId uint64, address Address, params GetNonceWithSignerParams) error
	// Synchronize nonce with blockchain
	// (POST /nonce/{chainId}/{address}/sync)
	SyncNonce(ctx echo.Context, chainId uint64, address Address) error
	// Returns unused nonce
	// (PUT /nonce/{chainId}/{address}/{nonce})
	ReturnNonce(ctx echo.Context, chainId uint64, address Address, nonce uint64) error
	// Returns unused nonce
	// (PUT /nonce/{chainId}/{address}/{nonce}/signed)
	ReturnNonceWithSigner(ctx echo.Context, chainId uint64, address Address, nonce uint64, params ReturnNonceWithSignerParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetNonce

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

GetNonce converts echo context to params.

func (*ServerInterfaceWrapper) GetNonceWithSigner

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

GetNonceWithSigner converts echo context to params.

func (*ServerInterfaceWrapper) ReturnNonce

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

ReturnNonce converts echo context to params.

func (*ServerInterfaceWrapper) ReturnNonceWithSigner

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

ReturnNonceWithSigner converts echo context to params.

func (*ServerInterfaceWrapper) SyncNonce

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

SyncNonce converts echo context to params.

type SyncNonceResponse

type SyncNonceResponse struct {
	Body         []byte
	HTTPResponse *http.Response
}

func ParseSyncNonceResponse

func ParseSyncNonceResponse(rsp *http.Response) (*SyncNonceResponse, error)

ParseSyncNonceResponse parses an HTTP response from a SyncNonceWithResponse call

func (SyncNonceResponse) Status

func (r SyncNonceResponse) Status() string

Status returns HTTPResponse.Status

func (SyncNonceResponse) StatusCode

func (r SyncNonceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type XNonceAuthHash

type XNonceAuthHash = string

XNonceAuthHash defines model for XNonceAuthHash.

type XNonceAuthSignature

type XNonceAuthSignature = string

XNonceAuthSignature defines model for XNonceAuthSignature.

type XNonceAuthSigner

type XNonceAuthSigner = Address

XNonceAuthSigner defines model for XNonceAuthSigner.

Jump to

Keyboard shortcuts

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