Documentation ¶
Overview ¶
Package inspect provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.
This package contains the bindings for the inspect OpenAPI spec.
Index ¶
- Constants
- func NewInspectPostRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewInspectRequest(server string, payload string) (*http.Request, error)
- func Register(e *echo.Echo, model *model.NonodoModel)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- type Client
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- type ClientWithResponsesInterface
- type CompletionStatus
- type EchoRouter
- type Error
- type HttpRequestDoer
- type InspectPostResponse
- type InspectResponse
- type InspectResult
- type Payload
- type Report
- type RequestEditorFn
- type ServerInterface
- type ServerInterfaceWrapper
Constants ¶
const InspectPollInterval = time.Millisecond * 100
const InspectRetries = 50
Variables ¶
This section is empty.
Functions ¶
func NewInspectPostRequestWithBody ¶
func NewInspectPostRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewInspectPostRequestWithBody generates requests for InspectPost with any type of body
func NewInspectRequest ¶
NewInspectRequest generates requests for Inspect
func Register ¶
func Register(e *echo.Echo, model *model.NonodoModel)
Register the rollup API to echo
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
type ClientInterface ¶
type ClientInterface interface { // InspectPostWithBody request with any body InspectPostWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) // Inspect request Inspect(ctx context.Context, payload 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) InspectPostWithBodyWithResponse ¶
func (c *ClientWithResponses) InspectPostWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InspectPostResponse, error)
InspectPostWithBodyWithResponse request with arbitrary body returning *InspectPostResponse
func (*ClientWithResponses) InspectWithResponse ¶
func (c *ClientWithResponses) InspectWithResponse(ctx context.Context, payload string, reqEditors ...RequestEditorFn) (*InspectResponse, error)
InspectWithResponse request returning *InspectResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface { // InspectPostWithBodyWithResponse request with any body InspectPostWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*InspectPostResponse, error) // InspectWithResponse request InspectWithResponse(ctx context.Context, payload string, reqEditors ...RequestEditorFn) (*InspectResponse, error) }
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CompletionStatus ¶
type CompletionStatus string
CompletionStatus Whether inspection completed or not (and why not)
const ( Accepted CompletionStatus = "Accepted" CycleLimitExceeded CompletionStatus = "CycleLimitExceeded" Exception CompletionStatus = "Exception" MachineHalted CompletionStatus = "MachineHalted" Rejected CompletionStatus = "Rejected" TimeLimitExceeded CompletionStatus = "TimeLimitExceeded" )
Defines values for CompletionStatus.
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 HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type InspectPostResponse ¶
type InspectPostResponse struct { Body []byte HTTPResponse *http.Response JSON200 *InspectResult }
func ParseInspectPostResponse ¶
func ParseInspectPostResponse(rsp *http.Response) (*InspectPostResponse, error)
ParseInspectPostResponse parses an HTTP response from a InspectPostWithResponse call
func (InspectPostResponse) Status ¶
func (r InspectPostResponse) Status() string
Status returns HTTPResponse.Status
func (InspectPostResponse) StatusCode ¶
func (r InspectPostResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type InspectResponse ¶
type InspectResponse struct { Body []byte HTTPResponse *http.Response JSON200 *InspectResult }
func ParseInspectResponse ¶
func ParseInspectResponse(rsp *http.Response) (*InspectResponse, error)
ParseInspectResponse parses an HTTP response from a InspectWithResponse call
func (InspectResponse) Status ¶
func (r InspectResponse) Status() string
Status returns HTTPResponse.Status
func (InspectResponse) StatusCode ¶
func (r InspectResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type InspectResult ¶
type InspectResult struct { // ExceptionPayload Payload in the Ethereum hex binary format. // The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte. // For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175. // An empty payload is represented by the string '0x'. ExceptionPayload Payload `json:"exception_payload"` // ProcessedInputCount Number of processed inputs since genesis ProcessedInputCount int `json:"processed_input_count"` Reports []Report `json:"reports"` // Status Whether inspection completed or not (and why not) Status CompletionStatus `json:"status"` }
InspectResult defines model for InspectResult.
type Payload ¶
type Payload = string
Payload Payload in the Ethereum hex binary format. The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte. For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175. An empty payload is represented by the string '0x'.
type Report ¶
type Report struct { // Payload Payload in the Ethereum hex binary format. // The first two characters are '0x' followed by pairs of hexadecimal numbers that correspond to one byte. // For instance, '0xdeadbeef' corresponds to a payload with length 4 and bytes 222, 173, 190, 175. // An empty payload is represented by the string '0x'. Payload Payload `json:"payload"` }
Report defines model for Report.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type ServerInterface ¶
type ServerInterface interface { // Inspect DApp state via POST // (POST inspect) InspectPost(ctx echo.Context) error // Inspect DApp state via GET // (GET inspect/{payload}) Inspect(ctx echo.Context, payload string) error }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) Inspect ¶
func (w *ServerInterfaceWrapper) Inspect(ctx echo.Context) error
Inspect converts echo context to params.
func (*ServerInterfaceWrapper) InspectPost ¶
func (w *ServerInterfaceWrapper) InspectPost(ctx echo.Context) error
InspectPost converts echo context to params.