Documentation
¶
Index ¶
- Constants
- func APIEndpoint(hostname, protocol, apiHost, subfolder string) string
- func ExtractSubfolder(input string) (string, string)
- func GraphQLEndpoint(hostname, protocol, apiHost, subfolder string) string
- func HostnameValidator(v any) error
- func IsSelfHosted(h string) bool
- func NormalizeHostname(h string) string
- func StripHostProtocol(h string) (string, string)
Constants ¶
const ( DefaultHostname = "gitlab.com" DefaultProtocol = "https" DefaultClientID = "41d48f9422ebd655dd9cf2947d6979681dfaddc6d0c56f7628f6ada59559af1e" )
Variables ¶
This section is empty.
Functions ¶
func APIEndpoint ¶
APIEndpoint returns the REST API endpoint prefix for a GitLab instance.
Parameters:
hostname: Base hostname (e.g., "example.com") protocol: "http" or "https" apiHost: (Deprecated) Alternate API hostname, may contain path for backward compat subfolder: Subfolder path (e.g., "gitlab" for https://example.com/gitlab/)
Precedence: subfolder parameter > path in apiHost > none
func ExtractSubfolder ¶ added in v1.87.0
ExtractSubfolder splits a hostname string into hostname and optional subfolder. Trims slashes from the subfolder result. Example: "example.com/gitlab/" → ("example.com", "gitlab")
func GraphQLEndpoint ¶
GraphQLEndpoint returns the GraphQL API endpoint prefix for a GitLab instance. Parameters match APIEndpoint for consistency.
func HostnameValidator ¶
func IsSelfHosted ¶
IsSelfHosted reports whether a non-normalized host name looks like a GitLab Self-Managed instance staging.gitlab.com is considered self-managed
func NormalizeHostname ¶
NormalizeHostname returns the canonical host name of a GitLab instance Note: GitLab does not allow subdomains on gitlab.com https://gitlab.com/gitlab-org/gitlab/-/issues/26703
func StripHostProtocol ¶
StripHostProtocol strips the url protocol and returns the hostname and the protocol
Types ¶
This section is empty.