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

Watchers cannot be added/updated (perhaps due to typo, i.e. watches instead of watchers) #340

Open
030 opened this issue Feb 2, 2021 · 3 comments
Labels
needs triage Ticket that needs triage (a proper look for classification)

Comments

@030
Copy link

030 commented Feb 2, 2021

Example

https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-watchers/#api-rest-api-2-issue-issueidorkey-watchers-post

curl --request POST \
  --url 'https://your-domain.atlassian.com/rest/api/2/issue/{issueIdOrKey}/watchers' \
  --user '[email protected]:<api_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '"<string>"'

related

#191 (comment)

@cfloody
Copy link

cfloody commented Jul 20, 2021

Here's a quick workaround that worked for me:

First, figure out the custom field ID for the Watchers field

var customFieldID string
fieldList, _, _ := client.Field.GetList()

for _, v := range fieldList {
        if v.Name == "Watchers" {
                customFieldID = v.ID
                break
        }
}

Then set the values for that custom field in the Unknowns map

i := jira.Issue{
        Fields: &jira.IssueFields{
                Unknowns: map[string]interface{}{
                        customFieldID: []*jira.Watcher{
                                {
                                        Name: "cfloody",
                                },
                        },
                },
                Description: description,
                Type: jira.IssueType{
                        Name: "Task",
                },
                Project: jira.Project{
                        Key: "Foo",
                },
                
                Summary: summary,
                Priority: &jira.Priority{
                        Name: "Low",
                },
        },
}

@030 030 closed this as completed Jul 21, 2021
@andygrunwald
Copy link
Owner

Hey @030, did this solve the initial request?
If yes, please let us know and it can be added to the example directory.

@andygrunwald andygrunwald reopened this Jul 21, 2021
@andygrunwald andygrunwald added the needs triage Ticket that needs triage (a proper look for classification) label Aug 20, 2022
@andygrunwald
Copy link
Owner

Hey,

I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489

The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your issue + you like to sponsor it, please contact me.

What does this mean for my issue?

We will work on this issue indirectly.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using this library.
If there is anything else you would like to tell us, let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Ticket that needs triage (a proper look for classification)
Projects
None yet
Development

No branches or pull requests

3 participants