Skip to content

Commit

Permalink
Expose ViewTicket as per FindIssues
Browse files Browse the repository at this point in the history
This allows external users of the API to retreive issue details, in the same
manner that FindIssues provides for lists of issues.
  • Loading branch information
Mike Pountney committed Dec 31, 2015
1 parent da6cbd5 commit 8977f3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 8977f3d

Please sign in to comment.