This method returns all the SLA records on a customer request.
package 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 (
issueKeyOrID = "DESK-3"
start = 0
limit = 50
)
slas, response, err := atlassian.Request.SLA.Gets(context.Background(), issueKeyOrID, start, limit)
if err != nil {
log.Fatal(err)
}
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
for _, sla := range slas.Values {
log.Println(sla)
}
}
This method returns the details for an SLA on a customer request.
package 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 (
issueKeyOrID = "DESK-3"
slaMetricID = 1
)
sla, response, err := atlassian.Request.SLA.Get(context.Background(), issueKeyOrID, slaMetricID)
if err != nil {
log.Fatal(err)
}
log.Println("Response HTTP Code", response.Code)
log.Println("HTTP Endpoint Used", response.Endpoint)
log.Println("SLA ID", sla.ID)
log.Println("SLA Name", sla.Name)
}