Documentation
¶
Index ¶
- func DefaultCredentialsPath() string
- func GetEnvVarName(connType ConnectorType) string
- func GetToken(connType ConnectorType) string
- func LoadCredentialsEnv(path string) error
- func SaveCredential(path, key, value string) error
- type BitbucketConnector
- type BitbucketRepo
- type BitbucketRepoResponse
- type BitbucketServerRepo
- type BitbucketServerRepoResponse
- type BitbucketUser
- type Connector
- type ConnectorType
- type GitHubConnector
- type GitHubRepo
- type GitHubUser
- type GiteaConnector
- type GiteaOrg
- type GiteaRepo
- type GiteaUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCredentialsPath ¶
func DefaultCredentialsPath() string
DefaultCredentialsPath returns the default path for credentials.env
func GetEnvVarName ¶
func GetEnvVarName(connType ConnectorType) string
GetEnvVarName returns the environment variable name for a connector type
func GetToken ¶
func GetToken(connType ConnectorType) string
GetToken retrieves the token for a connector type
func LoadCredentialsEnv ¶
LoadCredentialsEnv loads environment variables from a credentials file
func SaveCredential ¶
SaveCredential saves or updates a credential in the credentials file
Types ¶
type BitbucketConnector ¶
type BitbucketConnector struct {
// contains filtered or unexported fields
}
BitbucketConnector implements the Connector interface for Bitbucket Cloud
func NewBitbucketConnector ¶
func NewBitbucketConnector(host, token string) *BitbucketConnector
NewBitbucketConnector creates a new Bitbucket connector
func (*BitbucketConnector) ListRepos ¶
ListRepos returns all repos for the configured workspace/user
func (*BitbucketConnector) Name ¶
func (b *BitbucketConnector) Name() string
Name returns the connector name
func (*BitbucketConnector) TestConnection ¶
func (b *BitbucketConnector) TestConnection(ctx context.Context) error
TestConnection verifies the credentials work
func (*BitbucketConnector) TokenGenerationURL ¶
func (b *BitbucketConnector) TokenGenerationURL() string
TokenGenerationURL returns the URL where users can generate app passwords
type BitbucketRepo ¶
BitbucketRepo represents a repository from Bitbucket Cloud API
type BitbucketRepoResponse ¶
type BitbucketRepoResponse struct {
Values []BitbucketRepo `json:"values"`
Next string `json:"next"`
}
BitbucketRepoResponse represents the paginated response from Cloud
type BitbucketServerRepo ¶
type BitbucketServerRepo struct {
Slug string `json:"slug"`
Name string `json:"name"`
Project struct {
Key string `json:"key"`
} `json:"project"`
}
BitbucketServerRepo represents a repository from Bitbucket Server API
type BitbucketServerRepoResponse ¶
type BitbucketServerRepoResponse struct {
Values []BitbucketServerRepo `json:"values"`
IsLastPage bool `json:"isLastPage"`
NextPageStart int `json:"nextPageStart"`
}
BitbucketServerRepoResponse represents the paginated response from Server
type BitbucketUser ¶
type BitbucketUser struct {
Username string `json:"username"`
DisplayName string `json:"display_name"`
}
BitbucketUser represents a user from the Bitbucket API
type Connector ¶
type Connector interface {
// ListRepos returns all repos for the configured user/org
ListRepos(ctx context.Context, userOrOrg string) ([]string, error)
// TestConnection verifies the token works
TestConnection(ctx context.Context) error
// Name returns the connector type name
Name() string
}
Connector interface for Git providers
type ConnectorType ¶
type ConnectorType string
ConnectorType represents the type of Git provider
const ( ConnectorGitHub ConnectorType = "github" ConnectorGitea ConnectorType = "gitea" ConnectorBitbucket ConnectorType = "bitbucket" )
func DetectType ¶
func DetectType(host string) ConnectorType
DetectType auto-detects connector type from host
type GitHubConnector ¶
type GitHubConnector struct {
// contains filtered or unexported fields
}
GitHubConnector implements the Connector interface for GitHub
func NewGitHubConnector ¶
func NewGitHubConnector(host, token string) *GitHubConnector
NewGitHubConnector creates a new GitHub connector
func (*GitHubConnector) Name ¶
func (g *GitHubConnector) Name() string
Name returns the connector name
func (*GitHubConnector) TestConnection ¶
func (g *GitHubConnector) TestConnection(ctx context.Context) error
TestConnection verifies the token works
type GitHubRepo ¶
type GitHubRepo struct {
FullName string `json:"full_name"`
Archived bool `json:"archived"`
Disabled bool `json:"disabled"`
}
GitHubRepo represents a repository from the GitHub API
type GitHubUser ¶
type GitHubUser struct {
Login string `json:"login"`
Type string `json:"type"` // "User" or "Organization"
}
GitHubUser represents a user from the GitHub API
type GiteaConnector ¶
type GiteaConnector struct {
// contains filtered or unexported fields
}
GiteaConnector implements the Connector interface for Gitea
func NewGiteaConnector ¶
func NewGiteaConnector(host, token string) *GiteaConnector
NewGiteaConnector creates a new Gitea connector
func (*GiteaConnector) Name ¶
func (g *GiteaConnector) Name() string
Name returns the connector name
func (*GiteaConnector) TestConnection ¶
func (g *GiteaConnector) TestConnection(ctx context.Context) error
TestConnection verifies the token works
func (*GiteaConnector) TokenGenerationURL ¶
func (g *GiteaConnector) TokenGenerationURL() string
TokenGenerationURL returns the URL where users can generate tokens
type GiteaOrg ¶
type GiteaOrg struct {
ID int `json:"id"`
}
GiteaOrg represents an organization check response