โ„น
Info
go-atlassian/sm_info.go at main ยท ctreminiom/go-atlassian
GitHub
SM Info Models

Get info

This method retrieves information about the Jira Service Management instance such as software version, builds, and related links.
ppackage main
โ€‹
import (
"context"
"github.com/ctreminiom/go-atlassian/jira/sm"
"log"
"os"
)
โ€‹
func main() {
โ€‹
var (
host = os.Getenv("HOST")
mail = os.Getenv("MAIL")
token = os.Getenv("TOKEN")
)
โ€‹
atlassian, err := sm.New(nil, host)
if err != nil {
return
}
โ€‹
atlassian.Auth.SetBasicAuth(mail, token)
atlassian.Auth.SetUserAgent("curl/7.54.0")
โ€‹
var (
displayName = "Example Customer 1"
)
โ€‹
newCustomer, response, err := atlassian.Customer.Create(context.Background(), email, displayName)
if err != nil {
if response != nil {
log.Println("Response HTTP Response", response.Bytes.String())
}
log.Fatal(err)
}
โ€‹
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
โ€‹
log.Println("The new customer has been created!!")
log.Println("-------------------------")
log.Println(newCustomer.Name)
log.Println(newCustomer.DisplayName)
log.Println(newCustomer.AccountID)
log.Println(newCustomer.EmailAddress)
log.Println(newCustomer.Links)
log.Println(newCustomer)
log.Println("-------------------------")
โ€‹
}
๐Ÿงšโ€โ™€๏ธ Tips: You can extract the following struct tags
type InfoScheme struct {
Version string `json:"version,omitempty"`
PlatformVersion string `json:"platformVersion,omitempty"`
BuildDate *InfoBuildDataScheme `json:"buildDate,omitempty"`
BuildChangeSet string `json:"buildChangeSet,omitempty"`
IsLicensedForUse bool `json:"isLicensedForUse,omitempty"`
Links *InfoLinkScheme `json:"_links,omitempty"`
}
โ€‹
type InfoBuildDataScheme struct {
Iso8601 string `json:"iso8601,omitempty"`
Jira string `json:"jira,omitempty"`
Friendly string `json:"friendly,omitempty"`
EpochMillis int64 `json:"epochMillis,omitempty"`
}
Export as PDF
Copy link