Documentation
¶
Overview ¶
Package httpclient implements the low-level HTTP communication for the DevBridge REST API.
It is only for the SDK root package (Go internal mechanism, not importable externally), and handles: request construction and auth headers, error status codes, business error parsing, and request/response logging.
Index ¶
- type APIError
- type Client
- func (c *Client) Delete(ctx context.Context, path string, result any) error
- func (c *Client) Do(ctx context.Context, method, path string, body, result any) error
- func (c *Client) Get(ctx context.Context, path string, result any) error
- func (c *Client) Post(ctx context.Context, path string, body, result any) error
- func (c *Client) Put(ctx context.Context, path string, body, result any) error
- type UpgradeRequiredError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Code string // error code, e.g. "HD.98320078"
Message string // error description
}
APIError represents a business error returned by the server.
type Client ¶
Client sends REST API requests.
func New ¶
New creates an HTTP client. When httpClient is nil a default client with a 30s timeout is created; otherwise the caller-provided client is used.
type UpgradeRequiredError ¶
type UpgradeRequiredError struct {
Message string
}
UpgradeRequiredError indicates the server rejected the request because the client version is below the server's minimum required version (HTTP 426).
func (*UpgradeRequiredError) Error ¶
func (e *UpgradeRequiredError) Error() string