aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/core/interfaces.go
blob: 79b75606facd62fe274b50a8ade2cf6809c5c843 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package core

import (
	"github.com/MichaelMure/git-bug/cache"
	"github.com/MichaelMure/git-bug/repository"
)

type Configuration map[string]string

type BridgeImpl interface {
	// Target return the target of the bridge (e.g.: "github")
	Target() string

	// Configure handle the user interaction and return a key/value configuration
	// for future use
	Configure(repo repository.RepoCommon) (Configuration, error)

	// ValidateConfig check the configuration for error
	ValidateConfig(conf Configuration) error

	// Importer return an Importer implementation if the import is supported
	Importer() Importer

	// Exporter return an Exporter implementation if the export is supported
	Exporter() Exporter
}

type Importer interface {
	ImportAll(repo *cache.RepoCache, conf Configuration) error
	Import(repo *cache.RepoCache, conf Configuration, id string) error
}

type Exporter interface {
	ExportAll(repo *cache.RepoCache, conf Configuration) error
	Export(repo *cache.RepoCache, conf Configuration, id string) error
}