mirror of
https://github.com/documize/community.git
synced 2025-07-19 21:29:42 +02:00
go dep
Migrated from plain /vendor to go dep
This commit is contained in:
parent
0262763c95
commit
fd693f4ff4
957 changed files with 36866 additions and 177595 deletions
26
vendor/github.com/google/go-github/github/git_trees.go
generated
vendored
26
vendor/github.com/google/go-github/github/git_trees.go
generated
vendored
|
@ -5,7 +5,10 @@
|
|||
|
||||
package github
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Tree represents a GitHub tree.
|
||||
type Tree struct {
|
||||
|
@ -17,7 +20,7 @@ func (t Tree) String() string {
|
|||
return Stringify(t)
|
||||
}
|
||||
|
||||
// TreeEntry represents the contents of a tree structure. TreeEntry can
|
||||
// TreeEntry represents the contents of a tree structure. TreeEntry can
|
||||
// represent either a blob, a commit (in the case of a submodule), or another
|
||||
// tree.
|
||||
type TreeEntry struct {
|
||||
|
@ -27,6 +30,7 @@ type TreeEntry struct {
|
|||
Type *string `json:"type,omitempty"`
|
||||
Size *int `json:"size,omitempty"`
|
||||
Content *string `json:"content,omitempty"`
|
||||
URL *string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
func (t TreeEntry) String() string {
|
||||
|
@ -35,8 +39,8 @@ func (t TreeEntry) String() string {
|
|||
|
||||
// GetTree fetches the Tree object for a given sha hash from a repository.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/trees/#get-a-tree
|
||||
func (s *GitService) GetTree(owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
|
||||
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha)
|
||||
if recursive {
|
||||
u += "?recursive=1"
|
||||
|
@ -48,12 +52,12 @@ func (s *GitService) GetTree(owner string, repo string, sha string, recursive bo
|
|||
}
|
||||
|
||||
t := new(Tree)
|
||||
resp, err := s.client.Do(req, t)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, err
|
||||
return t, resp, nil
|
||||
}
|
||||
|
||||
// createTree represents the body of a CreateTree request.
|
||||
|
@ -62,12 +66,12 @@ type createTree struct {
|
|||
Entries []TreeEntry `json:"tree"`
|
||||
}
|
||||
|
||||
// CreateTree creates a new tree in a repository. If both a tree and a nested
|
||||
// CreateTree creates a new tree in a repository. If both a tree and a nested
|
||||
// path modifying that tree are specified, 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 *GitService) CreateTree(owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
|
||||
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo)
|
||||
|
||||
body := &createTree{
|
||||
|
@ -80,10 +84,10 @@ func (s *GitService) CreateTree(owner string, repo string, baseTree string, entr
|
|||
}
|
||||
|
||||
t := new(Tree)
|
||||
resp, err := s.client.Do(req, t)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return t, resp, err
|
||||
return t, resp, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue