inspectclient

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.1.0 DO NOT EDIT.

This package contains auxiliary functions generated with genqlient to query the Rollups GraphQL API

Index

Constants

This section is empty.

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

func NewInspectRequest(server string, payload string) (*http.Request, error)

NewInspectRequest generates requests for Inspect

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

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

func (*Client) InspectPostWithBody

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

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

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

type Error = string

Error Detailed error message.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

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

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

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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