github

package
v0.0.0-...-3f0ab45 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package github implements the provider interface for GitHub.

This package provides GitHub-specific API integration for repository operations including listing, cloning, and organization management.

Features

  • Repository listing (org and user)
  • Token validation
  • Rate limit management
  • Pagination handling
  • GitHub Enterprise Server (custom base URL)

Usage

// baseURL="" targets github.com; set it for a GitHub Enterprise Server.
provider := github.NewProvider(token, baseURL)
repos, err := provider.ListOrganizationRepos(ctx, "myorg")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements the provider.Provider interface for GitHub

func NewProvider

func NewProvider(token, baseURL string) *Provider

NewProvider creates a new GitHub provider.

A non-empty baseURL targets a GitHub Enterprise Server instance. An empty baseURL keeps the default github.com behavior (backward compatible).

func NewProviderWithOptions

func NewProviderWithOptions(opts ProviderOptions) *Provider

NewProviderWithOptions creates a new GitHub provider with custom options.

func (*Provider) BaseURL

func (p *Provider) BaseURL() string

BaseURL returns the configured Enterprise base URL, or "" for github.com.

func (*Provider) GetRateLimit

func (p *Provider) GetRateLimit(ctx context.Context) (*provider.RateLimit, error)

GetRateLimit returns current rate limit status

func (*Provider) GetRepository

func (p *Provider) GetRepository(ctx context.Context, owner, repo string) (*provider.Repository, error)

GetRepository gets a single repository from GitHub

func (*Provider) ListOrganizationRepos

func (p *Provider) ListOrganizationRepos(ctx context.Context, org string) ([]*provider.Repository, error)

ListOrganizationRepos lists all repositories in a GitHub organization

func (*Provider) ListOrganizations

func (p *Provider) ListOrganizations(ctx context.Context) ([]*provider.Organization, error)

ListOrganizations lists organizations the authenticated user belongs to

func (*Provider) ListUserRepos

func (p *Provider) ListUserRepos(ctx context.Context, user string) ([]*provider.Repository, error)

ListUserRepos lists all repositories for a user

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name

func (*Provider) SetToken

func (p *Provider) SetToken(token string) error

SetToken sets the authentication token, preserving the configured base URL.

func (*Provider) ValidateToken

func (p *Provider) ValidateToken(ctx context.Context) (bool, error)

ValidateToken validates the current token

type ProviderOptions

type ProviderOptions struct {
	Token   string
	BaseURL string // GitHub Enterprise Server URL; empty for github.com
}

ProviderOptions configures the GitHub Provider.

Jump to

Keyboard shortcuts

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