forked from andygrunwald/go-jira
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
31 lines (25 loc) · 709 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"context"
"fmt"
jira "github.com/andygrunwald/go-jira/v2/cloud"
)
func main() {
jiraURL := "https://go-jira-opensource.atlassian.net/"
// Jira docs: https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
// Create a new API token: https://id.atlassian.com/manage-profile/security/api-tokens
tp := jira.BasicAuthTransport{
Username: "<username>",
APIToken: "<api-token>",
}
client, err := jira.NewClient(jiraURL, tp.Client())
if err != nil {
panic(err)
}
u, _, err := client.User.GetCurrentUser(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("Email: %v\n", u.EmailAddress)
fmt.Println("Success!")
}