Documentation
¶
Index ¶
- Constants
- type BitbucketClient
- func (c *BitbucketClient) CreateMergeRequest(ctx context.Context, ...) (*MergeRequest, error)
- func (c *BitbucketClient) GetCloneURL(repo string) string
- func (c *BitbucketClient) GetRepository(ctx context.Context, name string) (*Repository, error)
- func (c *BitbucketClient) ListRepositories(ctx context.Context) ([]Repository, error)
- func (c *BitbucketClient) ValidateCredentials(ctx context.Context) error
- type Client
- type GitHubClient
- func (c *GitHubClient) CreateMergeRequest(ctx context.Context, ...) (*MergeRequest, error)
- func (c *GitHubClient) GetCloneURL(repo string) string
- func (c *GitHubClient) GetRepository(ctx context.Context, name string) (*Repository, error)
- func (c *GitHubClient) ListRepositories(ctx context.Context) ([]Repository, error)
- func (c *GitHubClient) ValidateCredentials(ctx context.Context) error
- type GitLabClient
- func (c *GitLabClient) CreateMergeRequest(ctx context.Context, ...) (*MergeRequest, error)
- func (c *GitLabClient) GetCloneURL(repo string) string
- func (c *GitLabClient) GetRepository(ctx context.Context, name string) (*Repository, error)
- func (c *GitLabClient) ListRepositories(ctx context.Context) ([]Repository, error)
- func (c *GitLabClient) ValidateCredentials(ctx context.Context) error
- type GiteaClient
- func (c *GiteaClient) CreateMergeRequest(ctx context.Context, ...) (*MergeRequest, error)
- func (c *GiteaClient) GetCloneURL(repo string) string
- func (c *GiteaClient) GetRepository(ctx context.Context, name string) (*Repository, error)
- func (c *GiteaClient) ListRepositories(ctx context.Context) ([]Repository, error)
- func (c *GiteaClient) ValidateCredentials(ctx context.Context) error
- type MergeRequest
- type Repository
Constants ¶
const DefaultHTTPTimeout = 30 * time.Second
DefaultHTTPTimeout is the default timeout for HTTP requests to code hosts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitbucketClient ¶
type BitbucketClient struct {
// contains filtered or unexported fields
}
BitbucketClient implements Client for Bitbucket Cloud.
func NewBitbucketClient ¶
func NewBitbucketClient(token string) *BitbucketClient
NewBitbucketClient creates a new Bitbucket Cloud client. token should be in format "username:app_password" or just the app password.
func NewBitbucketServerClient ¶
func NewBitbucketServerClient(baseURL, token string) *BitbucketClient
NewBitbucketServerClient creates a Bitbucket Server (self-hosted) client.
func (*BitbucketClient) CreateMergeRequest ¶
func (c *BitbucketClient) CreateMergeRequest( ctx context.Context, repo, title, description, sourceBranch, targetBranch string, ) (*MergeRequest, error)
CreateMergeRequest creates a pull request on Bitbucket.
func (*BitbucketClient) GetCloneURL ¶
func (c *BitbucketClient) GetCloneURL(repo string) string
GetCloneURL returns the clone URL for a repository.
func (*BitbucketClient) GetRepository ¶
func (c *BitbucketClient) GetRepository(ctx context.Context, name string) (*Repository, error)
GetRepository gets a specific repository.
func (*BitbucketClient) ListRepositories ¶
func (c *BitbucketClient) ListRepositories(ctx context.Context) ([]Repository, error)
ListRepositories lists all accessible repositories.
func (*BitbucketClient) ValidateCredentials ¶
func (c *BitbucketClient) ValidateCredentials(ctx context.Context) error
ValidateCredentials checks if the credentials are valid. If no credentials provided, skips validation (for public repo access).
type Client ¶
type Client interface {
ValidateCredentials(ctx context.Context) error
ListRepositories(ctx context.Context) ([]Repository, error)
GetRepository(ctx context.Context, name string) (*Repository, error)
CreateMergeRequest(
ctx context.Context,
repo, title, description, sourceBranch, targetBranch string,
) (*MergeRequest, error)
GetCloneURL(repo string) string
}
Client interface for code host operations.
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient implements Client for GitHub.
func NewGitHubClient ¶
func NewGitHubClient(token string) *GitHubClient
NewGitHubClient creates a new GitHub client.
func NewGitHubEnterpriseClient ¶
func NewGitHubEnterpriseClient(baseURL, token string) *GitHubClient
NewGitHubEnterpriseClient creates a GitHub Enterprise client.
func (*GitHubClient) CreateMergeRequest ¶
func (c *GitHubClient) CreateMergeRequest( ctx context.Context, repo, title, description, sourceBranch, targetBranch string, ) (*MergeRequest, error)
CreateMergeRequest creates a pull request on GitHub.
func (*GitHubClient) GetCloneURL ¶
func (c *GitHubClient) GetCloneURL(repo string) string
GetCloneURL returns the clone URL for a repository.
func (*GitHubClient) GetRepository ¶
func (c *GitHubClient) GetRepository(ctx context.Context, name string) (*Repository, error)
GetRepository gets a specific repository.
func (*GitHubClient) ListRepositories ¶
func (c *GitHubClient) ListRepositories(ctx context.Context) ([]Repository, error)
ListRepositories lists all accessible repositories.
func (*GitHubClient) ValidateCredentials ¶
func (c *GitHubClient) ValidateCredentials(ctx context.Context) error
ValidateCredentials checks if the token is valid by fetching the current user. If no token is provided, skips validation (for public repo access).
type GitLabClient ¶
type GitLabClient struct {
// contains filtered or unexported fields
}
GitLabClient implements Client for GitLab.
func NewGitLabClient ¶
func NewGitLabClient(baseURL, token string) *GitLabClient
NewGitLabClient creates a new GitLab client.
func (*GitLabClient) CreateMergeRequest ¶
func (c *GitLabClient) CreateMergeRequest( ctx context.Context, repo, title, description, sourceBranch, targetBranch string, ) (*MergeRequest, error)
CreateMergeRequest creates a merge request on GitLab.
func (*GitLabClient) GetCloneURL ¶
func (c *GitLabClient) GetCloneURL(repo string) string
GetCloneURL returns the clone URL for a repository.
func (*GitLabClient) GetRepository ¶
func (c *GitLabClient) GetRepository(ctx context.Context, name string) (*Repository, error)
GetRepository gets a specific project.
func (*GitLabClient) ListRepositories ¶
func (c *GitLabClient) ListRepositories(ctx context.Context) ([]Repository, error)
ListRepositories lists all accessible projects.
func (*GitLabClient) ValidateCredentials ¶
func (c *GitLabClient) ValidateCredentials(ctx context.Context) error
ValidateCredentials checks if the token is valid by fetching the current user. If no token is provided, skips validation (for public repo access).
type GiteaClient ¶
type GiteaClient struct {
// contains filtered or unexported fields
}
GiteaClient implements Client for Gitea.
func NewGiteaClient ¶
func NewGiteaClient(baseURL, token string) *GiteaClient
NewGiteaClient creates a new Gitea client.
func (*GiteaClient) CreateMergeRequest ¶
func (c *GiteaClient) CreateMergeRequest( ctx context.Context, repo, title, description, sourceBranch, targetBranch string, ) (*MergeRequest, error)
CreateMergeRequest creates a pull request on Gitea.
func (*GiteaClient) GetCloneURL ¶
func (c *GiteaClient) GetCloneURL(repo string) string
GetCloneURL returns the clone URL for a repository.
func (*GiteaClient) GetRepository ¶
func (c *GiteaClient) GetRepository(ctx context.Context, name string) (*Repository, error)
GetRepository gets a specific repository.
func (*GiteaClient) ListRepositories ¶
func (c *GiteaClient) ListRepositories(ctx context.Context) ([]Repository, error)
ListRepositories lists all accessible repositories.
func (*GiteaClient) ValidateCredentials ¶
func (c *GiteaClient) ValidateCredentials(ctx context.Context) error
ValidateCredentials checks if the token is valid by fetching the current user. If no token is provided, skips validation (for public repo access).