bbir

package
v0.0.0-...-649536f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnexpectedError = iota + 3
	BacklogAPIRequestError
	FileOpenError
	FileReadError
	ValidationIssueError
	RegistrationIssueError
)
View Source
const DateLayout = "2006-01-02"
View Source
const DefaultPriorityID = 3
View Source
const (
	Name = "bbir"
)
View Source
const Parallelism = 12

Variables

This section is empty.

Functions

func FmtVersion

func FmtVersion() string

Types

type BacklogAPIClient

type BacklogAPIClient interface {
	AddIssue(ctx context.Context, projectID ProjectID, summary string, issueTypeID IssueTypeID, priorityID PriorityID, opt *v2.AddIssueOptions) (*v2.Issue, error)
	GetIssue(ctx context.Context, issueKey string) (*v2.Issue, error)
	GetProject(ctx context.Context, projectKey string) (*v2.Project, error)
	GetProjectUsers(ctx context.Context, id ProjectID) ([]*v2.User, error)
	GetIssueTypes(ctx context.Context, id ProjectID) ([]*v2.IssueType, error)
	GetCategories(ctx context.Context, id ProjectID) ([]*v2.Category, error)
	GetVersions(ctx context.Context, id ProjectID) ([]*v2.Version, error)
	GetCustomFields(ctx context.Context, id ProjectID) ([]*v2.CustomField, error)
	GetPriorities(ctx context.Context) ([]*v2.Priority, error)
}

func NewBacklogAPIClient

func NewBacklogAPIClient(cfg *Config) BacklogAPIClient

type BulkCommandExecutor

type BulkCommandExecutor struct {
	// contains filtered or unexported fields
}

func NewBulkCommandExecutor

func NewBulkCommandExecutor(issue IssueRepository, msgs Messages) *BulkCommandExecutor

func (BulkCommandExecutor) Do

func (c BulkCommandExecutor) Do(commands []*Command, callbacks ...Callback) error

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

func NewCLI

func NewCLI() *CLI

func (*CLI) Run

func (cli *CLI) Run(argv []string) error

type CSVReader

type CSVReader struct {
	*csv.Reader
}

func NewCSVReader

func NewCSVReader(r io.Reader) *CSVReader

func (*CSVReader) ReadAll

func (r *CSVReader) ReadAll() (size int, lines []*Line, err error)

type Callback

type Callback func(*CallbackOptions)

func After

func After(f func()) Callback

func Before

func Before(f func()) Callback

func CreateProgressCallbacks

func CreateProgressCallbacks(total int, tag string) []Callback

func Each

func Each(f func()) Callback

type CallbackOptions

type CallbackOptions struct {
	Each   func()
	Before func()
	After  func()
}

func NewDefaultCallbackOptions

func NewDefaultCallbackOptions() *CallbackOptions

type CategoryID

type CategoryID int

func NewCategoryIDPtr

func NewCategoryIDPtr(v int) *CategoryID

type Command

type Command struct {
	Line                       int
	ProjectID                  ProjectID
	Summary                    string
	IssueTypeID                IssueTypeID
	PriorityID                 PriorityID
	Description                string
	StartDate                  string
	DueDate                    string
	EstimatedHours             *float64
	ActualHours                *float64
	CategoryID                 *CategoryID
	VersionID                  *VersionID
	MilestoneID                *VersionID
	AssigneeID                 *UserID
	ParentIssueID              *IssueID
	CustomFields               map[CustomFieldID]interface{}
	Children                   []*Command
	HasUnregisteredParentIssue bool
}

func (*Command) AddChild

func (cmd *Command) AddChild(child *Command)

func (*Command) ToAddIssueOptions

func (cmd *Command) ToAddIssueOptions() *v2.AddIssueOptions

type CommandBuilder

type CommandBuilder interface {
	Build(int, *Line) (*Command, error)
}

func NewCommandBuilder

func NewCommandBuilder(issue IssueRepository, project ProjectRepository, msgs Messages) CommandBuilder

type CommandConverter

type CommandConverter struct {
	// contains filtered or unexported fields
}

func NewCommandConverter

func NewCommandConverter(builder CommandBuilder, message Messages) *CommandConverter

func (*CommandConverter) Convert

