Documentation
¶
Overview ¶
Package github provides GitHub API client functionality for gh-find.
Index ¶
- Variables
- type Client
- func (c *Client) GetFileCommitDates(ctx context.Context, repo Repository, paths []string) ([]FileCommitInfo, error)
- func (c *Client) GetOwnerType(ctx context.Context, name string) (OwnerType, error)
- func (c *Client) GetRepo(ctx context.Context, owner, repo string) (Repository, error)
- func (c *Client) GetTree(ctx context.Context, repo Repository) (*TreeResponse, error)
- func (c *Client) ListRepos(ctx context.Context, name string, types RepoTypes) ([]Repository, error)
- type ClientOptions
- type FileCommitInfo
- type FileType
- type OwnerType
- type RepoType
- type RepoTypes
- type Repository
- type TreeEntry
- type TreeResponse
Constants ¶
This section is empty.
Variables ¶
var ValidRepoTypes = []string{ string(RepoTypeSources), string(RepoTypeForks), string(RepoTypeArchives), string(RepoTypeMirrors), }
ValidRepoTypes is the list of valid repository type values.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the go-gh REST and GraphQL clients.
func NewClient ¶
func NewClient(opts ClientOptions) (*Client, error)
NewClient creates a new GitHub API client with the given options.
func (*Client) GetFileCommitDates ¶ added in v1.0.0
func (c *Client) GetFileCommitDates(ctx context.Context, repo Repository, paths []string) ([]FileCommitInfo, error)
GetFileCommitDates fetches the last commit date for multiple files.
func (*Client) GetOwnerType ¶
GetOwnerType determines if a name is a "User" or "Organization".
func (*Client) GetTree ¶
func (c *Client) GetTree(ctx context.Context, repo Repository) (*TreeResponse, error)
GetTree fetches the Git tree for a repository recursively.
type ClientOptions ¶
type ClientOptions struct {
AuthToken string
CacheDir string
CacheTTL time.Duration
DisableCache bool
}
ClientOptions configures the GitHub API client.
type FileCommitInfo ¶ added in v1.0.0
FileCommitInfo holds the last commit timestamp for a file.
type FileType ¶ added in v0.9.2
type FileType string
FileType represents a file type classification.
const ( // FileTypeFile represents a regular file. FileTypeFile FileType = "file" // FileTypeDirectory represents a directory. FileTypeDirectory FileType = "directory" // FileTypeSymlink represents a symbolic link. FileTypeSymlink FileType = "symlink" // FileTypeExecutable represents an executable file. FileTypeExecutable FileType = "executable" // FileTypeSubmodule represents a Git submodule. FileTypeSubmodule FileType = "submodule" )
func ParseFileType ¶ added in v0.9.2
ParseFileType returns the file type based on Git mode.
type OwnerType ¶
type OwnerType string
OwnerType represents the type of account owner (User or Organization).
type RepoType ¶
type RepoType string
RepoType represents a GitHub repository classification.
const ( // RepoTypeSources represents source repositories (non-forks). RepoTypeSources RepoType = "sources" // RepoTypeForks represents forked repositories. RepoTypeForks RepoType = "forks" // RepoTypeArchives represents archived repositories. RepoTypeArchives RepoType = "archives" // RepoTypeMirrors represents mirrored repositories. RepoTypeMirrors RepoType = "mirrors" )
type RepoTypes ¶ added in v0.9.2
RepoTypes represents a set of repository types to include.
type Repository ¶
type Repository struct {
Owner string `json:"-"`
Name string `json:"name"`
FullName string `json:"full_name"`
Ref string `json:"default_branch"`
ExplicitRef bool `json:"-"`
URL string `json:"html_url"`
Size int `json:"size"`
Fork bool `json:"fork"`
Archived bool `json:"archived"`
MirrorURL string `json:"mirror_url"`
}
Repository represents a GitHub repository.
func (*Repository) UnmarshalJSON ¶ added in v0.9.4
func (r *Repository) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling for Repository.
type TreeEntry ¶
type TreeEntry struct {
Path string `json:"path"`
Mode string `json:"mode"`
Size int64 `json:"size"`
}
TreeEntry represents a file or directory in a Git tree.
type TreeResponse ¶
TreeResponse represents the GitHub API tree response.