β„Ή
Info

Get info

This method retrieves information about the Jira Service Management instance such as software version, builds, and related links.
1
ppackage main
2
​
3
import (
4
"context"
5
"github.com/ctreminiom/go-atlassian/jira/sm"
6
"log"
7
"os"
8
)
9
​
10
func main() {
11
​
12
var (
13
host = os.Getenv("HOST")
14
mail = os.Getenv("MAIL")
15
token = os.Getenv("TOKEN")
16
)
17
​
18
atlassian, err := sm.New(nil, host)
19
if err != nil {
20
return
21
}
22
​
23
atlassian.Auth.SetBasicAuth(mail, token)
24
atlassian.Auth.SetUserAgent("curl/7.54.0")
25
​
26
var (
27
28
displayName = "Example Customer 1"
29
)
30
​
31
newCustomer, response, err := atlassian.Customer.Create(context.Background(), email, displayName)
32
if err != nil {
33
if response != nil {
34
log.Println("Response HTTP Response", response.Bytes.String())
35
}
36
log.Fatal(err)
37
}
38
​
39
log.Println("Response HTTP Code", response.Code)
40
log.Println("HTTP Endpoint Used", response.Endpoint)
41
​
42
log.Println("The new customer has been created!!")
43
log.Println("-------------------------")
44
log.Println(newCustomer.Name)
45
log.Println(newCustomer.DisplayName)
46
log.Println(newCustomer.AccountID)
47
log.Println(newCustomer.EmailAddress)
48
log.Println(newCustomer.Links)
49
log.Println(newCustomer)
50
log.Println("-------------------------")
51
​
52
}
Copied!
πŸ§šβ€β™€οΈ Tips: You can extract the following struct tags
1
type InfoScheme struct {
2
Version string `json:"version,omitempty"`
3
PlatformVersion string `json:"platformVersion,omitempty"`
4
BuildDate *InfoBuildDataScheme `json:"buildDate,omitempty"`
5
BuildChangeSet string `json:"buildChangeSet,omitempty"`
6
IsLicensedForUse bool `json:"isLicensedForUse,omitempty"`
7
Links *InfoLinkScheme `json:"_links,omitempty"`
8
}
9
​
10
type InfoBuildDataScheme struct {
11
Iso8601 string `json:"iso8601,omitempty"`
12
Jira string `json:"jira,omitempty"`
13
Friendly string `json:"friendly,omitempty"`
14
EpochMillis int64 `json:"epochMillis,omitempty"`
15
}
Copied!
Export as PDF
Copy link