func (c *CommandConverter) Convert(lines []*Line, callbacks ...Callback) ([]*Command, error)

type Config

type Config struct {
	SpaceDomain string
	ProjectKey  string
	APIKey      string
	File        string
	Lang        Lang
	Progress    bool
	Check       bool
}

func NewConfig

func NewConfig(c *cli.Context) *Config

func (*Config) HasFile

func (c *Config) HasFile() bool

type CustomFieldID

type CustomFieldID int

type English

type English struct {
}

func (*English) ActualHoursHoursIsInvalid

func (m *English) ActualHoursHoursIsInvalid(hours string) string

func (*English) AssigneeIsNotJoining

func (m *English) AssigneeIsNotJoining(name string) string

func (*English) CanNotOpenFile

func (m *English) CanNotOpenFile(path string) string

func (*English) CanNotReadFile

func (m *English) CanNotReadFile(path string, err error) string

func (*English) CategoryIsNotRegistered

func (m *English) CategoryIsNotRegistered(name string) string

func (*English) CustomFieldChoiceIsNotRegistered

func (m *English) CustomFieldChoiceIsNotRegistered(name string, choice string) string

func (*English) CustomFieldIsNotRegistered

func (m *English) CustomFieldIsNotRegistered(name string) string

func (*English) CustomFieldValueShouldBeTypeDate

func (m *English) CustomFieldValueShouldBeTypeDate(name, value string) string

func (*English) CustomFieldValueShouldBeTypeInt

func (m *English) CustomFieldValueShouldBeTypeInt(name, value string) string

func (*English) DueDateIsInvalid

func (m *English) DueDateIsInvalid(date string) string

func (*English) EstimatedHoursIsInvalid

func (m *English) EstimatedHoursIsInvalid(hours string) string

func (*English) FailedToCallBacklogAPI

func (m *English) FailedToCallBacklogAPI(err error) string

func (*English) IssueTypeIsNotRegistered

func (m *English) IssueTypeIsNotRegistered(name string) string

func (*English) IssueTypeIsRequired

func (m *English) IssueTypeIsRequired() string

func (*English) Line

func (m *English) Line(lineNumber int) string

func (*English) MilestoneIsNotRegistered

func (m *English) MilestoneIsNotRegistered(name string) string

func (*English) ParentIssueAlreadyRegisteredAsChildIssue

func (m *English) ParentIssueAlreadyRegisteredAsChildIssue(issueIDOrKey interface{}) string

func (*English) ParentIssueIsNotRegistered

func (m *English) ParentIssueIsNotRegistered(issueKey string) string

func (*English) PriorityIsInvalid

func (m *English) PriorityIsInvalid(name string) string

func (*English) PriorityIsRequired

func (m *English) PriorityIsRequired() string

func (*English) StartDateIsAfterDueDate

func (m *English) StartDateIsAfterDueDate(start, due string) string

func (*English) StartDateIsInvalid

func (m *English) StartDateIsInvalid(date string) string

func (*English) SummaryIsRequired

func (m *English) SummaryIsRequired() string

func (*English) TagOfRegistrationProgressBar

func (m *English) TagOfRegistrationProgressBar() string

func (*English) TagOfValidationProgressBar

func (m *English) TagOfValidationProgressBar() string

func (*English) VersionIsNotRegistered

func (m *English) VersionIsNotRegistered(name string) string

type IssueHTTPClient

type IssueHTTPClient struct {
	// contains filtered or unexported fields
}

func (*IssueHTTPClient) AddIssue

func (s *IssueHTTPClient) AddIssue(ctx context.Context, projectID ProjectID, summary string, issueTypeID IssueTypeID, priorityID PriorityID, opt *v2.AddIssueOptions) (*v2.Issue, error)

func (*IssueHTTPClient) FindIssueByKey

func (s *IssueHTTPClient) FindIssueByKey(ctx context.Context, issueKey string) (*v2.Issue, error)

type IssueID

type IssueID int

func NewIssueIDPtr

func NewIssueIDPtr(v int) *IssueID

type IssueRepository

type IssueRepository interface {
	FindIssueByKey(ctx context.Context, issueKey string) (*v2.Issue, error)
	AddIssue(ctx context.Context, projectID ProjectID, summary string, issueTypeID IssueTypeID, priorityID PriorityID, opt *v2.AddIssueOptions) (*v2.Issue, error)
}

