Skip to content

Commit

Permalink
Add "new_name" parameter to repo transfer request (#2787) (#2788)
Browse files Browse the repository at this point in the history
Fixes: #2787.
  • Loading branch information
kgalli authored May 26, 2023
1 parent f19d239 commit 9e4ce88
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions github/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,7 @@ func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner,
// TransferRequest represents a request to transfer a repository.
type TransferRequest struct {
NewOwner string `json:"new_owner"`
NewName *string `json:"new_name,omitempty"`
TeamID []int64 `json:"team_ids,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion github/repos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3220,7 +3220,7 @@ func TestRepositoriesService_Transfer(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()

input := TransferRequest{NewOwner: "a", TeamID: []int64{123}}
input := TransferRequest{NewOwner: "a", NewName: String("b"), TeamID: []int64{123}}

mux.HandleFunc("/repos/o/r/transfer", func(w http.ResponseWriter, r *http.Request) {
var v TransferRequest
Expand Down Expand Up @@ -3390,11 +3390,13 @@ func TestTransferRequest_Marshal(t *testing.T) {

u := &TransferRequest{
NewOwner: "testOwner",
NewName: String("testName"),
TeamID: []int64{1, 2},
}

want := `{
"new_owner": "testOwner",
"new_name": "testName",
"team_ids": [1,2]
}`

Expand Down

0 comments on commit 9e4ce88

Please sign in to comment.