2018-09-21 19:23:46 +03:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2019-08-13 20:51:14 +03:00
|
|
|
"context"
|
2019-05-03 01:02:50 +03:00
|
|
|
"time"
|
|
|
|
|
2018-09-21 19:23:46 +03:00
|
|
|
"github.com/MichaelMure/git-bug/cache"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Configuration map[string]string
|
|
|
|
|
|
|
|
type BridgeImpl interface {
|
2018-09-24 16:25:15 +03:00
|
|
|
// Target return the target of the bridge (e.g.: "github")
|
|
|
|
Target() string
|
2018-09-21 19:23:46 +03:00
|
|
|
|
2020-02-05 00:05:34 +03:00
|
|
|
// LoginMetaKey return the metadata key used to store the remote bug-tracker login
|
|
|
|
// on the user identity. The corresponding value is used to match identities and
|
|
|
|
// credentials.
|
|
|
|
LoginMetaKey() string
|
|
|
|
|
2020-02-15 04:55:19 +03:00
|
|
|
// The set of the BridgeParams fields supported
|
|
|
|
ValidParams() map[string]interface{}
|
|
|
|
|
2018-09-21 19:23:46 +03:00
|
|
|
// Configure handle the user interaction and return a key/value configuration
|
|
|
|
// for future use
|
2019-12-08 23:15:06 +03:00
|
|
|
Configure(repo *cache.RepoCache, params BridgeParams) (Configuration, error)
|
2018-09-21 19:23:46 +03:00
|
|
|
|
2018-09-24 18:21:24 +03:00
|
|
|
// ValidateConfig check the configuration for error
|
|
|
|
ValidateConfig(conf Configuration) error
|
|
|
|
|
2018-10-06 12:55:16 +03:00
|
|
|
// NewImporter return an Importer implementation if the import is supported
|
|
|
|
NewImporter() Importer
|
2018-09-24 16:25:15 +03:00
|
|
|
|
2018-10-06 12:55:16 +03:00
|
|
|
// NewExporter return an Exporter implementation if the export is supported
|
|
|
|
NewExporter() Exporter
|
2018-09-21 19:23:46 +03:00
|
|
|
}
|
2018-09-24 16:25:15 +03:00
|
|
|
|
|
|
|
type Importer interface {
|
2019-12-08 23:15:06 +03:00
|
|
|
Init(repo *cache.RepoCache, conf Configuration) error
|
2019-08-13 20:51:14 +03:00
|
|
|
ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error)
|
2018-09-24 16:25:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type Exporter interface {
|
2019-12-08 23:15:06 +03:00
|
|
|
Init(repo *cache.RepoCache, conf Configuration) error
|
2019-08-13 20:51:14 +03:00
|
|
|
ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
|
2018-09-24 16:25:15 +03:00
|
|
|
}
|