interfaces.go

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