Browse Source

Add URLs in CommitFile

Add blob_url, raw_url, contents_url in CommitFile struct.
Updates #419

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Daehyeok Mun 9 years ago
parent
commit
dcd14dc4d3
2 changed files with 22 additions and 15 deletions
  1. +10
    -7
      github/repos_commits.go
  2. +12
    -8
      github/repos_commits_test.go

+ 10
- 7
github/repos_commits.go View File

@ -48,13 +48,16 @@ func (c CommitStats) String() string {
// CommitFile represents a file modified in a commit. // CommitFile represents a file modified in a commit.
type CommitFile struct { type CommitFile struct {
SHA *string `json:"sha,omitempty"`
Filename *string `json:"filename,omitempty"`
Additions *int `json:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty"`
Changes *int `json:"changes,omitempty"`
Status *string `json:"status,omitempty"`
Patch *string `json:"patch,omitempty"`
SHA *string `json:"sha,omitempty"`
Filename *string `json:"filename,omitempty"`
Additions *int `json:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty"`
Changes *int `json:"changes,omitempty"`
Status *string `json:"status,omitempty"`
Patch *string `json:"patch,omitempty"`
BlobURL *string `json:"blob_url,omitempty"`
RawURL *string `json:"raw_url,omitempty"`
ContentsURL *string `json:"contents_url,omitempty"`
} }
func (c CommitFile) String() string { func (c CommitFile) String() string {


+ 12
- 8
github/repos_commits_test.go View File

@ -70,9 +70,10 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
"deletions": 2, "deletions": 2,
"changes": 12, "changes": 12,
"status": "s", "status": "s",
"raw_url": "r",
"patch": "p",
"blob_url": "b", "blob_url": "b",
"patch": "p"
"raw_url": "r",
"contents_url": "c"
} }
] ]
}`) }`)
@ -106,12 +107,15 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
}, },
Files: []CommitFile{ Files: []CommitFile{
{ {
Filename: String("f"),
Additions: Int(10),
Deletions: Int(2),
Changes: Int(12),
Status: String("s"),
Patch: String("p"),
Filename: String("f"),
Additions: Int(10),
Deletions: Int(2),
Changes: Int(12),
Status: String("s"),
Patch: String("p"),
BlobURL: String("b"),
RawURL: String("r"),
ContentsURL: String("c"),
}, },
}, },
} }


Loading…
Cancel
Save