Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SubmoduleGitURL to RepositoryContent #2880

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

27 changes: 14 additions & 13 deletions github/github-stringify_test.go

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

13 changes: 7 additions & 6 deletions github/repos_contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ type RepositoryContent struct {
// Content contains the actual file content, which may be encoded.
// Callers should call GetContent which will decode the content if
// necessary.
Content *string `json:"content,omitempty"`
SHA *string `json:"sha,omitempty"`
URL *string `json:"url,omitempty"`
GitURL *string `json:"git_url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
DownloadURL *string `json:"download_url,omitempty"`
Content *string `json:"content,omitempty"`
SHA *string `json:"sha,omitempty"`
URL *string `json:"url,omitempty"`
GitURL *string `json:"git_url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
DownloadURL *string `json:"download_url,omitempty"`
SubmoduleGitURL *string `json:"submodule_git_url,omitempty"`
}

// RepositoryContentResponse holds the parsed response from CreateFile, UpdateFile, and DeleteFile.
Expand Down
56 changes: 30 additions & 26 deletions github/repos_contents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,18 +782,19 @@ func TestRepositoryContent_Marshal(t *testing.T) {
testJSONMarshal(t, &RepositoryContent{}, "{}")

r := &RepositoryContent{
Type: String("type"),
Target: String("target"),
Encoding: String("encoding"),
Size: Int(1),
Name: String("name"),
Path: String("path"),
Content: String("content"),
SHA: String("sha"),
URL: String("url"),
GitURL: String("gurl"),
HTMLURL: String("hurl"),
DownloadURL: String("durl"),
Type: String("type"),
Target: String("target"),
Encoding: String("encoding"),
Size: Int(1),
Name: String("name"),
Path: String("path"),
Content: String("content"),
SHA: String("sha"),
URL: String("url"),
GitURL: String("gurl"),
HTMLURL: String("hurl"),
DownloadURL: String("durl"),
SubmoduleGitURL: String("smgurl"),
}

want := `{
Expand All @@ -808,7 +809,8 @@ func TestRepositoryContent_Marshal(t *testing.T) {
"url": "url",
"git_url": "gurl",
"html_url": "hurl",
"download_url": "durl"
"download_url": "durl",
"submodule_git_url": "smgurl"
}`

testJSONMarshal(t, r, want)
Expand All @@ -819,18 +821,19 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) {

r := &RepositoryContentResponse{
Content: &RepositoryContent{
Type: String("type"),
Target: String("target"),
Encoding: String("encoding"),
Size: Int(1),
Name: String("name"),
Path: String("path"),
Content: String("content"),
SHA: String("sha"),
URL: String("url"),
GitURL: String("gurl"),
HTMLURL: String("hurl"),
DownloadURL: String("durl"),
Type: String("type"),
Target: String("target"),
Encoding: String("encoding"),
Size: Int(1),
Name: String("name"),
Path: String("path"),
Content: String("content"),
SHA: String("sha"),
URL: String("url"),
GitURL: String("gurl"),
HTMLURL: String("hurl"),
DownloadURL: String("durl"),
SubmoduleGitURL: String("smgurl"),
},
Commit: Commit{
SHA: String("s"),
Expand Down Expand Up @@ -893,7 +896,8 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) {
"url": "url",
"git_url": "gurl",
"html_url": "hurl",
"download_url": "durl"
"download_url": "durl",
"submodule_git_url": "smgurl"
},
"commit": {
"sha": "s",
Expand Down
Loading