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 da6cbd5021
commit 8977f3dd9b
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 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) { func (c *Cli) FindIssues() (interface{}, error) {
var query string var query string
var ok bool var ok bool
+1 -3
View File
@@ -80,12 +80,10 @@ func (c *Cli) CmdList() error {
func (c *Cli) CmdView(issue string) error { func (c *Cli) CmdView(issue string) error {
log.Debug("view called") log.Debug("view called")
c.Browse(issue) c.Browse(issue)
uri := fmt.Sprintf("%s/rest/api/2/issue/%s", c.endpoint, issue) data, err := c.ViewIssue(issue)
data, err := responseToJson(c.get(uri))
if err != nil { if err != nil {
return err return err
} }
return runTemplate(c.getTemplate("view"), data, nil) return runTemplate(c.getTemplate("view"), data, nil)
} }