git-bug/bridge/bridges.go

44 lines
1.4 KiB
Go
Raw Normal View History

2018-10-01 22:47:12 +03:00
// Package bridge contains the high-level public functions to use and manage bridges
package bridge
import (
"github.com/MichaelMure/git-bug/bridge/core"
2018-09-24 16:25:15 +03:00
_ "github.com/MichaelMure/git-bug/bridge/github"
2019-07-09 23:56:38 +03:00
_ "github.com/MichaelMure/git-bug/bridge/gitlab"
_ "github.com/MichaelMure/git-bug/bridge/launchpad"
2018-09-24 17:24:38 +03:00
"github.com/MichaelMure/git-bug/cache"
2018-09-24 16:25:15 +03:00
"github.com/MichaelMure/git-bug/repository"
)
2018-09-24 16:25:15 +03:00
// Targets return all known bridge implementation target
func Targets() []string {
return core.Targets()
}
2018-10-01 22:47:12 +03:00
// Instantiate a new Bridge for a repo, from the given target and name
2018-09-24 17:24:38 +03:00
func NewBridge(repo *cache.RepoCache, target string, name string) (*core.Bridge, error) {
return core.NewBridge(repo, target, name)
}
// LoadBridge instantiate a new bridge from a repo configuration
func LoadBridge(repo *cache.RepoCache, name string) (*core.Bridge, error) {
return core.LoadBridge(repo, name)
2018-09-24 18:11:50 +03:00
}
2018-10-01 22:47:12 +03:00
// Attempt to retrieve a default bridge for the given repo. If zero or multiple
// bridge exist, it fails.
2018-09-24 18:11:50 +03:00
func DefaultBridge(repo *cache.RepoCache) (*core.Bridge, error) {
return core.DefaultBridge(repo)
}
2018-10-01 22:47:12 +03:00
// ConfiguredBridges return the list of bridge that are configured for the given
// repo
2018-09-24 16:25:15 +03:00
func ConfiguredBridges(repo repository.RepoCommon) ([]string, error) {
return core.ConfiguredBridges(repo)
}
2018-09-24 17:24:38 +03:00
2018-10-01 22:47:12 +03:00
// Remove a configured bridge
2019-06-17 00:02:59 +03:00
func RemoveBridge(repo repository.RepoCommon, name string) error {
return core.RemoveBridge(repo, name)
2018-09-24 17:24:38 +03:00
}