service

package
v0.0.0-...-6b92c75 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintIssue

func PrintIssue(broker *Broker, writer *Writer, issueId int) error

func PrintIssues

func PrintIssues(broker *Broker, writer *Writer, projectName string, sprintName string) error

Types

type Broker

type Broker struct {
	Client Client
}

Broker is mediate between cli and redmine api

func (*Broker) GetIssue

func (b *Broker) GetIssue(issueID int) (*IssueResponse, error)

func (*Broker) GetIssues

func (b *Broker) GetIssues(projectName string, versionName string, query GetIssuesQuery) (*IssuesResponse, error)

type Client

type Client interface {
	Get(string, interface{}) error
}

Client is redmine client used by Broker

type GetIssuesQuery

type GetIssuesQuery struct {
	IssueId *int
}

type Issue

type Issue struct {
	ID      int `json:"id"`
	Project struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"project"`
	Tracker struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"tracker"`
	Status struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"status"`
	Priority struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"priority"`
	Author struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"author"`
	AssignedTo struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"assigned_to"`
	Category struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"category"`
	FixedVersion struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"fixed_version"`
	Subject        string    `json:"subject"`
	Description    string    `json:"description"`
	StartDate      string    `json:"start_date"`
	DoneRatio      int       `json:"done_ratio"`
	IsPrivate      bool      `json:"is_private"`
	EstimatedHours float64   `json:"estimated_hours"`
	CreatedOn      time.Time `json:"created_on"`
	UpdatedOn      time.Time `json:"updated_on"`
	ClosedOn       time.Time `json:"closed_on"`
	Children       []struct {
		ID      int `json:"id"`
		Tracker struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"tracker"`
		Subject string `json:"subject"`
	} `json:"children"`
}

type IssueResponse

type IssueResponse struct {
	Issue Issue `json:"issue"`
}

type IssuesResponse

type IssuesResponse struct {
	Issues     []Issue `json:"issues"`
	TotalCount int     `json:"total_count"`
	Offset     int     `json:"offset"`
	Limit      int     `json:"limit"`
}

type ProjectsResponse

type ProjectsResponse struct {
	Projects []struct {
		ID             int       `json:"id"`
		Name           string    `json:"name"`
		Identifier     string    `json:"identifier"`
		Description    string    `json:"description"`
		Status         int       `json:"status"`
		IsPublic       bool      `json:"is_public"`
		InheritMembers bool      `json:"inherit_members"`
		CreatedOn      time.Time `json:"created_on"`
		UpdatedOn      time.Time `json:"updated_on"`
	} `json:"projects"`
	TotalCount int `json:"total_count"`
	Offset     int `json:"offset"`
	Limit      int `json:"limit"`
}

type RESTClient

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

func NewClient

func NewClient(redmineURL string, apiKey string) *RESTClient

func (*RESTClient) Get

func (c *RESTClient) Get(path string, result interface{}) error

type VersionsResponse

type VersionsResponse struct {
	Versions []struct {
		ID      int `json:"id"`
		Project struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"project"`
		Name          string      `json:"name"`
		Description   string      `json:"description"`
		Status        string      `json:"status"`
		DueDate       interface{} `json:"due_date"`
		Sharing       string      `json:"sharing"`
		WikiPageTitle string      `json:"wiki_page_title"`
		CreatedOn     time.Time   `json:"created_on"`
		UpdatedOn     time.Time   `json:"updated_on"`
	} `json:"versions"`
	TotalCount int `json:"total_count"`
}

type Writer

type Writer struct {
	Out io.Writer
}

func (*Writer) PrintIssue

func (w *Writer) PrintIssue(issue Issue, children []Issue) error

func (*Writer) PrintIssues

func (w *Writer) PrintIssues(issues []Issue) error

Jump to

Keyboard shortcuts

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