Versions in this module Expand all Collapse all v0 v0.1.2 Jul 29, 2026 v0.1.1 Jul 29, 2026 v0.1.0 Jul 29, 2026 Changes in this version + const DefaultUserAgent + func Bool[T ~bool](v T) *T + func EncodeArgs(v any) (url.Values, error) + func Float[T ~float32 | ~float64](v T) *T + func Int[T ~int | ~int64](v T) *T + func String[T ~string](v T) *T + type API2Event struct + Result int + type API2Inner struct + Data json.RawMessage + Error string + Event API2Event + Extra map[string]json.RawMessage + Func string + Module string + PostEvent API2Event + PreEvent API2Event + func (r *API2Inner) UnmarshalJSON(b []byte) error + type API2Result struct + APIVersion int + Error string + Func string + Module string + Result API2Inner + func (r *API2Result) DecodeData(v any) error + func (r *API2Result) OK() bool + type Args map[string]string + func CombineArgs(list ...Args) Args + func (a Args) Clone() Args + func (a Args) Set(key, value string) Args + type Authenticator interface + Authenticate func(req *http.Request) + func AccessHashAuth(user, accessHash string) Authenticator + func BasicAuth(user, password string) Authenticator + func CPanelTokenAuth(user, token string) Authenticator + func WHMTokenAuth(user, token string) Authenticator + type AuthenticatorFunc func(req *http.Request) + func (f AuthenticatorFunc) Authenticate(req *http.Request) + type Client struct + func NewClient(rawBaseURL string, auth Authenticator, opts ...Option) (*Client, error) + func (c *Client) API2(ctx context.Context, user, module, function string, args Args) (*API2Result, error) + func (c *Client) BaseURL() *url.URL + func (c *Client) WHMAPI2(ctx context.Context, user, module, function string, args Args) (*API2Result, error) + type Error struct + Body string + Errors []string + Op string + Reason string + StatusCode int + Warnings []string + func (e *Error) Error() string + type LooseString string + func (s *LooseString) UnmarshalJSON(b []byte) error + func (s LooseString) MarshalJSON() ([]byte, error) + func (s LooseString) String() string + type Option func(*Client) + func WithHTTPClient(hc *http.Client) Option + func WithHeader(key, value string) Option + func WithInsecureSkipVerify(skip bool) Option + func WithTimeout(d time.Duration) Option + func WithUserAgent(ua string) Option + type UAPIResult struct + APIVersion int + Data T + Errors []LooseString + Func string + Messages []LooseString + Metadata map[string]json.RawMessage + Module string + Raw json.RawMessage + Status int + Warnings []LooseString + func UAPICall[T any](ctx context.Context, c *Client, method, module, function string, args any) (*UAPIResult[T], error) + func UAPI[T any](ctx context.Context, c *Client, module, function string, args any) (*UAPIResult[T], error) + func (r *UAPIResult[T]) DecodeData(v any) error + func (r *UAPIResult[T]) ErrorStrings() []string + func (r *UAPIResult[T]) MessageStrings() []string + func (r *UAPIResult[T]) OK() bool + func (r *UAPIResult[T]) WarningStrings() []string + type WHMMetadata struct + Command string + Errors []LooseString + Extra map[string]json.RawMessage + Messages []LooseString + Output *WHMOutput + Reason string + Result int + Version int + Warnings []LooseString + func (m *WHMMetadata) UnmarshalJSON(b []byte) error + type WHMOutput struct + Errors []LooseString + Messages []LooseString + Warnings []LooseString + type WHMResult struct + Data T + Metadata WHMMetadata + Raw json.RawMessage + func WHMCall[T any](ctx context.Context, c *Client, method, function string, args any) (*WHMResult[T], error) + func WHM[T any](ctx context.Context, c *Client, function string, args any) (*WHMResult[T], error) + func (r *WHMResult[T]) DecodeData(v any) error + func (r *WHMResult[T]) OK() bool