func NewIssueHTTPClient

func NewIssueHTTPClient(client BacklogAPIClient) IssueRepository

type IssueTypeID

type IssueTypeID int

type Japanese

type Japanese struct {
}

func (*Japanese) ActualHoursHoursIsInvalid

func (m *Japanese) ActualHoursHoursIsInvalid(hours string) string

func (*Japanese) AssigneeIsNotJoining

func (m *Japanese) AssigneeIsNotJoining(name string) string

func (*Japanese) CanNotOpenFile

func (m *Japanese) CanNotOpenFile(path string) string

func (*Japanese) CanNotReadFile

func (m *Japanese) CanNotReadFile(path string, err error) string

func (*Japanese) CategoryIsNotRegistered

func (m *Japanese) CategoryIsNotRegistered(name string) string

func (*Japanese) CustomFieldChoiceIsNotRegistered

func (m *Japanese) CustomFieldChoiceIsNotRegistered(name string, choice string) string

func (*Japanese) CustomFieldIsNotRegistered

func (m *Japanese) CustomFieldIsNotRegistered(name string) string

func (*Japanese) CustomFieldValueShouldBeTypeDate

func (m *Japanese) CustomFieldValueShouldBeTypeDate(name, value string) string

func (*Japanese) CustomFieldValueShouldBeTypeInt

func (m *Japanese) CustomFieldValueShouldBeTypeInt(name, value string) string

func (*Japanese) DueDateIsInvalid

func (m *Japanese) DueDateIsInvalid(date string) string

func (*Japanese) EstimatedHoursIsInvalid

func (m *Japanese) EstimatedHoursIsInvalid(hours string) string

func (*Japanese) FailedToCallBacklogAPI

func (m *Japanese) FailedToCallBacklogAPI(err error) string

func (*Japanese) IssueTypeIsNotRegistered

func (m *Japanese) IssueTypeIsNotRegistered(name string) string

func (*Japanese) IssueTypeIsRequired

func (m *Japanese) IssueTypeIsRequired() string

func (*Japanese) Line

func (m *Japanese) Line(lineNumber int) string

func (*Japanese) MilestoneIsNotRegistered

func (m *Japanese) MilestoneIsNotRegistered(name string) string

func (*Japanese) ParentIssueAlreadyRegisteredAsChildIssue

func (m *Japanese) ParentIssueAlreadyRegisteredAsChildIssue(issueIDOrKey interface{}) string

func (*Japanese) ParentIssueIsNotRegistered

func (m *Japanese) ParentIssueIsNotRegistered(issueKey string) string

func (*Japanese) PriorityIsInvalid

func (m *Japanese) PriorityIsInvalid(name string) string

func (*Japanese) PriorityIsRequired

func (m *Japanese) PriorityIsRequired() string

func (*Japanese) StartDateIsAfterDueDate

func (m *Japanese) StartDateIsAfterDueDate(start, due string) string

func (*Japanese) StartDateIsInvalid

func (m *Japanese) StartDateIsInvalid(date string) string

func (*Japanese) SummaryIsRequired

func (m *Japanese) SummaryIsRequired() string

func (*Japanese) TagOfRegistrationProgressBar

func (m *Japanese) TagOfRegistrationProgressBar() string

func (*Japanese) TagOfValidationProgressBar

func (m *Japanese) TagOfValidationProgressBar() string

func (*Japanese) VersionIsNotRegistered

func (m *Japanese) VersionIsNotRegistered(name string) string

type Lang

type Lang string
const (
	Ja Lang = "ja"
	En Lang = "en"
)

func (Lang) Value

func (l Lang) Value() string

type Line

type Line struct {
	Summary        string
	Description    string
	StartDate      string
	DueDate        string
	EstimatedHours string
	ActualHours    string
	IssueType      string
	Category       string
	Version        string
	Milestone      string
	Priority       string
	Assignee       string
	ParentIssue    string
	CustomFields   map[string]string
}

func NewLine

func NewLine(header []string, record []string) *Line

type Messages

