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	// NewImporter return an Importer implementation if the import is supported
22	NewImporter() Importer
23
24	// NewExporter return an Exporter implementation if the export is supported
25	NewExporter() Exporter
26}
27
28type Importer interface {
29	Init(conf Configuration) error
30	ImportAll(repo *cache.RepoCache) error
31	Import(repo *cache.RepoCache, id string) error
32}
33
34type Exporter interface {
35	Init(conf Configuration) error
36	ExportAll(repo *cache.RepoCache) error
37	Export(repo *cache.RepoCache, id string) error
38}