NewClient returns a new GitHub API client configured with the provided options. The default configuration is suitable for making unauthenticated requests to the public GitHub API. For GitHub Enterprise, use [WithEnterpriseURLs] to set the base and upload URLs. To make authenticated requests, use [
(opts ...ClientOptionsFunc)
| 545 | // [WithTimeout] or by providing a custom [http.Client] with an appropriate |
| 546 | // timeout using [WithHTTPClient]. |
| 547 | func NewClient(opts ...ClientOptionsFunc) (*Client, error) { |
| 548 | o := clientOptions{} |
| 549 | for _, opt := range opts { |
| 550 | if err := opt(&o); err != nil { |
| 551 | return nil, err |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | return newClient(o) |
| 556 | } |
| 557 | |
| 558 | // newClient creates a new Client with the provided options. This is an internal |
| 559 | // helper function that is called by [NewClient] and [Client.Clone]. |
searching dependent graphs…