mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-08-06 22:13:02 +02:00
✨ Add: Organization Webhook API [HX-822] (#11)
✨ Add: Organization Webhook API
This commit is contained in:
40
examples/test-working/main.go
Normal file
40
examples/test-working/main.go
Normal file
@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
jira "github.com/interviewstreet/go-jira"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
jiraURL := ""
|
||||
username := ""
|
||||
token := ""
|
||||
|
||||
tp := jira.BasicAuthTransport{
|
||||
Username: username,
|
||||
Password: token,
|
||||
}
|
||||
|
||||
client, err := jira.NewClient(tp.Client(), strings.TrimSpace(jiraURL))
|
||||
if err != nil {
|
||||
fmt.Printf("\nerror: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
webhooks, _, err := client.Organization.GetWebhookList(ctx)
|
||||
|
||||
pretty, _ := json.MarshalIndent(webhooks, "", " ")
|
||||
fmt.Println(string(pretty))
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("\nerror: %v\n", err)
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user