api

package
v0.0.0-...-994b71c Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBadStatusCodeError

func NewBadStatusCodeError(body []byte, resp *http.Response, expectedStatusCode int, operationID string) error

func NewHTTPError

func NewHTTPError(body []byte, resp *http.Response, message string, wrapped error) error

Types

type Client

type Client struct {
	Endpoint       *url.URL
	Client         HttpRequestDoer
	RequestEditors []RequestEditorFn
}

func NewClient

func NewClient(endpoint string, opts ...ClientOption) (*Client, error)

func NewClientWithURL

func NewClientWithURL(endpoint *url.URL, opts ...ClientOption) (*Client, error)

func (*Client) MiscHealth

func (c *Client) MiscHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*MiscHealthResponse, error)

func (*Client) MiscVersion

func (c *Client) MiscVersion(ctx context.Context, reqEditors ...RequestEditorFn) (*MiscVersionResponse, error)

type ClientInterface

type ClientInterface interface {
	MiscVersion(context.Context) (*MiscVersionResponse, error)
	MiscHealth(context.Context) (*MiscHealthResponse, error)
}

type ClientOption

type ClientOption func(*Client) error

func WithHTTPClient

func WithHTTPClient(client HttpRequestDoer) ClientOption

func WithRequestEditor

func WithRequestEditor(editor RequestEditorFn) ClientOption

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

type HTTPRequestError

type HTTPRequestError struct {
	Body         []byte
	HTTPResponse *http.Response
	Message      string
	Wrapped      error
}

func (*HTTPRequestError) Error

func (e *HTTPRequestError) Error() string

func (*HTTPRequestError) Unwrap

func (e *HTTPRequestError) Unwrap() error

type HttpRequestDoer

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

type MiscHealthResponse

type MiscHealthResponse struct {
	Status string `json:"status"`
}

type MiscVersionResponse

type MiscVersionResponse struct {
	Go       string    `json:"go"`
	Modified bool      `json:"modified"`
	Platform string    `json:"platform"`
	Revision string    `json:"revision,omitempty"`
	Time     time.Time `json:"time,omitzero"`
}

type RequestEditorFn

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

Jump to

Keyboard shortcuts

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