func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) {
	baseEndpoint, err := url.Parse(baseURL)
	if err != nil {
		return nil, err
	}
	if !strings.HasSuffix(baseEndpoint.Path, "/") {
		baseEndpoint.Path += "/"
	}
	if !strings.HasSuffix(baseEndpoint.Path, "/api/v3/") {
		baseEndpoint.Path += "api/v3/"
	}
	uploadEndpoint, err := url.Parse(uploadURL)
	if err != nil {
		return nil, err
	}
	if !strings.HasSuffix(uploadEndpoint.Path, "/") {
		uploadEndpoint.Path += "/"
	}
	if !strings.HasSuffix(uploadEndpoint.Path, "/api/v3/") {
		uploadEndpoint.Path += "api/v3/"
	}
	c := NewClient(httpClient)
	c.BaseURL = baseEndpoint
	c.UploadURL = uploadEndpoint
	return c, nil
}
NewEnterpriseClient returns a new GitHub API client with provided
base URL and upload URL (often the same URL and is your GitHub Enterprise hostname).
If either URL does not have the suffix "/api/v3/", it will be added automatically.
If a nil httpClient is provided, a new http.Client will be used.

Note that NewEnterpriseClient is a convenience helper only;
its behavior is equivalent to using NewClient, followed by setting
the BaseURL and UploadURL fields.

Another important thing is that by default, the GitHub Enterprise URL format
should be http(s)://[hostname]/api/v3 or you will always receive the 406 status code.
package github
import (
	"bytes"
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"reflect"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/google/go-querystring/query"
)
const (
	defaultBaseURL = "https://api.github.com/"
	uploadBaseURL  = "https://uploads.github.com/"
	userAgent      = "go-github"
	headerRateLimit     = "X-RateLimit-Limit"
	headerRateRemaining = "X-RateLimit-Remaining"
	headerRateReset     = "X-RateLimit-Reset"
	headerOTP           = "X-GitHub-OTP"
	mediaTypeV3                = "application/vnd.github.v3+json"
	defaultMediaType           = "application/octet-stream"
	mediaTypeV3SHA             = "application/vnd.github.v3.sha"
	mediaTypeV3Diff            = "application/vnd.github.v3.diff"
	mediaTypeV3Patch           = "application/vnd.github.v3.patch"
	mediaTypeOrgPermissionRepo = "application/vnd.github.v3.repository+json"
	mediaTypeRevokeTokenPreview = "application/vnd.github.gambit-preview+json"
	mediaTypeStarringPreview = "application/vnd.github.v3.star+json"
	mediaTypeMigrationsPreview = "application/vnd.github.wyandotte-preview+json"
	mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json"
	mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json"
	mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
	mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
	mediaTypeProjectsPreview = "application/vnd.github.inertia-preview+json"
	mediaTypeIntegrationPreview = "application/vnd.github.machine-man-preview+json"
	mediaTypeCommitSearchPreview = "application/vnd.github.cloak-preview+json"
	mediaTypeBlockUsersPreview = "application/vnd.github.giant-sentry-fist-preview+json"
	mediaTypeRepositoryCommunityHealthMetricsPreview = "application/vnd.github.black-panther-preview+json"
	mediaTypeCodesOfConductPreview = "application/vnd.github.scarlet-witch-preview+json"
	mediaTypeTopicsPreview = "application/vnd.github.mercy-preview+json"
	mediaTypeRequiredApprovingReviewsPreview = "application/vnd.github.luke-cage-preview+json"
	mediaTypeLockReasonPreview = "application/vnd.github.sailor-v-preview+json"
	mediaTypeCheckRunsPreview = "application/vnd.github.antiope-preview+json"
	mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
	mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json"
	mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json"
	mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json"
	mediaTypeDraftPreview = "application/vnd.github.shadow-cat-preview+json"
	mediaTypeEnablePagesAPIPreview = "application/vnd.github.switcheroo-preview+json"
	mediaTypeRequiredVulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json"
	mediaTypeRequiredAutomatedSecurityFixesPreview = "application/vnd.github.london-preview+json"
	mediaTypeUpdatePullRequestBranchPreview = "application/vnd.github.lydian-preview+json"
	mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json"
	mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json"
	mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json"
	mediaTypeMultiLineCommentsPreview = "application/vnd.github.comfort-fade-preview+json"
	mediaTypeOAuthAppPreview = "application/vnd.github.doctor-strange-preview+json"
	mediaTypeRepositoryVisibilityPreview = "application/vnd.github.nebula-preview+json"
)
type Client struct {
	clientMu sync.Mutex    
	client   *http.Client  
	BaseURL *url.URL
	UploadURL *url.URL
	UserAgent string
	rateMu     sync.Mutex
	rateLimits [categories]Rate  
	common service  
	Actions        *ActionsService
	Activity       *ActivityService
	Admin          *AdminService
	Apps           *AppsService
	Authorizations *AuthorizationsService
	Checks         *ChecksService
	Gists          *GistsService
	Git            *GitService
	Gitignores     *GitignoresService
	Interactions   *InteractionsService
	Issues         *IssuesService
	Licenses       *LicensesService
	Marketplace    *MarketplaceService
	Migrations     *MigrationService
	Organizations  *OrganizationsService
	Projects       *ProjectsService
	PullRequests   *PullRequestsService
	Reactions      *ReactionsService
	Repositories   *RepositoriesService
	Search         *SearchService
	Teams          *TeamsService
	Users          *UsersService
}
type service struct {
	client *Client
}
type ListOptions struct {
	Page int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}
