
๐ฏWatcher
This resource represents users watching an issue. Use it to get details of users watching an issue as well as start and stop a user watching an issue.
Get issue watchers
package main
import (
"context"
"github.com/ctreminiom/go-atlassian/v2/jira/v2"
"log"
"os"
)
func main() {
/*
----------- Set an environment variable in git bash -----------
export HOST="https://ctreminiom.atlassian.net/"
export MAIL="MAIL_ADDRESS"
export TOKEN="TOKEN_API"
Docs: https://stackoverflow.com/questions/34169721/set-an-environment-variable-in-git-bash
*/
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
atlassian, err := v2.New(nil, host)
if err != nil {
log.Fatal(err)
}
atlassian.Auth.SetBasicAuth(mail, token)
watchers, response, err := atlassian.Issue.Watchers.Gets(context.Background(), "KP-2")
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Endpoint Used", response.Endpoint)
log.Println(watchers.IsWatching, watchers.WatchCount)
for _, watcher := range watchers.Watchers {
log.Println(watcher.Self, watcher.AccountID)
}
}Add watcher
Delete watcher
Get is watching issue bulk
Last updated
Was this helpful?