Expose ViewTicket as per FindIssues

This allows external users of the API to retreive issue details, in the same
manner that FindIssues provides for lists of issues.
This commit is contained in:
Mike Pountney
2015-12-31 12:06:04 -08:00
parent a92a93b282
commit f349e25bb9
2 changed files with 11 additions and 3 deletions
+10
View File
@@ -368,6 +368,16 @@ func (c *Cli) SaveData(data interface{}) error {
return nil
}
func (c *Cli) ViewIssue(issue string) (interface{}, error) {
uri := fmt.Sprintf("%s/rest/api/2/issue/%s", c.endpoint, issue)
data, err := responseToJson(c.get(uri))
if err != nil {
return nil, err
} else {
return data, nil
}
}
func (c *Cli) FindIssues() (interface{}, error) {
var query string
var ok bool
+1 -3
View File
@@ -80,12 +80,10 @@ func (c *Cli) CmdList() error {
func (c *Cli) CmdView(issue string) error {
log.Debug("view called")
c.Browse(issue)
uri := fmt.Sprintf("%s/rest/api/2/issue/%s", c.endpoint, issue)
data, err := responseToJson(c.get(uri))
data, err := c.ViewIssue(issue)
if err != nil {
return err
}
return runTemplate(c.getTemplate("view"), data, nil)
}