Documentation
¶
Overview ¶
Package client talks to the PMOCK open API.
Every request is signed with the team AK/SK; responses use the unified envelope {traceId, code, msg, data, status}. Business failures are returned as *APIError so the command layer can render the envelope and choose an exit code without string matching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildURL ¶
BuildURL joins the configured base with a spec path. It accepts either https://host/api (spec paths kept) or the documented https://host/api/open/api (prefix stripped from the path).
func IsAuthError ¶
IsAuthError reports whether a business code means bad/disabled credentials.
Types ¶
type Client ¶
type Client struct {
BaseURL string
AccessKey string
SecretKey string
HTTP *http.Client
UserAgent string
MaxRetries int
// RetryNonIdempotent also retries POSTs on 5xx/network errors. Off by
// default because create/delete must not be duplicated.
RetryNonIdempotent bool
}
Client is safe for concurrent use.
type Envelope ¶
type Envelope struct {
TraceID string `json:"traceId"`
Code int `json:"code"`
Msg string `json:"msg"`
Data json.RawMessage `json:"data"`
Status string `json:"status"`
}
Envelope is the unified PMOCK API response.
Click to show internal directories.
Click to hide internal directories.