MCPcopy Index your code
hub / github.com/google/go-github / WithEnterpriseURLs

Function WithEnterpriseURLs

github/github.go:470–501  ·  view source on GitHub ↗

WithEnterpriseURLs returns a ClientOptionsFunc that sets the base and upload URLs for a Client.

(baseURL, uploadURL string)

Source from the content-addressed store, hash-verified

468// WithEnterpriseURLs returns a ClientOptionsFunc that sets the base and upload
469// URLs for a Client.
470func WithEnterpriseURLs(baseURL, uploadURL string) ClientOptionsFunc {
471 return func(o *clientOptions) error {
472 b, err := parseURL(baseURL)
473 if err != nil {
474 return fmt.Errorf("invalid base url: %w", err)
475 }
476
477 if !strings.HasSuffix(b.Path, "/api/v3/") &&
478 !strings.HasPrefix(b.Host, "api.") &&
479 !strings.Contains(b.Host, ".api.") {
480 b.Path += "api/v3/"
481 }
482
483 o.baseURL = b
484
485 u, err := parseURL(uploadURL)
486 if err != nil {
487 return fmt.Errorf("invalid upload url: %w", err)
488 }
489
490 if !strings.HasSuffix(u.Path, "/api/uploads/") &&
491 !strings.HasPrefix(u.Host, "api.") &&
492 !strings.Contains(u.Host, ".api.") &&
493 !strings.HasPrefix(u.Host, "uploads.") {
494 u.Path += "api/uploads/"
495 }
496
497 o.uploadURL = u
498
499 return nil
500 }
501}
502
503// WithDisableRateLimitCheck returns a ClientOptionsFunc that disables rate
504// limit checking for a Client. If not set, the client will check for rate

Callers 4

newClientFunction · 0.92
mainFunction · 0.92
githubClientFunction · 0.92
TestWithEnterpriseURLsFunction · 0.85

Calls 1

parseURLFunction · 0.85

Tested by 1

TestWithEnterpriseURLsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…