httpclient

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Messages   []string          `json:"errorMessages"`
	Errors     map[string]string `json:"errors"`
}

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

func NewFromConfig

func NewFromConfig(baseURL, email, token string) *Client

NewFromConfig creates a client, choosing Basic auth (Cloud) when email is set, or Bearer auth (Server/DC) otherwise.

func (*Client) BaseURL

func (c *Client) BaseURL() string

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, query url.Values, reqBody any, result any) error

Do performs an HTTP request, checks the status, and decodes JSON into result.

func (*Client) Get

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

Get performs a GET request and returns the raw response.

Jump to

Keyboard shortcuts

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