(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int)
| 1447 | } |
| 1448 | |
| 1449 | func RemoveSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int) (*mcp.CallToolResult, error) { |
| 1450 | subIssueRequest := github.SubIssueRequest{ |
| 1451 | SubIssueID: int64(subIssueID), |
| 1452 | } |
| 1453 | |
| 1454 | subIssue, resp, err := client.SubIssue.Remove(ctx, owner, repo, int64(issueNumber), subIssueRequest) |
| 1455 | if err != nil { |
| 1456 | return ghErrors.NewGitHubAPIErrorResponse(ctx, |
| 1457 | "failed to remove sub-issue", |
| 1458 | resp, |
| 1459 | err, |
| 1460 | ), nil |
| 1461 | } |
| 1462 | defer func() { _ = resp.Body.Close() }() |
| 1463 | |
| 1464 | if resp.StatusCode != http.StatusOK { |
| 1465 | body, err := io.ReadAll(resp.Body) |
| 1466 | if err != nil { |
| 1467 | return nil, fmt.Errorf("failed to read response body: %w", err) |
| 1468 | } |
| 1469 | return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to remove sub-issue", resp, body), nil |
| 1470 | } |
| 1471 | |
| 1472 | r, err := json.Marshal(subIssue) |
| 1473 | if err != nil { |
| 1474 | return nil, fmt.Errorf("failed to marshal response: %w", err) |
| 1475 | } |
| 1476 | |
| 1477 | return utils.NewToolResultText(string(r)), nil |
| 1478 | } |
| 1479 | |
| 1480 | func ReprioritizeSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int, afterID int, beforeID int) (*mcp.CallToolResult, error) { |
| 1481 | // Validate that either after_id or before_id is specified, but not both |
no test coverage detected