Skip to content
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

Support for removing a given watcher #30

Merged
merged 4 commits into from
Jan 24, 2016
Merged

Conversation

mikepea
Copy link
Collaborator

@mikepea mikepea commented Jan 24, 2016

As per discussion in #26 -- here is 'remove watcher' support, eg:

jira watch EXAMPLE-123 --watcher bob --remove

I've exposed GetOptString and GetOptBool in the same manner as before - leave the private function intact, just add a public wrapper.

I've mentioned in the commit, but I've expressly not included 'remove: false' as a default option, since at the moment this is specific to 'watch' command. Maybe if we find other reasons to add '--remove' we can promote it.

NOTE: this commit involves a breaking change to the CmdWatch contract, in that it now takes the watcher and whether to remove as arguments. I think i'm the only consumer of this as a library right now, so this is likely not a big problem.

Mike Pountney added 4 commits January 13, 2016 21:41
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":{}}
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)
@mikepea
Copy link
Collaborator Author

mikepea commented Jan 24, 2016

Oh, @coryb -- this is based off the vote_support PR in #26 (for DELETE support), so that will need to be merged first.

coryb added a commit that referenced this pull request Jan 24, 2016
Support for removing a given watcher
@coryb coryb merged commit cb67107 into go-jira:master Jan 24, 2016
@coryb
Copy link
Contributor

coryb commented Jan 24, 2016

Looks good, thanks again!
-Cory

pdericson pushed a commit to pdericson/go-jira that referenced this pull request Sep 14, 2017
Support for removing a given watcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants