bridges.go

 1// Package bridge contains the high-level public functions to use and manage bridges
 2package bridge
 3
 4import (
 5	"github.com/MichaelMure/git-bug/bridge/core"
 6	_ "github.com/MichaelMure/git-bug/bridge/github"
 7	"github.com/MichaelMure/git-bug/cache"
 8	"github.com/MichaelMure/git-bug/repository"
 9)
10
11// Targets return all known bridge implementation target
12func Targets() []string {
13	return core.Targets()
14}
15
16// Instantiate a new Bridge for a repo, from the given target and name
17func NewBridge(repo *cache.RepoCache, target string, name string) (*core.Bridge, error) {
18	return core.NewBridge(repo, target, name)
19}
20
21// Instantiate a new bridge for a repo, from the combined target and name contained
22// in the full name
23func NewBridgeFromFullName(repo *cache.RepoCache, fullName string) (*core.Bridge, error) {
24	return core.NewBridgeFromFullName(repo, fullName)
25}
26
27// Attempt to retrieve a default bridge for the given repo. If zero or multiple
28// bridge exist, it fails.
29func DefaultBridge(repo *cache.RepoCache) (*core.Bridge, error) {
30	return core.DefaultBridge(repo)
31}
32
33// ConfiguredBridges return the list of bridge that are configured for the given
34// repo
35func ConfiguredBridges(repo repository.RepoCommon) ([]string, error) {
36	return core.ConfiguredBridges(repo)
37}
38
39// Remove a configured bridge
40func RemoveBridges(repo repository.RepoCommon, fullName string) error {
41	return core.RemoveBridge(repo, fullName)
42}