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/launchpad"
8 "github.com/MichaelMure/git-bug/cache"
9 "github.com/MichaelMure/git-bug/repository"
10)
11
12// Targets return all known bridge implementation target
13func Targets() []string {
14 return core.Targets()
15}
16
17// Instantiate a new Bridge for a repo, from the given target and name
18func NewBridge(repo *cache.RepoCache, target string, name string) (*core.Bridge, error) {
19 return core.NewBridge(repo, target, name)
20}
21
22// LoadBridge instantiate a new bridge from a repo configuration
23func LoadBridge(repo *cache.RepoCache, name string) (*core.Bridge, error) {
24 return core.LoadBridge(repo, name)
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 RemoveBridge(repo repository.RepoCommon, name string) error {
41 return core.RemoveBridge(repo, name)
42}