Skip to content

Commit 2860661

Browse files
reduce change diff
1 parent 0845f7e commit 2860661

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

pkg/github/projects.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -853,38 +853,6 @@ type fieldSelectionOptions struct {
853853
Fields []int64 `url:"fields,omitempty,comma"`
854854
}
855855

856-
// addOptions adds the parameters in opts as URL query parameters to s. opts
857-
// must be a struct whose fields may contain "url" tags.
858-
func addOptions(s string, opts any) (string, error) {
859-
v := reflect.ValueOf(opts)
860-
if v.Kind() == reflect.Ptr && v.IsNil() {
861-
return s, nil
862-
}
863-
864-
origURL, err := url.Parse(s)
865-
if err != nil {
866-
return s, err
867-
}
868-
869-
origValues := origURL.Query()
870-
871-
// Use the github.com/google/go-querystring library to parse the struct
872-
newValues, err := query.Values(opts)
873-
if err != nil {
874-
return s, err
875-
}
876-
877-
// Merge the values
878-
for key, values := range newValues {
879-
for _, value := range values {
880-
origValues.Add(key, value)
881-
}
882-
}
883-
884-
origURL.RawQuery = origValues.Encode()
885-
return origURL.String(), nil
886-
}
887-
888856
type updateProjectItemPayload struct {
889857
Fields []updateProjectItem `json:"fields"`
890858
}
@@ -966,6 +934,38 @@ func buildUpdateProjectItem(input map[string]any) (*updateProjectItem, error) {
966934
return payload, nil
967935
}
968936

937+
// addOptions adds the parameters in opts as URL query parameters to s. opts
938+
// must be a struct whose fields may contain "url" tags.
939+
func addOptions(s string, opts any) (string, error) {
940+
v := reflect.ValueOf(opts)
941+
if v.Kind() == reflect.Ptr && v.IsNil() {
942+
return s, nil
943+
}
944+
945+
origURL, err := url.Parse(s)
946+
if err != nil {
947+
return s, err
948+
}
949+
950+
origValues := origURL.Query()
951+
952+
// Use the github.com/google/go-querystring library to parse the struct
953+
newValues, err := query.Values(opts)
954+
if err != nil {
955+
return s, err
956+
}
957+
958+
// Merge the values
959+
for key, values := range newValues {
960+
for _, value := range values {
961+
origValues.Add(key, value)
962+
}
963+
}
964+
965+
origURL.RawQuery = origValues.Encode()
966+
return origURL.String(), nil
967+
}
968+
969969
func ManageProjectItemsPrompt(t translations.TranslationHelperFunc) (tool mcp.Prompt, handler server.PromptHandlerFunc) {
970970
return mcp.NewPrompt("ManageProjectItems",
971971
mcp.WithPromptDescription(t("PROMPT_MANAGE_PROJECT_ITEMS_DESCRIPTION", "Interactive guide for managing GitHub Projects V2, including discovery, field management, querying, and updates.")),

0 commit comments

Comments
 (0)