Skip to content

Commit a6f50f1

Browse files
authored
Fix copilot API payload (#3034)
1 parent 9d6658a commit a6f50f1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

github/copilot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users
241241
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org)
242242

243243
body := struct {
244-
SelectedUsers []string `json:"selected_users"`
244+
SelectedUsernames []string `json:"selected_usernames"`
245245
}{
246-
SelectedUsers: users,
246+
SelectedUsernames: users,
247247
}
248248

249249
req, err := s.client.NewRequest("POST", u, body)
@@ -269,9 +269,9 @@ func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, use
269269
u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org)
270270

271271
body := struct {
272-
SelectedUsers []string `json:"selected_users"`
272+
SelectedUsernames []string `json:"selected_usernames"`
273273
}{
274-
SelectedUsers: users,
274+
SelectedUsernames: users,
275275
}
276276

277277
req, err := s.client.NewRequest("DELETE", u, body)

github/copilot_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ func TestCopilotService_AddCopilotUsers(t *testing.T) {
680680

681681
mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) {
682682
testMethod(t, r, "POST")
683-
testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n")
683+
testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n")
684684
fmt.Fprint(w, `{"seats_created": 2}`)
685685
})
686686

@@ -718,7 +718,7 @@ func TestCopilotService_RemoveCopilotUsers(t *testing.T) {
718718

719719
mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) {
720720
testMethod(t, r, "DELETE")
721-
testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n")
721+
testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n")
722722
fmt.Fprint(w, `{"seats_cancelled": 2}`)
723723
})
724724

0 commit comments

Comments
 (0)