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)
| 645 | // parallel and returns any failures as a single joined error so a single |
| 646 | // failure does not abort the rest. |
| 647 | func DeferredUpdateIssue(client *Client, opts DeferredUpdateIssueOptions) error { |
| 648 | var mutations []func() error |
| 649 | |
| 650 | if opts.IssueTypeID != "" || opts.RemoveIssueType { |
| 651 | mutations = append(mutations, func() error { |
| 652 | return UpdateIssueIssueType(client, opts.Hostname, opts.IssueID, opts.IssueTypeID) |
| 653 | }) |
| 654 | } |
| 655 | |
| 656 | if opts.ParentID != "" { |
| 657 | mutations = append(mutations, func() error { |
| 658 | return AddSubIssue(client, opts.Hostname, opts.ParentID, opts.IssueID, opts.ReplaceExistingParent) |
| 659 | }) |
| 660 | } else if opts.RemoveParentID != "" { |
| 661 | mutations = append(mutations, func() error { |
| 662 | return RemoveSubIssue(client, opts.Hostname, opts.RemoveParentID, opts.IssueID) |
| 663 | }) |
| 664 | } |
| 665 | |
| 666 | for _, id := range opts.AddSubIssueIDs { |
| 667 | mutations = append(mutations, func() error { |
| 668 | return AddSubIssue(client, opts.Hostname, opts.IssueID, id, true) |
| 669 | }) |
| 670 | } |
| 671 | for _, id := range opts.RemoveSubIssueIDs { |
| 672 | mutations = append(mutations, func() error { |
| 673 | return RemoveSubIssue(client, opts.Hostname, opts.IssueID, id) |
| 674 | }) |
| 675 | } |
| 676 | |
| 677 | for _, id := range opts.AddBlockedByIDs { |
| 678 | mutations = append(mutations, func() error { |
| 679 | return AddBlockedBy(client, opts.Hostname, opts.IssueID, id) |
| 680 | }) |
| 681 | } |
| 682 | for _, id := range opts.RemoveBlockedByIDs { |
| 683 | mutations = append(mutations, func() error { |
| 684 | return RemoveBlockedBy(client, opts.Hostname, opts.IssueID, id) |
| 685 | }) |
| 686 | } |
| 687 | |
| 688 | for _, id := range opts.AddBlockingIDs { |
| 689 | mutations = append(mutations, func() error { |
| 690 | // blocking is the inverse of blocked-by: this issue blocks `id`, |
| 691 | // expressed as `id` is blocked by this issue. |
| 692 | return AddBlockedBy(client, opts.Hostname, id, opts.IssueID) |
| 693 | }) |
| 694 | } |
| 695 | for _, id := range opts.RemoveBlockingIDs { |
| 696 | mutations = append(mutations, func() error { |
| 697 | return RemoveBlockedBy(client, opts.Hostname, id, opts.IssueID) |
| 698 | }) |
| 699 | } |
| 700 | |
| 701 | if len(mutations) == 0 { |
| 702 | return nil |
| 703 | } |
| 704 |
no test coverage detected