Returns the edit screen fields for an issue that are visible to and editable by the user. Use the information to populate the requests in Edit issue .
Copy package main
import (
"context"
"fmt"
v2 "github.com/ctreminiom/go-atlassian/jira/v2"
"log"
"os"
)
func main () {
var (
host = os.Getenv( "HOST" )
mail = os.Getenv( "MAIL" )
token = os.Getenv( "TOKEN" )
)
atlassian, err := v2.New( nil , host)
if err != nil {
log.Fatal(err)
}
atlassian.Auth.SetBasicAuth(mail, token)
metadata, response, err := atlassian.Issue.Metadata.Get(context.Background(), "KP-1" , false , false )
if err != nil {
log.Fatal(err)
}
log.Println( "HTTP Endpoint Used" , response.Endpoint)
fields, response, err := atlassian.Issue.Field.Gets(context.Background())
if err != nil {
log.Fatal(err)
}
log.Println( "HTTP Endpoint Used" , response.Endpoint)
for _, field := range fields {
path := fmt.Sprintf( "fields. %v .required" , field.ID)
value := metadata.Get(path)
if value.Exists() {
fmt.Println( "Field Name:" , field.Name, "Required?:" , value.String())
}
}
}
Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user. Use the information to populate the requests in Create issue and Create issues .
Copy package main
import (
"context"
"fmt"
v2 "github.com/ctreminiom/go-atlassian/jira/v2"
"github.com/ctreminiom/go-atlassian/pkg/infra/models"
"log"
"os"
)
func main () {
var (
host = os.Getenv( "HOST" )
mail = os.Getenv( "MAIL" )
token = os.Getenv( "TOKEN" )
)
atlassian, err := v2.New( nil , host)
if err != nil {
log.Fatal(err)
}
atlassian.Auth.SetBasicAuth(mail, token)
options := & models . IssueMetadataCreateOptions {
ProjectIDs: nil ,
ProjectKeys: [] string { "KP" },
IssueTypeIDs: nil ,
IssueTypeNames: nil ,
Expand: "" ,
}
metadata, response, err := atlassian.Issue.Metadata.Create(context.Background(), options)
if err != nil {
log.Fatal(err)
}
log.Println( "HTTP Endpoint Used" , response.Endpoint)
fmt.Println(metadata)
}