gateway

package
v0.0.0-...-39dd4b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gateway provides a gateway to the GitHub API, abstracting away the underlying REST and GraphQL clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	FetchCommits(ctx context.Context, org, user, dateRange string) (map[string]int, error)
	FetchCreatedPRs(ctx context.Context, org, user, dateRange string) (map[string]int, error)
	FetchReviewedPRs(ctx context.Context, org, user, dateRange string) (map[string]int, error)
	// New method to fetch lead time data for pull requests.
	FetchPRLeadTimes(ctx context.Context, org, user, dateRange string) (map[string][]PRLeadTimeData, error)
}

Fetcher defines the behavior of a gateway for fetching information from GitHub.

func NewGitHubGateway

func NewGitHubGateway(token string, logger *log.Logger) (Fetcher, error)

NewGitHubGateway is a constructor that creates a new instance of GitHubGateway.

type GitHubGateway

type GitHubGateway struct {
	// contains filtered or unexported fields
}

GitHubGateway is the concrete implementation of the Fetcher interface.

func (*GitHubGateway) FetchCommits

func (g *GitHubGateway) FetchCommits(ctx context.Context, org, user, dateRange string) (map[string]int, error)

func (*GitHubGateway) FetchCreatedPRs

func (g *GitHubGateway) FetchCreatedPRs(ctx context.Context, org, user, dateRange string) (map[string]int, error)

func (*GitHubGateway) FetchPRLeadTimes

func (g *GitHubGateway) FetchPRLeadTimes(ctx context.Context, org, user, dateRange string) (map[string][]PRLeadTimeData, error)

FetchPRLeadTimes fetches PR creation and last review timestamps.

func (*GitHubGateway) FetchReviewedPRs

func (g *GitHubGateway) FetchReviewedPRs(ctx context.Context, org, user, dateRange string) (map[string]int, error)

type PRLeadTimeData

type PRLeadTimeData struct {
	CreatedAt      time.Time
	LastReviewedAt time.Time
}

PRLeadTimeData holds the necessary timestamps for calculating lead time for a single PR.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL