hosting_service

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostingServiceMgr

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

func NewHostingServiceMgr

func NewHostingServiceMgr(log logrus.FieldLogger, tr *i18n.TranslationSet, remoteURL string, configServiceDomains map[string]string) *HostingServiceMgr

NewHostingServiceMgr creates new instance of PullRequest

func (*HostingServiceMgr) GetCommitURL

func (self *HostingServiceMgr) GetCommitURL(commitHash string) (string, error)

func (*HostingServiceMgr) GetPullRequestURL

func (self *HostingServiceMgr) GetPullRequestURL(from string, to string) (string, error)

func (*HostingServiceMgr) GetRepoName added in v0.61.0

func (self *HostingServiceMgr) GetRepoName() (string, error)

e.g. 'jesseduffield/lazygit'

func (*HostingServiceMgr) GetServiceInfo added in v0.62.0

func (self *HostingServiceMgr) GetServiceInfo() (ServiceInfo, error)

GetServiceInfo identifies which hosting service the configured remote URL belongs to and returns enough information to talk to its web/API host.

type RepoInformation

type RepoInformation struct {
	Owner      string
	Repository string
}

RepoInformation holds the owner and repository name parsed from a remote URL.

func GetRepoInfoFromURL added in v0.61.0

func GetRepoInfoFromURL(url string) (RepoInformation, error)

GetRepoInfoFromURL parses a remote URL (SSH or HTTPS) and extracts the owner and repository name using the default URL regex patterns.

type Service

type Service struct {
	ServiceDefinition
	// contains filtered or unexported fields
}

type ServiceDefinition

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

type ServiceDomain

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

a service domains pairs a service definition with the actual domain it's being served from. Sometimes the git service is hosted in a custom domains so although it'll use say the github service definition, it'll actually be served from e.g. my-custom-github.com

type ServiceInfo added in v0.62.0

type ServiceInfo struct {
	Provider   string // e.g. "github"
	WebDomain  string // e.g. "github.com", or "git.acme.com" for an on-prem instance
	Owner      string // e.g. "jesseduffield"
	Repository string // e.g. "lazygit"
	RepoName   string // e.g. "jesseduffield/lazygit"
}

ServiceInfo holds the resolved hosting service for a remote URL. Owner comes from the "owner" named regex capture, which only exists for owner/repo-shaped providers (github, gitlab, bitbucket, gitea, codeberg); it's empty for azuredevops and bitbucketServer, whose URLs are organised differently. Repository is populated for every provider, but RepoName may have more than two segments (e.g. "org/project/repo" for azuredevops).

Jump to

Keyboard shortcuts

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