Update godeps

This commit is contained in:
Jeff Mitchell
2016-03-10 22:50:44 -05:00
parent ab275aec81
commit 1b89fedc0b
323 changed files with 24705 additions and 28491 deletions

View File

@@ -217,7 +217,7 @@ type PageBuildEvent struct {
Build *PagesBuild `json:"build,omitempty"`
// The following fields are only populated by Webhook events.
ID *string `json:"id,omitempty"`
ID *int `json:"id,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
}
@@ -301,14 +301,15 @@ func (p PushEvent) String() string {
// PushEventCommit represents a git commit in a GitHub PushEvent.
type PushEventCommit struct {
SHA *string `json:"sha,omitempty"`
Message *string `json:"message,omitempty"`
Author *CommitAuthor `json:"author,omitempty"`
URL *string `json:"url,omitempty"`
Distinct *bool `json:"distinct,omitempty"`
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
Modified []string `json:"modified,omitempty"`
SHA *string `json:"sha,omitempty"`
Message *string `json:"message,omitempty"`
Author *CommitAuthor `json:"author,omitempty"`
Committer *CommitAuthor `json:"committer,omitempty"`
URL *string `json:"url,omitempty"`
Distinct *bool `json:"distinct,omitempty"`
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
Modified []string `json:"modified,omitempty"`
}
func (p PushEventCommit) String() string {
@@ -341,6 +342,10 @@ type PushEventRepository struct {
DefaultBranch *string `json:"default_branch,omitempty"`
MasterBranch *string `json:"master_branch,omitempty"`
Organization *string `json:"organization,omitempty"`
// The following fields are only populated by Webhook events.
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
}
// PushEventRepoOwner is a basic reporesntation of user/org in a PushEvent payload

View File

@@ -37,6 +37,9 @@ type CommitAuthor struct {
Date *time.Time `json:"date,omitempty"`
Name *string `json:"name,omitempty"`
Email *string `json:"email,omitempty"`
// The following fields are only populated by Webhook events.
Login *string `json:"username,omitempty"` // Renamed for go-github consistency.
}
func (c CommitAuthor) String() string {

View File

@@ -59,6 +59,9 @@ const (
// https://developer.github.com/changes/2016-02-11-issue-locking-api/
mediaTypeIssueLockingPreview = "application/vnd.github.the-key-preview+json"
// https://developer.github.com/changes/2016-02-24-commit-reference-sha-api/
mediaTypeCommitReferenceSHAPreview = "application/vnd.github.chitauri-preview+sha"
)
// A Client manages communication with the GitHub API.

View File

@@ -13,6 +13,9 @@ import (
// Milestone represents a Github repository milestone.
type Milestone struct {
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
LabelsURL *string `json:"labels_url,omitempty"`
ID *int `json:"id,omitempty"`
Number *int `json:"number,omitempty"`
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
@@ -22,6 +25,7 @@ type Milestone struct {
ClosedIssues *int `json:"closed_issues,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
DueOn *time.Time `json:"due_on,omitempty"`
}

View File

@@ -13,6 +13,7 @@ import (
// PullRequestComment represents a comment left on a pull request.
type PullRequestComment struct {
ID *int `json:"id,omitempty"`
InReplyTo *int `json:"in_reply_to,omitempty"`
Body *string `json:"body,omitempty"`
Path *string `json:"path,omitempty"`
DiffHunk *string `json:"diff_hunk,omitempty"`

View File

@@ -538,3 +538,22 @@ func (s *RepositoriesService) EditBranch(owner, repo, branchName string, branch
return b, resp, err
}
// License gets the contents of a repository's license if one is detected.
//
// GitHub API docs: https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license
func (s *RepositoriesService) License(owner, repo string) (*License, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/license", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
r := &Repository{}
resp, err := s.client.Do(req, r)
if err != nil {
return nil, resp, err
}
return r.License, resp, err
}

View File

@@ -6,6 +6,7 @@
package github
import (
"bytes"
"fmt"
"time"
)
@@ -146,6 +147,33 @@ func (s *RepositoriesService) GetCommit(owner, repo, sha string) (*RepositoryCom
return commit, resp, err
}
// GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is
// supplied and no new commits have occurred, a 304 Unmodified response is returned.
//
// GitHub API docs: https://developer.github.com/v3/repos/commits/#get-the-sha-1-of-a-commit-reference
func (s *RepositoriesService) GetCommitSHA1(owner, repo, ref, lastSHA string) (string, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, ref)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return "", nil, err
}
if lastSHA != "" {
req.Header.Set("If-None-Match", `"`+lastSHA+`"`)
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeCommitReferenceSHAPreview)
var buf bytes.Buffer
resp, err := s.client.Do(req, &buf)
if err != nil {
return "", resp, err
}
return buf.String(), resp, err
}
// CompareCommits compares a range of commits with each other.
// todo: support media formats - https://github.com/google/go-github/issues/6
//

View File

@@ -103,7 +103,9 @@ func (s *RepositoriesService) CreateDeployment(owner, repo string, request *Depl
// DeploymentStatus represents the status of a
// particular deployment.
type DeploymentStatus struct {
ID *int `json:"id,omitempty"`
ID *int `json:"id,omitempty"`
// State is the deployment state.
// Possible values are: "pending", "success", "failure", "error".
State *string `json:"state,omitempty"`
Creator *User `json:"creator,omitempty"`
Description *string `json:"description,omitempty"`