Documentation ¶
Overview ¶
Package v1 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Index ¶
- func NewGetPeerDiagnosticsRequest(server string) (*http.Request, error)
- func NewGetTransactionPayloadRequest(server string, ref string) (*http.Request, error)
- func NewGetTransactionRequest(server string, ref string) (*http.Request, error)
- func NewListTransactionsRequest(server string) (*http.Request, error)
- func NewRenderGraphRequest(server string) (*http.Request, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type Client
- func (c *Client) GetPeerDiagnostics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetTransaction(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) GetTransactionPayload(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ListTransactions(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) RenderGraph(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetPeerDiagnosticsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPeerDiagnosticsResponse, error)
- func (c *ClientWithResponses) GetTransactionPayloadWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionPayloadResponse, error)
- func (c *ClientWithResponses) GetTransactionWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionResponse, error)
- func (c *ClientWithResponses) ListTransactionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListTransactionsResponse, error)
- func (c *ClientWithResponses) RenderGraphWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*RenderGraphResponse, error)
- type ClientWithResponsesInterface
- type EchoRouter
- type ErrorStatusCodeResolver
- type GetPeerDiagnosticsResponse
- type GetTransactionPayloadResponse
- type GetTransactionResponse
- type HTTPClient
- func (hb HTTPClient) GetPeerDiagnostics() (map[transport.PeerID]PeerDiagnostics, error)
- func (hb HTTPClient) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
- func (hb HTTPClient) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
- func (hb HTTPClient) ListTransactions() ([]dag.Transaction, error)
- type HttpRequestDoer
- type ListTransactionsResponse
- type PeerDiagnostics
- type Preprocessor
- type RenderGraphResponse
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
- func (w *ServerInterfaceWrapper) GetPeerDiagnostics(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetTransaction(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) GetTransactionPayload(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) ListTransactions(ctx echo.Context) error
- func (w *ServerInterfaceWrapper) RenderGraph(ctx echo.Context) error
- type Wrapper
- func (a Wrapper) GetPeerDiagnostics(ctx echo.Context) error
- func (a Wrapper) GetTransaction(ctx echo.Context, hashAsString string) error
- func (a Wrapper) GetTransactionPayload(ctx echo.Context, hashAsString string) error
- func (a Wrapper) ListTransactions(ctx echo.Context) error
- func (a *Wrapper) Preprocess(operationID string, context echo.Context)
- func (a Wrapper) RenderGraph(ctx echo.Context) error
- func (a *Wrapper) Routes(router core.EchoRouter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetPeerDiagnosticsRequest ¶
NewGetPeerDiagnosticsRequest generates requests for GetPeerDiagnostics
func NewGetTransactionPayloadRequest ¶
NewGetTransactionPayloadRequest generates requests for GetTransactionPayload
func NewGetTransactionRequest ¶
NewGetTransactionRequest generates requests for GetTransaction
func NewListTransactionsRequest ¶
NewListTransactionsRequest generates requests for ListTransactions
func NewRenderGraphRequest ¶
NewRenderGraphRequest generates requests for RenderGraph
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) GetPeerDiagnostics ¶
func (*Client) GetTransaction ¶
func (*Client) GetTransactionPayload ¶
func (*Client) ListTransactions ¶
func (*Client) RenderGraph ¶
type ClientInterface ¶
type ClientInterface interface { // RenderGraph request RenderGraph(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // GetPeerDiagnostics request GetPeerDiagnostics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // ListTransactions request ListTransactions(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // GetTransaction request GetTransaction(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) // GetTransactionPayload request GetTransactionPayload(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) }
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) GetPeerDiagnosticsWithResponse ¶
func (c *ClientWithResponses) GetPeerDiagnosticsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPeerDiagnosticsResponse, error)
GetPeerDiagnosticsWithResponse request returning *GetPeerDiagnosticsResponse
func (*ClientWithResponses) GetTransactionPayloadWithResponse ¶
func (c *ClientWithResponses) GetTransactionPayloadWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionPayloadResponse, error)
GetTransactionPayloadWithResponse request returning *GetTransactionPayloadResponse
func (*ClientWithResponses) GetTransactionWithResponse ¶
func (c *ClientWithResponses) GetTransactionWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionResponse, error)
GetTransactionWithResponse request returning *GetTransactionResponse
func (*ClientWithResponses) ListTransactionsWithResponse ¶
func (c *ClientWithResponses) ListTransactionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListTransactionsResponse, error)
ListTransactionsWithResponse request returning *ListTransactionsResponse
func (*ClientWithResponses) RenderGraphWithResponse ¶
func (c *ClientWithResponses) RenderGraphWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*RenderGraphResponse, error)
RenderGraphWithResponse request returning *RenderGraphResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // RenderGraph request RenderGraphWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*RenderGraphResponse, error) // GetPeerDiagnostics request GetPeerDiagnosticsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetPeerDiagnosticsResponse, error) // ListTransactions request ListTransactionsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListTransactionsResponse, error) // GetTransaction request GetTransactionWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionResponse, error) // GetTransactionPayload request GetTransactionPayloadWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*GetTransactionPayloadResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type EchoRouter ¶
type EchoRouter interface {
Add(method string, 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 ErrorStatusCodeResolver ¶
type GetPeerDiagnosticsResponse ¶
type GetPeerDiagnosticsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { AdditionalProperties map[string]PeerDiagnostics `json:"-"` } }
func ParseGetPeerDiagnosticsResponse ¶
func ParseGetPeerDiagnosticsResponse(rsp *http.Response) (*GetPeerDiagnosticsResponse, error)
ParseGetPeerDiagnosticsResponse parses an HTTP response from a GetPeerDiagnosticsWithResponse call
func (GetPeerDiagnosticsResponse) Status ¶
func (r GetPeerDiagnosticsResponse) Status() string
Status returns HTTPResponse.Status
func (GetPeerDiagnosticsResponse) StatusCode ¶
func (r GetPeerDiagnosticsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetTransactionPayloadResponse ¶
func ParseGetTransactionPayloadResponse ¶
func ParseGetTransactionPayloadResponse(rsp *http.Response) (*GetTransactionPayloadResponse, error)
ParseGetTransactionPayloadResponse parses an HTTP response from a GetTransactionPayloadWithResponse call
func (GetTransactionPayloadResponse) Status ¶
func (r GetTransactionPayloadResponse) Status() string
Status returns HTTPResponse.Status
func (GetTransactionPayloadResponse) StatusCode ¶
func (r GetTransactionPayloadResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type GetTransactionResponse ¶
func ParseGetTransactionResponse ¶
func ParseGetTransactionResponse(rsp *http.Response) (*GetTransactionResponse, error)
ParseGetTransactionResponse parses an HTTP response from a GetTransactionWithResponse call
func (GetTransactionResponse) Status ¶
func (r GetTransactionResponse) Status() string
Status returns HTTPResponse.Status
func (GetTransactionResponse) StatusCode ¶
func (r GetTransactionResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HTTPClient ¶
HTTPClient holds the server address and other basic settings for the http client
func (HTTPClient) GetPeerDiagnostics ¶
func (hb HTTPClient) GetPeerDiagnostics() (map[transport.PeerID]PeerDiagnostics, error)
GetPeerDiagnostics retrieves diagnostic information on the node's peers.
func (HTTPClient) GetTransaction ¶
func (hb HTTPClient) GetTransaction(transactionRef hash.SHA256Hash) (dag.Transaction, error)
GetTransaction retrieves the transaction for the given reference. If the transaction is not known, an error is returned.
func (HTTPClient) GetTransactionPayload ¶
func (hb HTTPClient) GetTransactionPayload(transactionRef hash.SHA256Hash) ([]byte, error)
GetTransactionPayload retrieves the transaction payload for the given transaction. If the transaction or payload is not found nil is returned.
func (HTTPClient) ListTransactions ¶
func (hb HTTPClient) ListTransactions() ([]dag.Transaction, error)
ListTransactions returns all transactions known to this network instance.
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type ListTransactionsResponse ¶
func ParseListTransactionsResponse ¶
func ParseListTransactionsResponse(rsp *http.Response) (*ListTransactionsResponse, error)
ParseListTransactionsResponse parses an HTTP response from a ListTransactionsWithResponse call
func (ListTransactionsResponse) Status ¶
func (r ListTransactionsResponse) Status() string
Status returns HTTPResponse.Status
func (ListTransactionsResponse) StatusCode ¶
func (r ListTransactionsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type PeerDiagnostics ¶
type PeerDiagnostics transport.Diagnostics
PeerDiagnostics defines the type for diagnostics of a peer
func (PeerDiagnostics) MarshalJSON ¶
func (p PeerDiagnostics) MarshalJSON() ([]byte, error)
MarshalJSON is the custom JSON marshaler for PeerDiagnostics
func (*PeerDiagnostics) UnmarshalJSON ¶
func (p *PeerDiagnostics) UnmarshalJSON(bytes []byte) error
UnmarshalJSON is the custom JSON unmarshaler for PeerDiagnostics
type Preprocessor ¶
type Preprocessor interface {
Preprocess(operationID string, context echo.Context)
}
type RenderGraphResponse ¶
func ParseRenderGraphResponse ¶
func ParseRenderGraphResponse(rsp *http.Response) (*RenderGraphResponse, error)
ParseRenderGraphResponse parses an HTTP response from a RenderGraphWithResponse call
func (RenderGraphResponse) Status ¶
func (r RenderGraphResponse) Status() string
Status returns HTTPResponse.Status
func (RenderGraphResponse) StatusCode ¶
func (r RenderGraphResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Visualizes the DAG as a graph // (GET /internal/network/v1/diagnostics/graph) RenderGraph(ctx echo.Context) error // Gets diagnostic information about the node's peers // (GET /internal/network/v1/diagnostics/peers) GetPeerDiagnostics(ctx echo.Context) error // Lists the transactions on the DAG // (GET /internal/network/v1/transaction) ListTransactions(ctx echo.Context) error // Retrieves a transaction // (GET /internal/network/v1/transaction/{ref}) GetTransaction(ctx echo.Context, ref string) error // Gets the transaction payload // (GET /internal/network/v1/transaction/{ref}/payload) GetTransactionPayload(ctx echo.Context, ref string) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) GetPeerDiagnostics ¶
func (w *ServerInterfaceWrapper) GetPeerDiagnostics(ctx echo.Context) error
GetPeerDiagnostics converts echo context to params.
func (*ServerInterfaceWrapper) GetTransaction ¶
func (w *ServerInterfaceWrapper) GetTransaction(ctx echo.Context) error
GetTransaction converts echo context to params.
func (*ServerInterfaceWrapper) GetTransactionPayload ¶
func (w *ServerInterfaceWrapper) GetTransactionPayload(ctx echo.Context) error
GetTransactionPayload converts echo context to params.
func (*ServerInterfaceWrapper) ListTransactions ¶
func (w *ServerInterfaceWrapper) ListTransactions(ctx echo.Context) error
ListTransactions converts echo context to params.
func (*ServerInterfaceWrapper) RenderGraph ¶
func (w *ServerInterfaceWrapper) RenderGraph(ctx echo.Context) error
RenderGraph converts echo context to params.
type Wrapper ¶
type Wrapper struct {
Service network.Transactions
}
Wrapper implements the ServerInterface for the network API.
func (Wrapper) GetPeerDiagnostics ¶
GetPeerDiagnostics returns the diagnostics of the node's peers
func (Wrapper) GetTransaction ¶
GetTransaction returns a specific transaction
func (Wrapper) GetTransactionPayload ¶
GetTransactionPayload returns the payload of a specific transaction
func (Wrapper) ListTransactions ¶
ListTransactions lists all transactions
func (*Wrapper) Preprocess ¶
Preprocess is called just before the API operation itself is invoked.
func (Wrapper) RenderGraph ¶
RenderGraph visualizes the DAG as Graphviz/dot graph
func (*Wrapper) Routes ¶
func (a *Wrapper) Routes(router core.EchoRouter)