connector

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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

func LoadCredentialsEnv(path string) error

LoadCredentialsEnv loads environment variables from a credentials file

func SaveCredential

func SaveCredential(path, key, value string) error

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

func (b *BitbucketConnector) ListRepos(ctx context.Context, workspace string) ([]string, error)

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

type BitbucketRepo struct {
	FullName  string `json:"full_name"`
	IsPrivate bool   `json:"is_private"`
}

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

func New

func New(connType ConnectorType, host string, token string) (Connector, error)

New creates a new connector based on type

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) ListRepos

func (g *GitHubConnector) ListRepos(ctx context.Context, userOrOrg string) ([]string, error)

ListRepos returns all repos for the configured user/org

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) ListRepos

func (g *GiteaConnector) ListRepos(ctx context.Context, userOrOrg string) ([]string, error)

ListRepos returns all repos for the configured user/org

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

type GiteaRepo

type GiteaRepo struct {
	FullName string `json:"full_name"`
	Archived bool   `json:"archived"`
	Empty    bool   `json:"empty"`
}

GiteaRepo represents a repository from the Gitea API

type GiteaUser

type GiteaUser struct {
	Login string `json:"login"`
}

GiteaUser represents a user from the Gitea API

Jump to

Keyboard shortcuts

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