Documentation
¶
Overview ¶
Package gitlab provides an HTTP client for the GitLab internal API. It is the replacement for the client and gitlabnet packages and is being introduced incrementally as part of the consolidation described in https://gitlab.com/gitlab-org/gitlab-shell/-/issues/834.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseJSON ¶
ParseJSON decodes a successful (< 400) HTTP response body into dst, or returns a *client.APIError describing the failure. The error semantics deliberately match those of the old client package so that sub-clients migrated to this package do not need to change their error handling:
- 4xx/5xx with a JSON {"message":"…"} body → *client.APIError{Msg: message}
- 4xx/5xx with no decodable message → *client.APIError{Msg: "Internal API error (N)"}
- 2xx with non-JSON body → errors.New("parsing failed")
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the GitLab internal API.
type Config ¶
type Config struct {
// GitlabURL is the base URL of the GitLab instance.
GitlabURL string
// RelativeURLRoot is an optional relative URL root prefix (for Unix socket URLs).
RelativeURLRoot string
// User is the HTTP basic auth username.
User string
// Password is the HTTP basic auth password.
Password string
// Secret is the HS256 JWT signing secret. Must not be empty.
Secret string
// CaFile is the path to a custom CA certificate file.
CaFile string
// CaPath is the path to a directory of custom CA certificate files.
CaPath string
// ReadTimeoutSeconds is the HTTP read timeout. Defaults to 300s when zero.
ReadTimeoutSeconds uint64
}
Config holds the configuration for the GitLab internal API client.