{"modulePath":"github.com/cam3ron2/github-stats-exporter","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubapi\n\n## Functions\n\n```go\nfunc NewInstallationHTTPClient(cfg InstallationAuthConfig) (*http.Client, error)\n```\nNewInstallationHTTPClient creates an authenticated HTTP client for one GitHub App installation.\n\n## Types\n\n```go\ntype CallMetadata struct {\n\tAttempts        int\n\tLastRateHeaders RateLimitHeaders\n\tLastDecision    Decision\n}\n```\nCallMetadata reports execution metadata for a client call.\n\n```go\ntype Client struct {\n\n\t// Sleep is injected for testability.\n\tSleep func(duration time.Duration)\n\t// contains filtered or unexported fields\n}\n```\nClient wraps GitHub HTTP requests with retry and rate-limit controls.\n\n```go\nfunc NewClient(doer HTTPDoer, retry RetryConfig, ratePolicy RateLimitPolicy) *Client\n```\nNewClient creates a GitHub API client wrapper.\n\n```go\nfunc (c *Client) Do(req *http.Request) (*http.Response, CallMetadata, error)\n```\nDo executes a request with retry and rate-limit awareness.\n\n```go\ntype CommitDetail struct {\n\tStatus    EndpointStatus\n\tSHA       string\n\tAuthor    string\n\tAdditions int\n\tDeletions int\n\tTotal     int\n\tMetadata  CallMetadata\n}\n```\nCommitDetail is a typed commit detail response.\n\n```go\ntype CommitListResult struct {\n\tStatus    EndpointStatus\n\tCommits   []RepoCommit\n\tTruncated bool\n\tMetadata  CallMetadata\n}\n```\nCommitListResult is the typed result for listing repository commits in a window.\n\n```go\ntype ContributorStats struct {\n\tUser         string\n\tTotalCommits int\n\tWeeks        []ContributorWeek\n}\n```\nContributorStats is one contributor's aggregate stats payload.\n\n```go\ntype ContributorStatsResult struct {\n\tStatus       EndpointStatus\n\tContributors []ContributorStats\n\tMetadata     CallMetadata\n}\n```\nContributorStatsResult is the typed result for \\`/stats/contributors\\`.\n\n```go\ntype ContributorWeek struct {\n\tWeekStart time.Time\n\tAdditions int\n\tDeletions int\n\tCommits   int\n}\n```\nContributorWeek is one contributor weekly summary from contributor stats.\n\n```go\ntype CopilotReportLinkResult struct {\n\tStatus         EndpointStatus\n\tURL            string\n\tDownloadLinks  []string\n\tReportDay      time.Time\n\tReportStartDay time.Time\n\tReportEndDay   time.Time\n\tExpiresAt      time.Time\n\tMetadata       CallMetadata\n}\n```\nCopilotReportLinkResult is the typed result for Copilot report-link endpoints.\n\n```go\ntype CopilotReportStreamResult struct {\n\tStatus        EndpointStatus\n\tRecordsParsed int\n\tParseErrors   int\n\tMetadata      CallMetadata\n}\n```\nCopilotReportStreamResult is the typed result for streaming Copilot report NDJSON data.\n\n```go\ntype DataClient struct {\n\t// contains filtered or unexported fields\n}\n```\nDataClient is a typed GitHub REST data client for scrape-relevant endpoints.\n\n```go\nfunc NewDataClient(baseURL string, requestClient *Client) (*DataClient, error)\n```\nNewDataClient creates a typed data client over the generic retry/rate-limit request client.\n\n```go\nfunc (c *DataClient) GetCommit(ctx context.Context, owner, repo, sha string) (CommitDetail, error)\n```\nGetCommit reads commit detail including additions/deletions.\n\n```go\nfunc (c *DataClient) GetContributorStats(ctx context.Context, owner, repo string) (ContributorStatsResult, error)\n```\nGetContributorStats reads contributor weekly stats for one repository.\n\n```go\nfunc (c *DataClient) GetEnterpriseCopilotEnterprise1DayReportLink(\n\tctx context.Context,\n\tenterprise string,\n\tday time.Time,\n) (CopilotReportLinkResult, error)\n```\nGetEnterpriseCopilotEnterprise1DayReportLink gets an enterprise 1-day aggregate report link.\n\n```go\nfunc (c *DataClient) GetEnterpriseCopilotEnterprise28DayLatestReportLink(\n\tctx context.Context,\n\tenterprise string,\n) (CopilotReportLinkResult, error)\n```\nGetEnterpriseCopilotEnterprise28DayLatestReportLink gets an enterprise 28-day latest aggregate report link.\n\n```go\nfunc (c *DataClient) GetEnterpriseCopilotUsers1DayReportLink(\n\tctx context.Context,\n\tenterprise string,\n\tday time.Time,\n) (CopilotReportLinkResult, error)\n```\nGetEnterpriseCopilotUsers1DayReportLink gets an enterprise 1-day user report link.\n\n```go\nfunc (c *DataClient) GetEnterpriseCopilotUsers28DayLatestReportLink(\n\tctx context.Context,\n\tenterprise string,\n) (CopilotReportLinkResult, error)\n```\nGetEnterpriseCopilotUsers28DayLatestReportLink gets an enterprise 28-day latest user report link.\n\n```go\nfunc (c *DataClient) GetOrgCopilotOrganization1DayReportLink(\n\tctx context.Context,\n\torg string,\n\tday time.Time,\n) (CopilotReportLinkResult, error)\n```\nGetOrgCopilotOrganization1DayReportLink gets an org 1-day aggregate report link.\n\n```go\nfunc (c *DataClient) GetOrgCopilotOrganization28DayLatestReportLink(\n\tctx context.Context,\n\torg string,\n) (CopilotReportLinkResult, error)\n```\nGetOrgCopilotOrganization28DayLatestReportLink gets an org 28-day latest aggregate report link.\n\n```go\nfunc (c *DataClient) GetOrgCopilotUsers1DayReportLink(\n\tctx context.Context,\n\torg string,\n\tday time.Time,\n) (CopilotReportLinkResult, error)\n```\nGetOrgCopilotUsers1DayReportLink gets an org 1-day user report link.\n\n```go\nfunc (c *DataClient) GetOrgCopilotUsers28DayLatestReportLink(\n\tctx context.Context,\n\torg string,\n) (CopilotReportLinkResult, error)\n```\nGetOrgCopilotUsers28DayLatestReportLink gets an org 28-day latest user report link.\n\n```go\nfunc (c *DataClient) ListIssueCommentsWindow(ctx context.Context, owner, repo string, since, until time.Time) (IssueCommentsResult, error)\n```\nListIssueCommentsWindow lists repository issue comments filtered to a window.\n\n```go\nfunc (c *DataClient) ListOrgRepos(ctx context.Context, org string) (OrgReposResult, error)\n```\nListOrgRepos lists repositories for an organization and falls back to user repositories on 404.\n\n```go\nfunc (c *DataClient) ListPullReviews(ctx context.Context, owner, repo string, pullNumber int, since, until time.Time) (PullReviewsResult, error)\n```\nListPullReviews lists reviews for one pull request and filters them to a window.\n\n```go\nfunc (c *DataClient) ListRepoCommitsWindow(ctx context.Context, owner, repo string, since, until time.Time, maxCommits int) (CommitListResult, error)\n```\nListRepoCommitsWindow lists repository commits in a time window with pagination and optional cap.\n\n```go\nfunc (c *DataClient) ListRepoPullRequestsWindow(ctx context.Context, owner, repo string, since, until time.Time) (PullRequestListResult, error)\n```\nListRepoPullRequestsWindow lists repository pull requests and filters them to a window.\n\n```go\nfunc (c *DataClient) StreamCopilotReportNDJSON(\n\tctx context.Context,\n\tsignedReportURL string,\n\thandler func(record map[string]any) error,\n) (CopilotReportStreamResult, error)\n```\nStreamCopilotReportNDJSON downloads and line-parses a Copilot report payload.\n\n```go\ntype Decision struct {\n\tAllow   bool\n\tWaitFor time.Duration\n\tReason  string\n}\n```\nDecision represents a rate-limit action decision.\n\n```go\ntype EndpointStatus string\n```\nEndpointStatus represents a normalized GitHub API endpoint outcome.\n\n```go\nconst (\n\t// EndpointStatusOK indicates a successful response.\n\tEndpointStatusOK EndpointStatus = \"ok\"\n\t// EndpointStatusAccepted indicates GitHub accepted the request and is still computing results.\n\tEndpointStatusAccepted EndpointStatus = \"accepted\"\n\t// EndpointStatusForbidden indicates authorization failure or restricted access.\n\tEndpointStatusForbidden EndpointStatus = \"forbidden\"\n\t// EndpointStatusNotFound indicates the resource does not exist or is hidden.\n\tEndpointStatusNotFound EndpointStatus = \"not_found\"\n\t// EndpointStatusConflict indicates a state conflict, like unsupported stats on empty repositories.\n\tEndpointStatusConflict EndpointStatus = \"conflict\"\n\t// EndpointStatusUnprocessable indicates request validation/processing failure.\n\tEndpointStatusUnprocessable EndpointStatus = \"unprocessable\"\n\t// EndpointStatusUnavailable indicates a temporary service-side failure.\n\tEndpointStatusUnavailable EndpointStatus = \"unavailable\"\n\t// EndpointStatusUnknown indicates an unclassified non-success status.\n\tEndpointStatusUnknown EndpointStatus = \"unknown\"\n)\n```\n\n```go\ntype HTTPDoer interface {\n\tDo(req *http.Request) (*http.Response, error)\n}\n```\nHTTPDoer is implemented by http.Client.\n\n```go\ntype InstallationAuthConfig struct {\n\tAppID          int64\n\tInstallationID int64\n\tPrivateKeyPath string\n\tTimeout        time.Duration\n\tBaseTransport  http.RoundTripper\n}\n```\nInstallationAuthConfig configures GitHub App installation authentication.\n\n```go\ntype IssueComment struct {\n\tID        int64\n\tUser      string\n\tCreatedAt time.Time\n}\n```\nIssueComment is one repository issue comment.\n\n```go\ntype IssueCommentsResult struct {\n\tStatus   EndpointStatus\n\tComments []IssueComment\n\tMetadata CallMetadata\n}\n```\nIssueCommentsResult is the typed result for listing repository issue comments.\n\n```go\ntype LOCEvent struct {\n\tObservedAt             time.Time\n\tHTTPStatus             int\n\tStatsPresent           bool\n\tContributionsNonZero   bool\n\tAdditionsDeletionsZero bool\n}\n```\nLOCEvent represents one contributor-stats observation.\n\n```go\ntype LOCMode string\n```\nLOCMode represents the contributor-stats processing mode.\n\n```go\nconst (\n\t// LOCModeUnknown is the initial mode before first observation.\n\tLOCModeUnknown LOCMode = \"unknown\"\n\t// LOCModeWarming indicates contributor stats are still being generated.\n\tLOCModeWarming LOCMode = \"warming\"\n\t// LOCModeReady indicates contributor stats are available and usable.\n\tLOCModeReady LOCMode = \"ready\"\n\t// LOCModeStale indicates contributor stats have remained unavailable too long.\n\tLOCModeStale LOCMode = \"stale\"\n\t// LOCModeFallback indicates commit-stat fallback mode is active.\n\tLOCModeFallback LOCMode = \"fallback\"\n)\n```\n\n```go\ntype LOCState struct {\n\tMode                   LOCMode\n\tConsecutive202         int\n\tConsecutiveZeroWindows int\n\tLastReadyAt            time.Time\n\tFallbackUntil          time.Time\n\tLastObservedAt         time.Time\n}\n```\nLOCState tracks contributor-stats state transitions.\n\n```go\ntype LOCStateMachine struct {\n\tRefreshInterval       time.Duration\n\tStaleWindowMultiplier int\n\tZeroDetectionWindows  int\n\tFallbackCooldown      time.Duration\n}\n```\nLOCStateMachine configures transition rules.\n\n```go\nfunc (m LOCStateMachine) Apply(previous LOCState, event LOCEvent) LOCState\n```\nApply applies an event to a previous state and returns a new state.\n\n```go\ntype OrgReposResult struct {\n\tStatus   EndpointStatus\n\tRepos    []Repository\n\tMetadata CallMetadata\n}\n```\nOrgReposResult is the typed result for listing organization repositories.\n\n```go\ntype PullRequest struct {\n\tNumber    int\n\tUser      string\n\tCreatedAt time.Time\n\tUpdatedAt time.Time\n\tMergedAt  time.Time\n}\n```\nPullRequest is one pull request summary.\n\n```go\ntype PullRequestListResult struct {\n\tStatus       EndpointStatus\n\tPullRequests []PullRequest\n\tMetadata     CallMetadata\n}\n```\nPullRequestListResult is the typed result for listing pull requests in a window.\n\n```go\ntype PullReview struct {\n\tID          int64\n\tUser        string\n\tState       string\n\tSubmittedAt time.Time\n}\n```\nPullReview is one pull request review submission.\n\n```go\ntype PullReviewsResult struct {\n\tStatus   EndpointStatus\n\tReviews  []PullReview\n\tMetadata CallMetadata\n}\n```\nPullReviewsResult is the typed result for listing pull reviews.\n\n```go\ntype RESTClient struct {\n\tClient *github.Client\n}\n```\nRESTClient wraps the go-github REST client.\n\n```go\nfunc NewGitHubRESTClient(httpClient *http.Client, apiBaseURL string) (*RESTClient, error)\n```\nNewGitHubRESTClient creates a go-github client with optional API base URL override.\n\n```go\ntype RateLimitHeaders struct {\n\tRemaining        int\n\tResetUnix        int64\n\tUsed             int\n\tRetryAfter       time.Duration\n\tSecondaryLimited bool\n}\n```\nRateLimitHeaders contains parsed GitHub rate-limit response headers.\n\n```go\nfunc ParseRateLimitHeaders(header http.Header, statusCode int) RateLimitHeaders\n```\nParseRateLimitHeaders parses rate-limit and retry headers.\n\n```go\ntype RateLimitPolicy struct {\n\tMinRemainingThreshold int\n\tMinResetBuffer        time.Duration\n\tSecondaryLimitBackoff time.Duration\n\tNow                   func() time.Time\n}\n```\nRateLimitPolicy evaluates rate-limit actions from parsed headers.\n\n```go\nfunc (p RateLimitPolicy) Evaluate(headers RateLimitHeaders) Decision\n```\nEvaluate decides whether calls may continue or should pause.\n\n```go\ntype RepoCommit struct {\n\tSHA            string\n\tAuthor         string\n\tCommitter      string\n\tAuthorName     string\n\tAuthorEmail    string\n\tCommitterName  string\n\tCommitterEmail string\n\tCommittedAt    time.Time\n}\n```\nRepoCommit is one commit summary from the commit list endpoint.\n\n```go\ntype Repository struct {\n\tName          string\n\tFullName      string\n\tDefaultBranch string\n\tArchived      bool\n\tDisabled      bool\n\tFork          bool\n}\n```\nRepository is one GitHub repository in an organization.\n\n```go\ntype RetryConfig struct {\n\tMaxAttempts    int\n\tInitialBackoff time.Duration\n\tMaxBackoff     time.Duration\n}\n```\nRetryConfig configures GitHub client retry behavior.\n\n","path":"github.com/cam3ron2/github-stats-exporter/internal/githubapi","name":"githubapi","synopsis":"","isRedistributable":true}
