Documentation
¶
Index ¶
- func WrapGitHubError(err error) error
- type GitHubStorage
- func (g *GitHubStorage) CreateRepo(owner, name string, private bool) error
- func (g *GitHubStorage) HasRepoAccess(owner, name string) (bool, error)
- func (g *GitHubStorage) ReadFile(repo, path string) ([]byte, error)
- func (g *GitHubStorage) RepoExists(owner, name string) (bool, error)
- func (g *GitHubStorage) WriteFile(repo, path string, content []byte) error
- type MockStorage
- func (m *MockStorage) CreateRepo(owner, name string, private bool) error
- func (m *MockStorage) HasRepoAccess(owner, name string) (bool, error)
- func (m *MockStorage) ReadFile(repo, path string) ([]byte, error)
- func (m *MockStorage) RepoExists(owner, name string) (bool, error)
- func (m *MockStorage) WriteFile(repo, path string, content []byte) error
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapGitHubError ¶ added in v0.1.6
WrapGitHubError returns a user-friendly error for common GitHub API failures (expired token, revoked token, etc.). Falls back to the original error otherwise.
Types ¶
type GitHubStorage ¶
type GitHubStorage struct {
// contains filtered or unexported fields
}
func NewGitHubStorage ¶
func NewGitHubStorage(token string) *GitHubStorage
func (*GitHubStorage) CreateRepo ¶
func (g *GitHubStorage) CreateRepo(owner, name string, private bool) error
func (*GitHubStorage) HasRepoAccess ¶
func (g *GitHubStorage) HasRepoAccess(owner, name string) (bool, error)
func (*GitHubStorage) ReadFile ¶
func (g *GitHubStorage) ReadFile(repo, path string) ([]byte, error)
func (*GitHubStorage) RepoExists ¶
func (g *GitHubStorage) RepoExists(owner, name string) (bool, error)
type MockStorage ¶
type MockStorage struct {
Repos map[string]bool // "owner/name" -> exists
Files map[string]map[string][]byte // "owner/name" -> path -> content
// contains filtered or unexported fields
}
MockStorage is an in-memory Provider implementation for tests.
func NewMockStorage ¶
func NewMockStorage() *MockStorage
NewMockStorage creates an empty mock storage.
func (*MockStorage) CreateRepo ¶
func (m *MockStorage) CreateRepo(owner, name string, private bool) error
func (*MockStorage) HasRepoAccess ¶
func (m *MockStorage) HasRepoAccess(owner, name string) (bool, error)
func (*MockStorage) RepoExists ¶
func (m *MockStorage) RepoExists(owner, name string) (bool, error)
type Provider ¶
type Provider interface {
// RepoExists checks whether a repository exists and is accessible.
RepoExists(owner, name string) (bool, error)
// CreateRepo creates a new repository.
CreateRepo(owner, name string, private bool) error
// ReadFile reads a file from a repository. Returns nil, nil if not found.
ReadFile(repo, path string) ([]byte, error)
// WriteFile creates or updates a file in a repository.
WriteFile(repo, path string, content []byte) error
// HasRepoAccess checks if the authenticated user has access to a repo.
HasRepoAccess(owner, name string) (bool, error)
}
Provider defines the storage backend interface. Implementations exist per git provider (GitHub, GitLab, etc.).
Click to show internal directories.
Click to hide internal directories.