-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 'vote' and 'unvote' #26
Conversation
This adds support for voting on issues via CmdVote() and CmdUnvote() Voting on issues is always done as the logged in user, it appears you can't case a vote for another user: https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addVote This required adding a cli.delete() handler, naturally with no content (as per RFC2616) This is ripe for DRY-ing out, but I will leave that for a future PR. Worth noting is that you cannot vote for your own issues, this results in: 2016-01-13T21:35:41.315Z ERROR [cli.go:184] response status: 404 Not Found 2016-01-13T21:35:41.315Z ERROR [commands.go:439] Unexpected Response From POST: {snip} {"errorMessages":["You cannot vote for an issue you have reported."],"errors":{}}
Looks good. In the interest of minimizing commands, perhaps we could minimize the usage to: jira vote ISSUE [--down] where vote Also I think you missed adding the command to the big usage text block. I can fix these issues post merge if you like. |
Sounds good - actually works better for me this way: the func defines how Similarly, looking at CmdWatch, there's no code to unwatch - which I need. Would you be up for me changing the spec of that to be:
... and push the population of 'watcher' up to main.go? This works better for my needs for https://github.com/mikepea/go-jira-ui -- On Thu, Jan 14, 2016 at 6:39 AM, coryb [email protected] wrote:
|
yeah, sounds good. I guess for CmdWatch we should change the last param to "add" (instead of "up"), so:
with usage:
Then we call with: -Cory |
Well, i guess the lass call should be something like: watcher := c.GetOptString("watcher", opts["user"].(string))
CmdWatch(args[0], watcher, opts["remove"].(bool)) or somethine, where GetOptsString looks for options and returns the second (default) arg if not present. Basically a getOrElse call. The routine already exists in the -Coy |
This simplifies the interface to voting, as per the discussion in go-jira#26 Basically, DRY out the logic into a single CmdVote function based around an 'up' bool. Similarly, make a single CLI command with an option to do the downvote.
Hey @coryb -- here's the |
This adjusts the CmdWatch interface as per discussion in go-jira#26 It also exposes public versions of the c.getOptString and c.getOptBool utility functions, again as discussed. The interface to CmdWatch now includes the user to be watched (rather than depending on the opt[] map. This makes CmdWatch more useful externally. A '--remove' option has been created, to allow for removal of a given watcher. This was deliberately not included in the defaults map, as it is specifically only used for 'watch' command right now. It should be moved up to a default if it becomes a more common option, I guess (as 'remove is false' isn't a bad default)
Looks great, thanks! |
This simplifies the interface to voting, as per the discussion in go-jira#26 Basically, DRY out the logic into a single CmdVote function based around an 'up' bool. Similarly, make a single CLI command with an option to do the downvote.
This adjusts the CmdWatch interface as per discussion in go-jira#26 It also exposes public versions of the c.getOptString and c.getOptBool utility functions, again as discussed. The interface to CmdWatch now includes the user to be watched (rather than depending on the opt[] map. This makes CmdWatch more useful externally. A '--remove' option has been created, to allow for removal of a given watcher. This was deliberately not included in the defaults map, as it is specifically only used for 'watch' command right now. It should be moved up to a default if it becomes a more common option, I guess (as 'remove is false' isn't a bad default)
Add 'vote' and 'unvote'
This adds support for voting on issues via CmdVote() and CmdUnvote()
Voting on issues is always done as the logged in user, it appears you
can't case a vote for another user:
https://docs.atlassian.com/jira/REST/latest/#api/2/issue-addVote
This required adding a cli.delete() handler, naturally with no content
(as per RFC2616)
This is ripe for DRY-ing out, but I will leave that for a future PR.
Worth noting is that you cannot vote for your own issues, this results in: