MCPcopy Index your code
hub / github.com/coder/coder / newGitLab

Function newGitLab

coderd/externalauth/gitprovider/gitlab.go:28–52  ·  view source on GitHub ↗
(baseURL string, httpClient *http.Client, clock quartz.Clock)

Source from the content-addressed store, hash-verified

26}
27
28func newGitLab(baseURL string, httpClient *http.Client, clock quartz.Clock) (*gitlabProvider, error) {
29 if baseURL == "" {
30 baseURL = "https://gitlab.com"
31 }
32 baseURL = strings.TrimRight(baseURL, "/")
33 baseURL = strings.TrimSuffix(baseURL, "/api/v4")
34 if httpClient == nil {
35 httpClient = http.DefaultClient
36 }
37
38 client, err := gitlab.NewClient("",
39 gitlab.WithBaseURL(baseURL),
40 gitlab.WithHTTPClient(httpClient),
41 gitlab.WithoutRetries(),
42 )
43 if err != nil {
44 return nil, xerrors.Errorf("create gitlab client: %w", err)
45 }
46
47 return &gitlabProvider{
48 webBaseURL: baseURL,
49 client: client,
50 clock: clock,
51 }, nil
52}
53
54var _ Provider = (*gitlabProvider)(nil)
55

Callers 1

NewFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected