aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_releases.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_releases.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_releases.go48
1 files changed, 37 insertions, 11 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_releases.go b/vendor/github.com/google/go-github/github/repos_releases.go
index 1ee7ecf..d5dfc70 100644
--- a/vendor/github.com/google/go-github/github/repos_releases.go
+++ b/vendor/github.com/google/go-github/github/repos_releases.go
@@ -19,7 +19,7 @@ import (
// RepositoryRelease represents a GitHub release in a repository.
type RepositoryRelease struct {
- ID *int `json:"id,omitempty"`
+ ID *int64 `json:"id,omitempty"`
TagName *string `json:"tag_name,omitempty"`
TargetCommitish *string `json:"target_commitish,omitempty"`
Name *string `json:"name,omitempty"`
@@ -36,6 +36,7 @@ type RepositoryRelease struct {
ZipballURL *string `json:"zipball_url,omitempty"`
TarballURL *string `json:"tarball_url,omitempty"`
Author *User `json:"author,omitempty"`
+ NodeID *string `json:"node_id,omitempty"`
}
func (r RepositoryRelease) String() string {
@@ -44,7 +45,7 @@ func (r RepositoryRelease) String() string {
// ReleaseAsset represents a GitHub release asset in a repository.
type ReleaseAsset struct {
- ID *int `json:"id,omitempty"`
+ ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
Name *string `json:"name,omitempty"`
Label *string `json:"label,omitempty"`
@@ -56,6 +57,7 @@ type ReleaseAsset struct {
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
BrowserDownloadURL *string `json:"browser_download_url,omitempty"`
Uploader *User `json:"uploader,omitempty"`
+ NodeID *string `json:"node_id,omitempty"`
}
func (r ReleaseAsset) String() string {
@@ -77,6 +79,9 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
var releases []*RepositoryRelease
resp, err := s.client.Do(ctx, req, &releases)
if err != nil {
@@ -88,7 +93,7 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri
// GetRelease fetches a single release.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release
-func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int) (*RepositoryRelease, *Response, error) {
+func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
return s.getSingleRelease(ctx, u)
}
@@ -115,6 +120,9 @@ func (s *RepositoriesService) getSingleRelease(ctx context.Context, url string)
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
release := new(RepositoryRelease)
resp, err := s.client.Do(ctx, req, release)
if err != nil {
@@ -134,6 +142,9 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
r := new(RepositoryRelease)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -145,7 +156,7 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str
// EditRelease edits a repository release.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release
-func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
+func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
req, err := s.client.NewRequest("PATCH", u, release)
@@ -153,6 +164,9 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
r := new(RepositoryRelease)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -164,7 +178,7 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin
// DeleteRelease delete a single release from a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release
-func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int) (*Response, error) {
+func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id)
req, err := s.client.NewRequest("DELETE", u, nil)
@@ -177,7 +191,7 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str
// ListReleaseAssets lists the release's assets.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#list-assets-for-a-release
-func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int, opt *ListOptions) ([]*ReleaseAsset, *Response, error) {
+func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opt *ListOptions) ([]*ReleaseAsset, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -189,6 +203,9 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
var assets []*ReleaseAsset
resp, err := s.client.Do(ctx, req, &assets)
if err != nil {
@@ -200,7 +217,7 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo
// GetReleaseAsset fetches a single release asset.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
-func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int) (*ReleaseAsset, *Response, error) {
+func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
req, err := s.client.NewRequest("GET", u, nil)
@@ -208,6 +225,9 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
asset := new(ReleaseAsset)
resp, err := s.client.Do(ctx, req, asset)
if err != nil {
@@ -224,7 +244,7 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s
// of the io.ReadCloser. Exactly one of rc and redirectURL will be zero.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#get-a-single-release-asset
-func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int) (rc io.ReadCloser, redirectURL string, err error) {
+func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64) (rc io.ReadCloser, redirectURL string, err error) {
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
req, err := s.client.NewRequest("GET", u, nil)
@@ -264,7 +284,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, r
// EditReleaseAsset edits a repository release asset.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#edit-a-release-asset
-func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int, release *ReleaseAsset) (*ReleaseAsset, *Response, error) {
+func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
req, err := s.client.NewRequest("PATCH", u, release)
@@ -272,6 +292,9 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
asset := new(ReleaseAsset)
resp, err := s.client.Do(ctx, req, asset)
if err != nil {
@@ -283,7 +306,7 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo
// DeleteReleaseAsset delete a single release asset from a repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#delete-a-release-asset
-func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int) (*Response, error) {
+func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id)
req, err := s.client.NewRequest("DELETE", u, nil)
@@ -297,7 +320,7 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep
// To upload assets that cannot be represented by an os.File, call NewUploadRequest directly.
//
// GitHub API docs: https://developer.github.com/v3/repos/releases/#upload-a-release-asset
-func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) {
+func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opt *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id)
u, err := addOptions(u, opt)
if err != nil {
@@ -318,6 +341,9 @@ func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, rep
return nil, nil, err
}
+ // TODO: remove custom Accept header when this API fully launches.
+ req.Header.Set("Accept", mediaTypeGraphQLNodeIDPreview)
+
asset := new(ReleaseAsset)
resp, err := s.client.Do(ctx, req, asset)
if err != nil {