aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/repos_deployments.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/repos_deployments.go')
-rw-r--r--vendor/github.com/google/go-github/github/repos_deployments.go38
1 files changed, 30 insertions, 8 deletions
diff --git a/vendor/github.com/google/go-github/github/repos_deployments.go b/vendor/github.com/google/go-github/github/repos_deployments.go
index 4b40fbe..32a9a25 100644
--- a/vendor/github.com/google/go-github/github/repos_deployments.go
+++ b/vendor/github.com/google/go-github/github/repos_deployments.go
@@ -73,19 +73,18 @@ func (s *RepositoriesService) ListDeployments(owner, repo string, opt *Deploymen
return nil, nil, err
}
- deployments := new([]*Deployment)
- resp, err := s.client.Do(req, deployments)
+ var deployments []*Deployment
+ resp, err := s.client.Do(req, &deployments)
if err != nil {
return nil, resp, err
}
- return *deployments, resp, err
+ return deployments, resp, nil
}
// GetDeployment returns a single deployment of a repository.
//
-// GitHub API docs: https://developer.github.com/v3/repos/deployments/
-// Note: GetDeployment uses the undocumented GitHub API endpoint /repos/:owner/:repo/deployments/:id.
+// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment
func (s *RepositoriesService) GetDeployment(owner, repo string, deploymentID int) (*Deployment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID)
@@ -167,13 +166,36 @@ func (s *RepositoriesService) ListDeploymentStatuses(owner, repo string, deploym
return nil, nil, err
}
- statuses := new([]*DeploymentStatus)
- resp, err := s.client.Do(req, statuses)
+ var statuses []*DeploymentStatus
+ resp, err := s.client.Do(req, &statuses)
if err != nil {
return nil, resp, err
}
- return *statuses, resp, err
+ return statuses, resp, nil
+}
+
+// GetDeploymentStatus returns a single deployment status of a repository.
+//
+// GitHub API docs: https://developer.github.com/v3/repos/deployments/#get-a-single-deployment-status
+func (s *RepositoriesService) GetDeploymentStatus(owner, repo string, deploymentID, deploymentStatusID int) (*DeploymentStatus, *Response, error) {
+ u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID)
+
+ req, err := s.client.NewRequest("GET", u, nil)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ // TODO: remove custom Accept header when deployment support fully launches
+ req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
+
+ d := new(DeploymentStatus)
+ resp, err := s.client.Do(req, d)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return d, resp, err
}
// CreateDeploymentStatus creates a new status for a deployment.