NewClient creates a new instance of the raw API Client with the provided GitHub client and provided URL.
(client *gogithub.Client, rawURL *url.URL)
| 20 | |
| 21 | // NewClient creates a new instance of the raw API Client with the provided GitHub client and provided URL. |
| 22 | func 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 | |
| 33 | func (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...) |