type ListCursorOptions struct {
	Page string `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}
type UploadOptions struct {
	Name      string `url:"name,omitempty"`
	Label     string `url:"label,omitempty"`
	MediaType string `url:"-"`
}
type RawType uint8
const (
	Diff RawType = 1 + iota
	Patch
)
type RawOptions struct {
	Type RawType
}
func addOptions(s string, opts interface{}) (string, error) {
	v := reflect.ValueOf(opts)
	if v.Kind() == reflect.Ptr && v.IsNil() {
		return s, nil
	}
	u, err := url.Parse(s)
	if err != nil {
		return s, err
	}
	qs, err := query.Values(opts)
	if err != nil {
		return s, err
	}
	u.RawQuery = qs.Encode()
	return u.String(), nil
}
func NewClient(httpClient *http.Client) *Client {
	if httpClient == nil {
		httpClient = &http.Client{}
	}
	baseURL, _ := url.Parse(defaultBaseURL)
	uploadURL, _ := url.Parse(uploadBaseURL)
	c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, UploadURL: uploadURL}
	c.common.client = c
	c.Actions = (*ActionsService)(&c.common)
	c.Activity = (*ActivityService)(&c.common)
	c.Admin = (*AdminService)(&c.common)
	c.Apps = (*AppsService)(&c.common)
	c.Authorizations = (*AuthorizationsService)(&c.common)
	c.Checks = (*ChecksService)(&c.common)
	c.Gists = (*GistsService)(&c.common)
	c.Git = (*GitService)(&c.common)
	c.Gitignores = (*GitignoresService)(&c.common)
	c.Interactions = (*InteractionsService)(&c.common)
	c.Issues = (*IssuesService)(&c.common)
	c.Licenses = (*LicensesService)(&c.common)
	c.Marketplace = &MarketplaceService{client: c}
	c.Migrations = (*MigrationService)(&c.common)
	c.Organizations = (*OrganizationsService)(&c.common)
	c.Projects = (*ProjectsService)(&c.common)
	c.PullRequests = (*PullRequestsService)(&c.common)
	c.Reactions = (*ReactionsService)(&c.common)
	c.Repositories = (*RepositoriesService)(&c.common)
	c.Search = (*SearchService)(&c.common)
	c.Teams = (*TeamsService)(&c.common)
	c.Users = (*UsersService)(&c.common)
	return c
}