github

package
v0.0.0-...-8f349c4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: GPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the GitHub API client

func NewClient

func NewClient(token string) *Client

NewClient creates a new GitHub API client

func (*Client) ExtractFunction

func (c *Client) ExtractFunction(content, language, functionName string) (string, error)

ExtractFunction attempts to extract a function from a file

func (*Client) GetCommitsSince

func (c *Client) GetCommitsSince(owner, repo, path string, since time.Time, sinceCommit string) ([]CommitInfo, error)

GetCommitsSince gets all commits for a file since a specific date or commit

func (*Client) GetDirectory

func (c *Client) GetDirectory(owner, repo, path, ref string) (map[string]*FileInfo, error)

GetDirectory retrieves all files from a directory in a GitHub repository

func (*Client) GetFile

func (c *Client) GetFile(owner, repo, path, ref string) (*FileInfo, error)

GetFile retrieves a file from a GitHub repository

func (*Client) GetFileDiff

func (c *Client) GetFileDiff(owner, repo, path, baseRef, headRef string) (string, error)

GetFileDiff gets the diff between two versions of a file

func (*Client) GetRawFile

func (c *Client) GetRawFile(owner, repo, path, ref string) ([]byte, error)

GetRawFile gets the raw content of a file without processing

type Commit

type Commit struct {
	SHA  string
	Date time.Time
}

type CommitInfo

type CommitInfo struct {
	SHA       string
	Message   string
	Author    string
	Timestamp time.Time
}

CommitInfo represents information about a commit

type FileContent

type FileContent struct {
	Content string
}

type FileInfo

type FileInfo struct {
	Content  string
	Path     string
	SHA      string
	Updated  time.Time
	CommitID string
}

FileInfo represents information about a file in a GitHub repository

type GitHubClient

type GitHubClient interface {
	GetFile(owner, repo, path, revision string) (*FileContent, error)
	GetCommitsSince(owner, repo, path string, since time.Time, until string) ([]Commit, error)
	ExtractFunction(content, language, functionName string) (string, error)
}

Jump to

Keyboard shortcuts

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