github

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Body       string
}

APIError represents a non-200 response from the GitHub API.

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client provides authenticated access to the GitHub REST API. Supports both github.com and GitHub Enterprise domains.

func NewClient

func NewClient(domain, token string) *Client

NewClient creates an authenticated GitHub API client for the given domain. For github.com, uses https://api.github.com. For GHE domains, uses https://<domain>/api/v3.

func (*Client) Domain

func (c *Client) Domain() string

Domain returns the GitHub domain this client targets.

func (*Client) ListOrgRepos

func (c *Client) ListOrgRepos(ctx context.Context, org string) ([]Repo, error)

ListOrgRepos returns all repositories for the given organization.

func (*Client) ListPersonalRepos

func (c *Client) ListPersonalRepos(ctx context.Context) ([]Repo, error)

ListPersonalRepos returns repositories owned by the authenticated user.

func (*Client) ListUserOrgs

func (c *Client) ListUserOrgs(ctx context.Context) ([]Org, error)

ListUserOrgs returns all organizations the authenticated user belongs to.

type Org

type Org struct {
	Login string `json:"login"`
}

Org represents a GitHub organization.

type Repo

type Repo struct {
	Name     string    `json:"name"`
	CloneURL string    `json:"clone_url"`
	Owner    RepoOwner `json:"owner"`
}

Repo represents a GitHub repository returned from the API.

type RepoOwner

type RepoOwner struct {
	Login string `json:"login"`
}

RepoOwner identifies the owner of a GitHub repository.

Jump to

Keyboard shortcuts

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