1package core
2
3import (
4 "context"
5 "time"
6
7 "github.com/git-bug/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 // NewImporter return an Importer implementation if the import is supported
17 NewImporter() Importer
18
19 // NewExporter return an Exporter implementation if the export is supported
20 NewExporter() Exporter
21
22 // Configure handle the user interaction and return a key/value configuration
23 // for future use.
24 Configure(repo *cache.RepoCache, params BridgeParams, interactive bool) (Configuration, error)
25
26 // The set of the BridgeParams fields supported
27 ValidParams() map[string]interface{}
28
29 // ValidateConfig check the configuration for error
30 ValidateConfig(conf Configuration) error
31
32 // LoginMetaKey return the metadata key used to store the remote bug-tracker login
33 // on the user identity. The corresponding value is used to match identities and
34 // credentials.
35 LoginMetaKey() string
36}
37
38type Importer interface {
39 Init(ctx context.Context, 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(ctx context.Context, repo *cache.RepoCache, conf Configuration) error
45 ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
46}