-
-
Notifications
You must be signed in to change notification settings - Fork 500
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (24 loc) · 598 Bytes
/
main.go
File metadata and controls
30 lines (24 loc) · 598 Bytes
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
package main
import (
"context"
"fmt"
jira "github.com/andygrunwald/go-jira/v2/onpremise"
)
func main() {
jiraURL := "<your-jira-instance>"
// See "Using Personal Access Tokens"
// https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html
tp := jira.BearerAuthTransport{
Token: "<persona-access-token>",
}
client, err := jira.NewClient(jiraURL, tp.Client())
if err != nil {
panic(err)
}
u, _, err := client.User.GetSelf(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("Email: %v\n", u.EmailAddress)
fmt.Println("Success!")
}