type Messages interface {
	CanNotOpenFile(path string) string
	CanNotReadFile(path string, err error) string
	SummaryIsRequired() string
	IssueTypeIsRequired() string
	IssueTypeIsNotRegistered(name string) string
	PriorityIsRequired() string
	PriorityIsInvalid(name string) string
	StartDateIsInvalid(date string) string
	DueDateIsInvalid(date string) string
	StartDateIsAfterDueDate(start, due string) string
	EstimatedHoursIsInvalid(hours string) string
	ActualHoursHoursIsInvalid(hours string) string
	CategoryIsNotRegistered(name string) string
	VersionIsNotRegistered(name string) string
	MilestoneIsNotRegistered(name string) string
	AssigneeIsNotJoining(name string) string
	ParentIssueIsNotRegistered(issueKey string) string
	ParentIssueAlreadyRegisteredAsChildIssue(issueIDOrKey interface{}) string

	FailedToCallBacklogAPI(error) string

	Line(int) string
	TagOfValidationProgressBar() string
	TagOfRegistrationProgressBar() string

	CustomFieldIsNotRegistered(name string) string
	CustomFieldValueShouldBeTypeInt(name, value string) string
	CustomFieldValueShouldBeTypeDate(name, value string) string
	CustomFieldChoiceIsNotRegistered(name string, choice string) string
}

func NewEnglish

func NewEnglish() Messages

func NewJapanese

func NewJapanese() Messages

type Module

type Module interface {
	GetMessages() Messages
	GetCommandConverter() *CommandConverter
	GetBulkCommandExecutor() *BulkCommandExecutor
	GetProjectRepository() ProjectRepository
}

func NewModule

func NewModule(cfg *Config) (Module, error)

type MultipleErrors

type MultipleErrors struct {
	// contains filtered or unexported fields
}

func NewMultipleErrors

func NewMultipleErrors(errs []error) *MultipleErrors

func (MultipleErrors) Error

func (e MultipleErrors) Error() string

type MultipleErrorsMap

type MultipleErrorsMap struct {
	// contains filtered or unexported fields
}

func NewMultipleErrorsMap

func NewMultipleErrorsMap(errsMap map[string]error) *MultipleErrorsMap

func (MultipleErrorsMap) Error

func (e MultipleErrorsMap) Error() string

type PriorityID

type PriorityID int

type ProjectHTTPClient

type ProjectHTTPClient struct {
	// contains filtered or unexported fields
}

func (*ProjectHTTPClient) FindCategoryByName

func (s *ProjectHTTPClient) FindCategoryByName(name string) *v2.Category

func (*ProjectHTTPClient) FindCustomFieldByName

func (s *ProjectHTTPClient) FindCustomFieldByName(name string) *v2.CustomField

func (*ProjectHTTPClient) FindIssueTypeByName

func (s *ProjectHTTPClient) FindIssueTypeByName(name string) *v2.IssueType

func (*ProjectHTTPClient) FindPriorityByName

func (s *ProjectHTTPClient) FindPriorityByName(name string) *v2.Priority

func (*ProjectHTTPClient) FindUserByName

func (s *ProjectHTTPClient) FindUserByName(name string) *v2.User

func (*ProjectHTTPClient) FindVersionByName

func (s *ProjectHTTPClient) FindVersionByName(name string) *v2.Version

func (*ProjectHTTPClient) GetProjectID

func (s *ProjectHTTPClient) GetProjectID() ProjectID

func (*ProjectHTTPClient) Prefetch

func (s *ProjectHTTPClient) Prefetch(ctx context.Context) error

type ProjectID

type ProjectID int

type ProjectRepository

type ProjectRepository interface {
	GetProjectID() ProjectID
	FindUserByName(name string) *v2.User
	FindIssueTypeByName(name string) *v2.IssueType
	FindCategoryByName(name string) *v2.Category
	FindVersionByName(name string) *v2.Version
	FindCustomFieldByName(name string) *v2.CustomField
	FindPriorityByName(name string) *v2.Priority
	Prefetch(ctx context.Context) error
}

func NewProjectHTTPClient

func NewProjectHTTPClient(cfg *Config, client BacklogAPIClient) ProjectRepository

type UserID

type UserID int

func NewUserIDPtr

func NewUserIDPtr(v int) *UserID

type VersionID

type VersionID int

func NewVersionIDPtr

func NewVersionIDPtr(v int) *VersionID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL