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/bridge/gitlab"
 8	_ "github.com/MichaelMure/git-bug/bridge/launchpad"
 9	"github.com/MichaelMure/git-bug/cache"
10	"github.com/MichaelMure/git-bug/repository"
11)
12
13// Targets return all known bridge implementation target
14func Targets() []string {
15	return core.Targets()
16}
17
18// Instantiate a new Bridge for a repo, from the given target and name
19func NewBridge(repo *cache.RepoCache, target string, name string) (*core.Bridge, error) {
20	return core.NewBridge(repo, target, name)
21}
22
23// LoadBridge instantiate a new bridge from a repo configuration
24func LoadBridge(repo *cache.RepoCache, name string) (*core.Bridge, error) {
25	return core.LoadBridge(repo, name)
26}
27
28// Attempt to retrieve a default bridge for the given repo. If zero or multiple
29// bridge exist, it fails.
30func DefaultBridge(repo *cache.RepoCache) (*core.Bridge, error) {
31	return core.DefaultBridge(repo)
32}
33
34// ConfiguredBridges return the list of bridge that are configured for the given
35// repo
36func ConfiguredBridges(repo repository.RepoCommon) ([]string, error) {
37	return core.ConfiguredBridges(repo)
38}
39
40// Remove a configured bridge
41func RemoveBridge(repo repository.RepoCommon, name string) error {
42	return core.RemoveBridge(repo, name)
43}