diff --git a/github/trees.go b/github/git.go similarity index 82% rename from github/trees.go rename to github/git.go index e9ac58e..d358f27 100644 --- a/github/trees.go +++ b/github/git.go @@ -8,11 +8,11 @@ package github import "fmt" -// TreesService handles communication with the tree related +// GitService handles communication with the tree related // methods of the GitHub API. // -// GitHub API docs: http://developer.github.com/v3/trees/ -type TreesService struct { +// GitHub API docs: http://developer.github.com/v3/git/ +type GitService struct { client *Client } @@ -38,7 +38,7 @@ type createTree struct { // Get the Tree object for a given sha hash from a users repository. // // GitHub API docs: http://developer.github.com/v3/git/trees/#get-a-tree -func (s *TreesService) Get(user string, repo string, sha string, recursive bool) (*Tree, error) { +func (s *GitService) Get(user string, repo string, sha string, recursive bool) (*Tree, error) { url_ := fmt.Sprintf("repos/%v/%v/git/trees/%v", user, repo, sha) if recursive { @@ -60,7 +60,7 @@ func (s *TreesService) Get(user string, repo string, sha string, recursive bool) // it will overwrite the contents of that tree with the new path contents and write a new tree out. // // GitHub API docs: http://developer.github.com/v3/git/trees/#create-a-tree -func (s *TreesService) Create(owner string, repo string, sha string, baseTreeSha string, trees []GitTree) (*Tree, error) { +func (s *GitService) Create(owner string, repo string, sha string, baseTreeSha string, trees []GitTree) (*Tree, error) { url_ := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) req, err := s.client.NewRequest("POST", url_, createTree{ diff --git a/github/trees_test.go b/github/git_test.go similarity index 96% rename from github/trees_test.go rename to github/git_test.go index 533ff1d..4935856 100644 --- a/github/trees_test.go +++ b/github/git_test.go @@ -14,7 +14,7 @@ import ( "testing" ) -func TestTreesService_Get_authenticatedUser(t *testing.T) { +func TestGitService_Get_authenticatedUser(t *testing.T) { setup() defer teardown() @@ -75,7 +75,7 @@ func TestTreesService_Get_authenticatedUser(t *testing.T) { } } -func TestTreesService_Create_authenticatedUser(t *testing.T) { +func TestGitService_Create_authenticatedUser(t *testing.T) { setup() defer teardown() diff --git a/github/github.go b/github/github.go index 2125ba3..d5d006c 100644 --- a/github/github.go +++ b/github/github.go @@ -91,7 +91,7 @@ type Client struct { Organizations *OrganizationsService PullRequests *PullRequestsService Repositories *RepositoriesService - Trees *TreesService + Git *GitService Users *UsersService Gists *GistsService } @@ -118,7 +118,7 @@ func NewClient(httpClient *http.Client) *Client { c.Organizations = &OrganizationsService{client: c} c.PullRequests = &PullRequestsService{client: c} c.Repositories = &RepositoriesService{client: c} - c.Trees = &TreesService{client: c} + c.Git = &GitService{client: c} c.Users = &UsersService{client: c} c.Gists = &GistsService{client: c} return c