git-bug/bridge/bridges.go

43 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"
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)
}
2018-10-01 22:47:12 +03:00
// Instantiate a new bridge for a repo, from the combined target and name contained
// in the full name
2018-09-24 18:11:50 +03:00
func NewBridgeFullName(repo *cache.RepoCache, fullName string) (*core.Bridge, error) {
return core.NewBridgeFullName(repo, fullName)
}
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
2018-09-24 17:24:38 +03:00
func RemoveBridges(repo repository.RepoCommon, fullName string) error {
return core.RemoveBridge(repo, fullName)
}