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	// The set of the BridgeParams fields supported
22	ValidParams() map[string]interface{}
23
24	// Configure handle the user interaction and return a key/value configuration
25	// for future use
26	Configure(repo *cache.RepoCache, params BridgeParams) (Configuration, error)
27
28	// ValidateConfig check the configuration for error
29	ValidateConfig(conf Configuration) error
30
31	// NewImporter return an Importer implementation if the import is supported
32	NewImporter() Importer
33
34	// NewExporter return an Exporter implementation if the export is supported
35	NewExporter() Exporter
36}
37
38type Importer interface {
39	Init(repo *cache.RepoCache, conf Configuration) error
40	ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error)
41}
42
43type Exporter interface {
44	Init(repo *cache.RepoCache, conf Configuration) error
45	ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
46}