api

package
v0.0.0-...-430ebb6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode[T any](r io.Reader) (*T, error)

func DecodeList

func DecodeList[T any](r io.Reader) ([]T, error)

func DecodeMap

func DecodeMap[R comparable, T any](r io.Reader) (map[R]T, error)

func LoadCerts

func LoadCerts(path string) (*x509.CertPool, error)

func NewHTTPClient

func NewHTTPClient() *http.Client

func NewLoggingRoundTripper

func NewLoggingRoundTripper(roundTripper http.RoundTripper) http.RoundTripper

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type Client

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

func New

func New(options []ClientOption) (*Client, error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, api string) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, query url.Values) (*http.Response, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, payload any) (*http.Response, error)

type ClientOption

type ClientOption = func(*Client) error

func WithBaseAuth

func WithBaseAuth(auth BasicAuth) ClientOption

func WithBaseURL

func WithBaseURL(url string) ClientOption

func WithCertificate

func WithCertificate(path string) ClientOption

func WithLogging

func WithLogging() ClientOption

func WithSkipTLS

func WithSkipTLS() ClientOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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