Get workflow for issue type in workflow scheme
GET /rest/api/{2-3}/workflowscheme/{id}/issuetype/{issueType}
Get returns the issue type-workflow mapping for an issue type in a workflow scheme.
Copy package main
import (
"context"
"fmt"
v3 "github.com/ctreminiom/go-atlassian/jira/v3"
"log"
"os"
)
func main () {
var (
host = os. Getenv ( "HOST" )
mail = os. Getenv ( "MAIL" )
token = os. Getenv ( "TOKEN" )
)
instance, err := v3. New ( nil , host)
if err != nil {
log. Fatal (err)
}
instance.Auth. SetBasicAuth (mail, token)
instance.Auth. SetUserAgent ( "curl/7.54.0" )
mapping, response, err := instance.Workflow.Scheme.IssueType. Get (context. Background (), 10002 , "10007" , false )
if err != nil {
if response != nil {
log. Println (response.Bytes. String ())
log. Println (response.Code)
}
log. Fatal (err)
}
fmt. Println (mapping)
}
Set workflow for issue type in workflow scheme
PUT /rest/api/{2-3}/workflowscheme/{id}/issuetype/{issueType}
Set sets the workflow for an issue type in a workflow scheme.
Note that active workflow schemes cannot be edited. If the workflow scheme is active, set updateDraftIfNeeded
to true
in the request body and a draft workflow scheme is created or updated with the new issue type-workflow mapping. The draft workflow scheme can be published in Jira.
Copy package main
import (
"context"
"fmt"
v3 "github.com/ctreminiom/go-atlassian/jira/v3"
"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" )
)
instance, err := v3. New ( nil , host)
if err != nil {
log. Fatal (err)
}
instance.Auth. SetBasicAuth (mail, token)
instance.Auth. SetUserAgent ( "curl/7.54.0" )
payload := & models . IssueTypeWorkflowPayloadScheme {
IssueType: "10000" ,
UpdateDraftIfNeeded: false ,
Workflow: "DESK: Jira Service Management default workflow" ,
}
workflowScheme, response, err := instance.Workflow.Scheme.IssueType. Set (context. Background (), 10007 , "10007" , payload)
if err != nil {
if response != nil {
log. Println (response.Bytes. String ())
log. Println (response.Code)
}
log. Fatal (err)
}
fmt. Println (workflowScheme)
}
Delete workflow for issue type in workflow scheme
DELETE /rest/api/{2-3}/workflowscheme/{id}/issuetype/{issueType}
Delete deletes the issue type-workflow mapping for an issue type in a workflow scheme.
Note that active workflow schemes cannot be edited. If the workflow scheme is active, set updateDraftIfNeeded
to true
and a draft workflow scheme is created or updated with the issue type-workflow mapping deleted. The draft workflow scheme can be published in Jira.
Copy package main
import (
"context"
"fmt"
v3 "github.com/ctreminiom/go-atlassian/jira/v3"
"log"
"os"
)
func main () {
var (
host = os. Getenv ( "HOST" )
mail = os. Getenv ( "MAIL" )
token = os. Getenv ( "TOKEN" )
)
instance, err := v3. New ( nil , host)
if err != nil {
log. Fatal (err)
}
instance.Auth. SetBasicAuth (mail, token)
instance.Auth. SetUserAgent ( "curl/7.54.0" )
mapping, response, err := instance.Workflow.Scheme.IssueType. Delete (context. Background (), 10002 , "10000" , false )
if err != nil {
if response != nil {
log. Println (response.Bytes. String ())
log. Println (response.Code)
}
log. Fatal (err)
}
fmt. Println (mapping)
}
Get issue types for workflows in workflow scheme
GET /rest/api/{2-3}/workflowscheme/{id}/workflow
Mapping returns the workflow-issue type mappings for a workflow scheme.
Copy package main
import (
"context"
"fmt"
v3 "github.com/ctreminiom/go-atlassian/jira/v3"
"log"
"os"
)
func main () {
var (
host = os. Getenv ( "HOST" )
mail = os. Getenv ( "MAIL" )
token = os. Getenv ( "TOKEN" )
)
instance, err := v3. New ( nil , host)
if err != nil {
log. Fatal (err)
}
instance.Auth. SetBasicAuth (mail, token)
instance.Auth. SetUserAgent ( "curl/7.54.0" )
mapping, response, err := instance.Workflow.Scheme.IssueType. Mapping (context. Background (), 10007 , "" , false )
if err != nil {
if response != nil {
log. Println (response.Bytes. String ())
log. Println (response.Code)
}
log. Fatal (err)
}
log. Println (response.Endpoint)
for _, element := range mapping {
fmt. Println (element.Workflow, element.Workflow)
}
}
Set issue types for workflow in workflow scheme
Not implemented, feel free to open a PR ๐
Delete issue types for workflow in workflow scheme
Not implemented, feel free to open a PR ๐