From a6f50f1b02b66fb31671a4ecc5ab75d07dc791ed Mon Sep 17 00:00:00 2001 From: Jesse Haka Date: Tue, 19 Dec 2023 22:30:31 +0200 Subject: [PATCH] Fix copilot API payload (#3034) --- github/copilot.go | 8 ++++---- github/copilot_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/github/copilot.go b/github/copilot.go index 3f3d73b25bc..51c938c9748 100644 --- a/github/copilot.go +++ b/github/copilot.go @@ -241,9 +241,9 @@ func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) body := struct { - SelectedUsers []string `json:"selected_users"` + SelectedUsernames []string `json:"selected_usernames"` }{ - SelectedUsers: users, + SelectedUsernames: users, } req, err := s.client.NewRequest("POST", u, body) @@ -269,9 +269,9 @@ func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, use u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) body := struct { - SelectedUsers []string `json:"selected_users"` + SelectedUsernames []string `json:"selected_usernames"` }{ - SelectedUsers: users, + SelectedUsernames: users, } req, err := s.client.NewRequest("DELETE", u, body) diff --git a/github/copilot_test.go b/github/copilot_test.go index 9df2c9a497d..c65fda0f217 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -680,7 +680,7 @@ func TestCopilotService_AddCopilotUsers(t *testing.T) { mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n") fmt.Fprint(w, `{"seats_created": 2}`) }) @@ -718,7 +718,7 @@ func TestCopilotService_RemoveCopilotUsers(t *testing.T) { mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n") fmt.Fprint(w, `{"seats_cancelled": 2}`) })