Page cover image

โ„น๏ธInfo

https://github.com/ctreminiom/go-atlassian/blob/main/pkg/infra/models/sm_info.go
package models

// InfoScheme represents the information about a system.
type InfoScheme struct {
	Version          string               `json:"version,omitempty"`          // The version of the system.
	PlatformVersion  string               `json:"platformVersion,omitempty"`  // The platform version of the system.
	BuildDate        *InfoBuildDataScheme `json:"buildDate,omitempty"`        // The build date of the system.
	BuildChangeSet   string               `json:"buildChangeSet,omitempty"`   // The build change set of the system.
	IsLicensedForUse bool                 `json:"isLicensedForUse,omitempty"` // Indicates if the system is licensed for use.
	Links            *InfoLinkScheme      `json:"_links,omitempty"`           // Links related to the system.
}

// InfoBuildDataScheme represents the build date of a system.
type InfoBuildDataScheme struct {
	ISO8601     DateTimeScheme `json:"iso8601,omitempty"`     // The ISO 8601 format of the build date.
	Jira        string         `json:"jira,omitempty"`        // The Jira format of the build date.
	Friendly    string         `json:"friendly,omitempty"`    // The friendly format of the build date.
	EpochMillis int64          `json:"epochMillis,omitempty"` // The epoch milliseconds of the build date.
}

// InfoLinkScheme represents a link related to a system.
type InfoLinkScheme struct {
	Self string `json:"self,omitempty"` // The URL of the system itself.
}
SM Info Models

Get info

GET /rest/servicedeskapi/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 (
		email       = "[email protected]"
		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("-------------------------")
}

Last updated

Was this helpful?