github

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepoNames

func GetRepoNames(repos []Repository) []string

GetRepoNames extracts repository names from a list of repos

Types

type Client

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

Client handles GitHub API operations

func NewClient

func NewClient(token, org string) Client

NewClient creates a new GitHub API client

func (*Client) CreateRepo

func (c *Client) CreateRepo(repoName, description string, private bool) error

CreateRepo creates a new repository

func (*Client) DeleteRepo

func (c *Client) DeleteRepo(repoName string) error

DeleteRepo deletes a repository from GitHub

func (*Client) HasToken

func (c *Client) HasToken() bool

HasToken returns whether a token is configured

func (*Client) ListPublicRepos

func (c *Client) ListPublicRepos() ([]Repository, error)

ListPublicRepos lists all public repositories for the user/org

func (*Client) RepoExists

func (c *Client) RepoExists(repoName string) (bool, error)

RepoExists checks if a repository exists

type CreateRepoRequest

type CreateRepoRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	AutoInit    bool   `json:"auto_init"`
}

CreateRepoRequest represents the request to create a repository

type CreateRepoResponse

type CreateRepoResponse struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	FullName string `json:"full_name"`
	Private  bool   `json:"private"`
	SSHURL   string `json:"ssh_url"`
	CloneURL string `json:"clone_url"`
}

CreateRepoResponse represents the response from creating a repository

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Errors  []struct {
		Resource string `json:"resource"`
		Field    string `json:"field"`
		Code     string `json:"code"`
	} `json:"errors,omitempty"`
}

ErrorResponse represents an error response from GitHub API

type Repository

type Repository struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Private     bool   `json:"private"`
	Fork        bool   `json:"fork"`
	Archived    bool   `json:"archived"`
	Disabled    bool   `json:"disabled"`
	Size        int    `json:"size"`
}

Repository represents a GitHub repository

Jump to

Keyboard shortcuts

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