MCPcopy Create free account
hub / github.com/cli/cli / DeferredUpdateIssue

Function DeferredUpdateIssue

api/queries_issue.go:668–745  ·  view source on GitHub ↗

DeferredUpdateIssue runs issue mutations described by opts in parallel and returns any failures as a single joined error so a single failure does not abort the rest.

(client *Client, opts DeferredUpdateIssueOptions)

Source from the content-addressed store, hash-verified

666// parallel and returns any failures as a single joined error so a single
667// failure does not abort the rest.
668func DeferredUpdateIssue(client *Client, opts DeferredUpdateIssueOptions) error {
669 var mutations []func() error
670
671 if opts.IssueTypeID != "" || opts.RemoveIssueType {
672 mutations = append(mutations, func() error {
673 return UpdateIssueIssueType(client, opts.Hostname, opts.IssueID, opts.IssueTypeID)
674 })
675 }
676
677 if opts.ParentID != "" {
678 mutations = append(mutations, func() error {
679 return AddSubIssue(client, opts.Hostname, opts.ParentID, opts.IssueID, opts.ReplaceExistingParent)
680 })
681 } else if opts.RemoveParentID != "" {
682 mutations = append(mutations, func() error {
683 return RemoveSubIssue(client, opts.Hostname, opts.RemoveParentID, opts.IssueID)
684 })
685 }
686
687 for _, id := range opts.AddSubIssueIDs {
688 mutations = append(mutations, func() error {
689 return AddSubIssue(client, opts.Hostname, opts.IssueID, id, true)
690 })
691 }
692 for _, id := range opts.RemoveSubIssueIDs {
693 mutations = append(mutations, func() error {
694 return RemoveSubIssue(client, opts.Hostname, opts.IssueID, id)
695 })
696 }
697
698 for _, id := range opts.AddBlockedByIDs {
699 mutations = append(mutations, func() error {
700 return AddBlockedBy(client, opts.Hostname, opts.IssueID, id)
701 })
702 }
703 for _, id := range opts.RemoveBlockedByIDs {
704 mutations = append(mutations, func() error {
705 return RemoveBlockedBy(client, opts.Hostname, opts.IssueID, id)
706 })
707 }
708
709 for _, id := range opts.AddBlockingIDs {
710 mutations = append(mutations, func() error {
711 // blocking is the inverse of blocked-by: this issue blocks `id`,
712 // expressed as `id` is blocked by this issue.
713 return AddBlockedBy(client, opts.Hostname, id, opts.IssueID)
714 })
715 }
716 for _, id := range opts.RemoveBlockingIDs {
717 mutations = append(mutations, func() error {
718 return RemoveBlockedBy(client, opts.Hostname, id, opts.IssueID)
719 })
720 }
721
722 if len(mutations) == 0 {
723 return nil
724 }
725

Callers 2

createRunFunction · 0.92
editRunFunction · 0.92

Calls 9

UpdateIssueIssueTypeFunction · 0.85
AddSubIssueFunction · 0.85
RemoveSubIssueFunction · 0.85
AddBlockedByFunction · 0.85
RemoveBlockedByFunction · 0.85
JoinMethod · 0.80
AddMethod · 0.65
DoneMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected