git-bug: github.com/MichaelMure/git-bug/bridge/core Index | Files | Directories

package core

import "github.com/MichaelMure/git-bug/bridge/core"

Package core contains the target-agnostic code to define and run a bridge

Index

Package Files

bridge.go config.go export.go import.go interfaces.go params.go

Constants

const (
    ConfigKeyTarget = "target"

    MetaKeyOrigin = "origin"
)

Variables

var ErrExportNotSupported = errors.New("export is not supported")
var ErrImportNotSupported = errors.New("import is not supported")

func BridgeExist Uses

func BridgeExist(repo repository.RepoConfig, name string) bool

Check if a bridge exist

func ConfiguredBridges Uses

func ConfiguredBridges(repo repository.RepoConfig) ([]string, error)

ConfiguredBridges return the list of bridge that are configured for the given repo

func FinishConfig Uses

func FinishConfig(repo *cache.RepoCache, metaKey string, login string) error

func LoginMetaKey Uses

func LoginMetaKey(target string) (string, error)

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.

func Register Uses

func Register(impl BridgeImpl)

Register will register a new BridgeImpl

func RemoveBridge Uses

func RemoveBridge(repo repository.RepoConfig, name string) error

Remove a configured bridge

func TargetExist Uses

func TargetExist(target string) bool

TargetExist return true if the given target has a bridge implementation

func Targets Uses

func Targets() []string

Targets return all known bridge implementation target

type Bridge Uses

type Bridge struct {
    Name string
    // contains filtered or unexported fields
}

Bridge is a wrapper around a BridgeImpl that will bind low-level implementation with utility code to provide high-level functions.

func DefaultBridge Uses

func DefaultBridge(repo *cache.RepoCache) (*Bridge, error)

Attempt to retrieve a default bridge for the given repo. If zero or multiple bridge exist, it fails.

func LoadBridge Uses

func LoadBridge(repo *cache.RepoCache, name string) (*Bridge, error)

LoadBridge instantiate a new bridge from a repo configuration

func NewBridge Uses

func NewBridge(repo *cache.RepoCache, target string, name string) (*Bridge, error)

Instantiate a new Bridge for a repo, from the given target and name

func (*Bridge) Configure Uses

func (b *Bridge) Configure(params BridgeParams) error

Configure run the target specific configuration process

func (*Bridge) ExportAll Uses

func (b *Bridge) ExportAll(ctx context.Context, since time.Time) (<-chan ExportResult, error)

func (*Bridge) ImportAll Uses

func (b *Bridge) ImportAll(ctx context.Context) (<-chan ImportResult, error)

func (*Bridge) ImportAllSince Uses

func (b *Bridge) ImportAllSince(ctx context.Context, since time.Time) (<-chan ImportResult, error)

type BridgeImpl Uses

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

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

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

    // Configure handle the user interaction and return a key/value configuration
    // for future use
    Configure(repo *cache.RepoCache, params BridgeParams) (Configuration, error)

    // The set of the BridgeParams fields supported
    ValidParams() map[string]interface{}

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

    // 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
}

type BridgeParams Uses

type BridgeParams struct {
    URL        string // complete URL of a repo               (Github, Gitlab,     , Launchpad)
    BaseURL    string // base URL for self-hosted instance    (        Gitlab, Jira,          )
    Login      string // username for the passed credential   (Github, Gitlab, Jira,          )
    CredPrefix string // ID prefix of the credential to use   (Github, Gitlab, Jira,          )
    TokenRaw   string // pre-existing token to use            (Github, Gitlab,     ,          )
    Owner      string // owner of the repo                    (Github,       ,     ,          )
    Project    string // name of the repo or project key      (Github,       , Jira, Launchpad)
}

BridgeParams holds parameters to simplify the bridge configuration without having to make terminal prompts.

type Configuration Uses

type Configuration map[string]string

type ExportEvent Uses

