interfaces.go

 1package core
 2
 3import (
 4	"github.com/MichaelMure/git-bug/cache"
 5	"github.com/MichaelMure/git-bug/repository"
 6)
 7
 8type Configuration map[string]string
 9
10type BridgeImpl interface {
11	// Target return the target of the bridge (e.g.: "github")
12	Target() string
13
14	// Configure handle the user interaction and return a key/value configuration
15	// for future use
16	Configure(repo repository.RepoCommon) (Configuration, error)
17
18	// ValidateConfig check the configuration for error
19	ValidateConfig(conf Configuration) error
20
21	// Importer return an Importer implementation if the import is supported
22	Importer() Importer
23
24	// Exporter return an Exporter implementation if the export is supported
25	Exporter() Exporter
26}
27
28type Importer interface {
29	ImportAll(repo *cache.RepoCache, conf Configuration) error
30	Import(repo *cache.RepoCache, conf Configuration, id string) error
31}
32
33type Exporter interface {
34	ExportAll(repo *cache.RepoCache, conf Configuration) error
35	Export(repo *cache.RepoCache, conf Configuration, id string) error
36}