interfaces.go

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