MCPcopy
hub / github.com/github/github-mcp-server / NewClient

Function NewClient

pkg/raw/raw.go:22–31  ·  view source on GitHub ↗

NewClient creates a new instance of the raw API Client with the provided GitHub client and provided URL.

(client *gogithub.Client, rawURL *url.URL)

Source from the content-addressed store, hash-verified

20
21// NewClient creates a new instance of the raw API Client with the provided GitHub client and provided URL.
22func NewClient(client *gogithub.Client, rawURL *url.URL) (*Client, error) {
23 newClient, err := gogithub.NewClient(
24 gogithub.WithHTTPClient(client.Client()),
25 gogithub.WithEnterpriseURLs(rawURL.String(), rawURL.String()),
26 )
27 if err != nil {
28 return nil, err
29 }
30 return &Client{client: newClient, url: rawURL}, nil
31}
32
33func (c *Client) newRequest(ctx context.Context, method string, urlStr string, body any, opts ...gogithub.RequestOption) (*http.Request, error) {
34 return c.client.NewRequest(ctx, method, urlStr, body, opts...)

Callers 7

GetRawClientMethod · 0.92
Test_GetFileContentsFunction · 0.92
createGitHubClientsFunction · 0.92
TestGetRawContentFunction · 0.85
TestUrlFromOptsFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by 5

Test_GetFileContentsFunction · 0.74
TestGetRawContentFunction · 0.68
TestUrlFromOptsFunction · 0.68