(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int)
| 969 | } |
| 970 | |
| 971 | func getProject(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int) (*mcp.CallToolResult, bool, any, error) { |
| 972 | project, resp, err := fetchProjectV2(ctx, client, owner, ownerType, projectNumber) |
| 973 | if err != nil { |
| 974 | return ghErrors.NewGitHubAPIErrorResponse(ctx, |
| 975 | "failed to get project", |
| 976 | resp, |
| 977 | err, |
| 978 | ), false, nil, nil |
| 979 | } |
| 980 | defer func() { _ = resp.Body.Close() }() |
| 981 | |
| 982 | if resp.StatusCode != http.StatusOK { |
| 983 | body, err := io.ReadAll(resp.Body) |
| 984 | if err != nil { |
| 985 | return nil, false, nil, fmt.Errorf("failed to read response body: %w", err) |
| 986 | } |
| 987 | return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get project", resp, body), false, nil, nil |
| 988 | } |
| 989 | |
| 990 | minimalProject := convertToMinimalProject(project) |
| 991 | r, err := json.Marshal(minimalProject) |
| 992 | if err != nil { |
| 993 | return nil, false, nil, fmt.Errorf("failed to marshal response: %w", err) |
| 994 | } |
| 995 | |
| 996 | return utils.NewToolResultText(string(r)), !project.GetPublic(), nil, nil |
| 997 | } |
| 998 | |
| 999 | func getProjectField(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int, fieldID int64) (*mcp.CallToolResult, any, error) { |
| 1000 | var resp *github.Response |
no test coverage detected