type ExportEvent int
const (

    // Bug has been exported on the remote tracker
    ExportEventBug ExportEvent
    // Comment has been exported on the remote tracker
    ExportEventComment
    // Comment has been edited on the remote tracker
    ExportEventCommentEdition
    // Bug's status has been changed on on the remote tracker
    ExportEventStatusChange
    // Bug's title has been changed on the remote tracker
    ExportEventTitleEdition
    // Bug's labels have been changed on the remote tracker
    ExportEventLabelChange

    // Nothing changed on the bug
    ExportEventNothing

    // Something wrong happened during export that is worth notifying to the user
    // but not severe enough to consider the export a failure.
    ExportEventWarning

    // Error happened during export
    ExportEventError
)

type ExportResult Uses

type ExportResult struct {
    Err    error
    Event  ExportEvent
    ID     entity.Id
    Reason string
}

ExportResult is an event that is emitted during the export process, to allow calling code to report on what is happening, collect metrics or display meaningful errors if something went wrong.

func NewExportBug Uses

func NewExportBug(id entity.Id) ExportResult

func NewExportComment Uses

func NewExportComment(id entity.Id) ExportResult

func NewExportCommentEdition Uses

func NewExportCommentEdition(id entity.Id) ExportResult

func NewExportError Uses

func NewExportError(err error, id entity.Id) ExportResult

func NewExportLabelChange Uses

func NewExportLabelChange(id entity.Id) ExportResult

func NewExportNothing Uses

func NewExportNothing(id entity.Id, reason string) ExportResult

func NewExportStatusChange Uses

func NewExportStatusChange(id entity.Id) ExportResult

func NewExportTitleEdition Uses

func NewExportTitleEdition(id entity.Id) ExportResult

func NewExportWarning Uses

func NewExportWarning(err error, id entity.Id) ExportResult

func (ExportResult) String Uses

func (er ExportResult) String() string

type Exporter Uses

type Exporter interface {
    Init(ctx context.Context, repo *cache.RepoCache, conf Configuration) error
    ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ExportResult, error)
}

type ImportEvent Uses

type ImportEvent int
const (

    // Bug has been created
    ImportEventBug ImportEvent
    // Comment has been created
    ImportEventComment
    // Comment has been edited
    ImportEventCommentEdition
    // Bug's status has changed
    ImportEventStatusChange
    // Bug's title has changed
    ImportEventTitleEdition
    // Bug's labels changed
    ImportEventLabelChange
    // Nothing happened on a Bug
    ImportEventNothing

    // Identity has been created
    ImportEventIdentity

    // Something wrong happened during import that is worth notifying to the user
    // but not severe enough to consider the import a failure.
    ImportEventWarning

    // Error happened during import
    ImportEventError
)

type ImportResult Uses

type ImportResult struct {
    Err    error
    Event  ImportEvent
    ID     entity.Id
    Reason string
}

ImportResult is an event that is emitted during the import process, to allow calling code to report on what is happening, collect metrics or display meaningful errors if something went wrong.

func NewImportBug Uses

func NewImportBug(id entity.Id) ImportResult

func NewImportComment Uses

func NewImportComment(id entity.Id) ImportResult

func NewImportCommentEdition Uses

func NewImportCommentEdition(id entity.Id) ImportResult

func NewImportError Uses

func NewImportError(err error, id entity.Id) ImportResult

func NewImportIdentity Uses

func NewImportIdentity(id entity.Id) ImportResult

func NewImportLabelChange Uses

func NewImportLabelChange(id entity.Id) ImportResult

func NewImportNothing Uses

func NewImportNothing(id entity.Id, reason string) ImportResult

func NewImportStatusChange Uses

func NewImportStatusChange(id entity.Id) ImportResult

func NewImportTitleEdition Uses

func NewImportTitleEdition(id entity.Id) ImportResult

func NewImportWarning Uses

func NewImportWarning(err error, id entity.Id) ImportResult

func (ImportResult) String Uses

func (er ImportResult) String() string

type Importer Uses

type Importer interface {
    Init(ctx context.Context, repo *cache.RepoCache, conf Configuration) error
    ImportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan ImportResult, error)
}

Directories

PathSynopsis
auth

Package core imports 13 packages (graph) and is imported by 10 packages. Updated 2020-04-22. Refresh now. Tools for package owners.