15
vendor/github.com/google/go-github/github/git_blobs.go
generated
vendored
15
vendor/github.com/google/go-github/github/git_blobs.go
generated
vendored
@@ -5,7 +5,10 @@
|
||||
|
||||
package github
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Blob represents a blob object.
|
||||
type Blob struct {
|
||||
@@ -18,8 +21,8 @@ type Blob struct {
|
||||
|
||||
// GetBlob fetchs a blob from a repo given a SHA.
|
||||
//
|
||||
// GitHub API docs: http://developer.github.com/v3/git/blobs/#get-a-blob
|
||||
func (s *GitService) GetBlob(owner string, repo string, sha string) (*Blob, *Response, error) {
|
||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
|
||||
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha)
|
||||
req, err := s.client.NewRequest("GET", u, nil)
|
||||
if err != nil {
|
||||
@@ -27,14 +30,14 @@ func (s *GitService) GetBlob(owner string, repo string, sha string) (*Blob, *Res
|
||||
}
|
||||
|
||||
blob := new(Blob)
|
||||
resp, err := s.client.Do(req, blob)
|
||||
resp, err := s.client.Do(ctx, req, blob)
|
||||
return blob, resp, err
|
||||
}
|
||||
|
||||
// CreateBlob creates a blob object.
|
||||
//
|
||||
// GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
|
||||
func (s *GitService) CreateBlob(owner string, repo string, blob *Blob) (*Blob, *Response, error) {
|
||||
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) {
|
||||
u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo)
|
||||
req, err := s.client.NewRequest("POST", u, blob)
|
||||
if err != nil {
|
||||
@@ -42,6 +45,6 @@ func (s *GitService) CreateBlob(owner string, repo string, blob *Blob) (*Blob, *
|
||||
}
|
||||
|
||||
t := new(Blob)
|
||||
resp, err := s.client.Do(req, t)
|
||||
resp, err := s.client.Do(ctx, req, t)
|
||||
return t, resp, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user