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// Instantiate a new bridge for a repo, from the combined target and name contained
23// in the full name
24func NewBridgeFromFullName(repo *cache.RepoCache, fullName string) (*core.Bridge, error) {
25 return core.NewBridgeFromFullName(repo, fullName)
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 RemoveBridges(repo repository.RepoCommon, fullName string) error {
42 return core.RemoveBridge(repo, fullName)
43}