1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Update dependencies to latest versions

This commit is contained in:
Chris Cummer
2019-01-11 16:44:42 -08:00
parent ea27f40164
commit 48cb7ba773
358 changed files with 29553 additions and 8982 deletions

View File

@@ -22,9 +22,11 @@ Allen Sun <shlallen1990@gmail.com>
Amey Sakhadeo <me@ameyms.com>
Andreas Garnæs <https://github.com/andreas>
Andrew Ryabchun <aryabchun@mail.ua>
Andy Grunwald <andygrunwald@gmail.com>
Andy Hume <andyhume@gmail.com>
Andy Lindeman <andy@lindeman.io>
Anshuman Bhartiya <anshuman.bhartiya@gmail.com>
Antoine <antoine.tu@mail.mcgill.ca>
Antoine Pelisse <apelisse@gmail.com>
Anubha Kushwaha <anubha_bt2k14@dtu.ac.in>
appilon <apilon@hashicorp.com>
@@ -56,6 +58,7 @@ Craig Peterson <cpeterson@stackoverflow.com>
Cristian Maglie <c.maglie@bug.st>
Daehyeok Mun <daehyeok@gmail.com>
Daniel Leavitt <daniel.leavitt@gmail.com>
Daniel Nilsson <daniel.nilsson1989@gmail.com>
Dave Du Cros <davidducros@gmail.com>
Dave Henderson <dhenderson@gmail.com>
David Deng <daviddengcn@gmail.com>
@@ -73,6 +76,7 @@ Eli Uriegas <seemethere101@gmail.com>
Elliott Beach <elliott2.71828@gmail.com>
Emerson Wood <emersonwood94@gmail.com>
eperm <staffordworrell@gmail.com>
Erick Fejta <erick@fejta.com>
erwinvaneyk <erwinvaneyk@gmail.com>
Fabrice <fabrice.vaillant@student.ecp.fr>
Filippo Valsorda <hi@filippo.io>
@@ -85,6 +89,7 @@ George Kontridze <george.kontridze@gmail.com>
Georgy Buranov <gburanov@gmail.com>
Gnahz <p@oath.pl>
Google Inc.
Grachev Mikhail <work@mgrachev.com>
griffin_stewie <panterathefamilyguy@gmail.com>
Guillaume Jacquet <guillaume.jacquet@gmail.com>
Guz Alexander <kalimatas@gmail.com>
@@ -117,6 +122,8 @@ Justin Abrahms <justin@abrah.ms>
Jusung Lee <e.jusunglee@gmail.com>
jzhoucliqr <jzhou@cliqr.com>
Katrina Owen <kytrinyx@github.com>
Kautilya Tripathi < tripathi.kautilya@gmail.com>
Kautilya Tripathi <tripathi.kautilya@gmail.com>
Keita Urashima <ursm@ursm.jp>
Kevin Burke <kev@inburke.com>
Konrad Malawski <konrad.malawski@project13.pl>
@@ -124,6 +131,7 @@ Kookheon Kwon <kucuny@gmail.com>
Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Kshitij Saraogi <KshitijSaraogi@gmail.com>
kyokomi <kyoko1220adword@gmail.com>
Lovro Mažgon <lovro.mazgon@gmail.com>
Lucas Alcantara <lucasalcantaraf@gmail.com>
Luke Evers <me@lukevers.com>
Luke Kysow <lkysow@gmail.com>
@@ -142,6 +150,7 @@ Michael Spiegel <michael.m.spiegel@gmail.com>
Michael Tiller <michael.tiller@gmail.com>
Michał Glapa <michal.glapa@gmail.com>
Nathan VanBenschoten <nvanbenschoten@gmail.com>
Navaneeth Suresh <navaneeths1998@gmail.com>
Neil O'Toole <neilotoole@apache.org>
Nick Miyake <nmiyake@palantir.com>
Nick Spragg <nick.spragg@bbc.co.uk>
@@ -150,6 +159,7 @@ Noah Zoschke <noah+sso2@convox.com>
ns-cweber <cweber@narrativescience.com>
Oleg Kovalov <iamolegkovalov@gmail.com>
Ondřej Kupka <ondra.cap@gmail.com>
Palash Nigam <npalash25@gmail.com>
Panagiotis Moustafellos <pmoust@gmail.com>
Parham Alvani <parham.alvani@gmail.com>
Parker Moore <parkrmoore@gmail.com>
@@ -171,6 +181,7 @@ Rob Figueiredo <robfig@yext.com>
Rohit Upadhyay <urohit011@gmail.com>
Ronak Jain <ronakjain@outlook.in>
Ruben Vereecken <rubenvereecken@gmail.com>
Ryan Leung <rleungx@gmail.com>
Ryan Lower <rpjlower@gmail.com>
Sahil Dua <sahildua2305@gmail.com>
saisi <saisi@users.noreply.github.com>
@@ -184,10 +195,12 @@ Sebastian Mandrean <sebastian.mandrean@gmail.com>
Sebastian Mæland Pedersen <sem.pedersen@stud.uis.no>
Sevki <s@sevki.org>
Shagun Khemka <shagun.khemka60@gmail.com>
shakeelrao <shakeelrao79@gmail.com>
Shawn Catanzarite <me@shawncatz.com>
Shawn Smith <shawnpsmith@gmail.com>
sona-tar <sona.zip@gmail.com>
SoundCloud, Ltd.
Sridhar Mocherla <srmocher@microsoft.com>
Stian Eikeland <stian@eikeland.se>
Tasya Aditya Rukmana <tadityar@gmail.com>
Thomas Bruyelle <thomas.bruyelle@gmail.com>
@@ -198,6 +211,7 @@ Varadarajan Aravamudhan <varadaraajan@gmail.com>
Victor Castell <victor@victorcastell.com>
Victor Vrantchan <vrancean+github@gmail.com>
Vlad Ungureanu <vladu@palantir.com>
Wasim Thabraze <wasim@thabraze.me>
Will Maier <wcmaier@gmail.com>
William Bailey <mail@williambailey.org.uk>
xibz <impactbchang@gmail.com>

View File

@@ -7,124 +7,9 @@ package github
import (
"context"
"encoding/json"
"fmt"
"time"
)
// Event represents a GitHub event.
type Event struct {
Type *string `json:"type,omitempty"`
Public *bool `json:"public,omitempty"`
RawPayload *json.RawMessage `json:"payload,omitempty"`
Repo *Repository `json:"repo,omitempty"`
Actor *User `json:"actor,omitempty"`
Org *Organization `json:"org,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ID *string `json:"id,omitempty"`
}
func (e Event) String() string {
return Stringify(e)
}
// ParsePayload parses the event payload. For recognized event types,
// a value of the corresponding struct type will be returned.
func (e *Event) ParsePayload() (payload interface{}, err error) {
switch *e.Type {
case "CheckRunEvent":
payload = &CheckRunEvent{}
case "CheckSuiteEvent":
payload = &CheckSuiteEvent{}
case "CommitCommentEvent":
payload = &CommitCommentEvent{}
case "CreateEvent":
payload = &CreateEvent{}
case "DeleteEvent":
payload = &DeleteEvent{}
case "DeploymentEvent":
payload = &DeploymentEvent{}
case "DeploymentStatusEvent":
payload = &DeploymentStatusEvent{}
case "ForkEvent":
payload = &ForkEvent{}
case "GollumEvent":
payload = &GollumEvent{}
case "InstallationEvent":
payload = &InstallationEvent{}
case "InstallationRepositoriesEvent":
payload = &InstallationRepositoriesEvent{}
case "IssueCommentEvent":
payload = &IssueCommentEvent{}
case "IssuesEvent":
payload = &IssuesEvent{}
case "LabelEvent":
payload = &LabelEvent{}
case "MarketplacePurchaseEvent":
payload = &MarketplacePurchaseEvent{}
case "MemberEvent":
payload = &MemberEvent{}
case "MembershipEvent":
payload = &MembershipEvent{}
case "MilestoneEvent":
payload = &MilestoneEvent{}
case "OrganizationEvent":
payload = &OrganizationEvent{}
case "OrgBlockEvent":
payload = &OrgBlockEvent{}
case "PageBuildEvent":
payload = &PageBuildEvent{}
case "PingEvent":
payload = &PingEvent{}
case "ProjectEvent":
payload = &ProjectEvent{}
case "ProjectCardEvent":
payload = &ProjectCardEvent{}
case "ProjectColumnEvent":
payload = &ProjectColumnEvent{}
case "PublicEvent":
payload = &PublicEvent{}
case "PullRequestEvent":
payload = &PullRequestEvent{}
case "PullRequestReviewEvent":
payload = &PullRequestReviewEvent{}
case "PullRequestReviewCommentEvent":
payload = &PullRequestReviewCommentEvent{}
case "PushEvent":
payload = &PushEvent{}
case "ReleaseEvent":
payload = &ReleaseEvent{}
case "RepositoryEvent":
payload = &RepositoryEvent{}
case "RepositoryVulnerabilityAlertEvent":
payload = &RepositoryVulnerabilityAlertEvent{}
case "StatusEvent":
payload = &StatusEvent{}
case "TeamEvent":
payload = &TeamEvent{}
case "TeamAddEvent":
payload = &TeamAddEvent{}
case "WatchEvent":
payload = &WatchEvent{}
}
err = json.Unmarshal(*e.RawPayload, &payload)
return payload, err
}
// Payload returns the parsed event payload. For recognized event types,
// a value of the corresponding struct type will be returned.
//
// Deprecated: Use ParsePayload instead, which returns an error
// rather than panics if JSON unmarshaling raw payload fails.
func (e *Event) Payload() (payload interface{}) {
var err error
payload, err = e.ParsePayload()
if err != nil {
panic(err)
}
return payload
}
// ListEvents drinks from the firehose of all public events across GitHub.
//
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events

View File

@@ -27,36 +27,52 @@ type MarketplaceService struct {
// MarketplacePlan represents a GitHub Apps Marketplace Listing Plan.
type MarketplacePlan struct {
URL *string `json:"url,omitempty"`
AccountsURL *string `json:"accounts_url,omitempty"`
ID *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"`
YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"`
PriceModel *string `json:"price_model,omitempty"`
UnitName *string `json:"unit_name,omitempty"`
Bullets *[]string `json:"bullets,omitempty"`
URL *string `json:"url,omitempty"`
AccountsURL *string `json:"accounts_url,omitempty"`
ID *int64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
MonthlyPriceInCents *int `json:"monthly_price_in_cents,omitempty"`
YearlyPriceInCents *int `json:"yearly_price_in_cents,omitempty"`
// The pricing model for this listing. Can be one of "flat-rate", "per-unit", or "free".
PriceModel *string `json:"price_model,omitempty"`
UnitName *string `json:"unit_name,omitempty"`
Bullets *[]string `json:"bullets,omitempty"`
// State can be one of the values "draft" or "published".
State *string `json:"state,omitempty"`
HasFreeTrial *bool `json:"has_free_trial,omitempty"`
}
// MarketplacePurchase represents a GitHub Apps Marketplace Purchase.
type MarketplacePurchase struct {
// BillingCycle can be one of the values "yearly", "monthly" or nil.
BillingCycle *string `json:"billing_cycle,omitempty"`
NextBillingDate *string `json:"next_billing_date,omitempty"`
NextBillingDate *Timestamp `json:"next_billing_date,omitempty"`
UnitCount *int `json:"unit_count,omitempty"`
Plan *MarketplacePlan `json:"plan,omitempty"`
Account *MarketplacePlanAccount `json:"account,omitempty"`
OnFreeTrial *bool `json:"on_free_trial,omitempty"`
FreeTrialEndsOn *Timestamp `json:"free_trial_ends_on,omitempty"`
}
// MarketplacePendingChange represents a pending change to a GitHub Apps Marketplace Plan.
type MarketplacePendingChange struct {
EffectiveDate *Timestamp `json:"effective_date,omitempty"`
UnitCount *int `json:"unit_count,omitempty"`
ID *int64 `json:"id,omitempty"`
Plan *MarketplacePlan `json:"plan,omitempty"`
}
// MarketplacePlanAccount represents a GitHub Account (user or organization) on a specific plan.
type MarketplacePlanAccount struct {
URL *string `json:"url,omitempty"`
Type *string `json:"type,omitempty"`
ID *int64 `json:"id,omitempty"`
Login *string `json:"login,omitempty"`
Email *string `json:"email,omitempty"`
OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"`
MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
URL *string `json:"url,omitempty"`
Type *string `json:"type,omitempty"`
ID *int64 `json:"id,omitempty"`
Login *string `json:"login,omitempty"`
Email *string `json:"email,omitempty"`
OrganizationBillingEmail *string `json:"organization_billing_email,omitempty"`
MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
MarketplacePendingChange *MarketplacePendingChange `json:"marketplace_pending_change,omitempty"`
}
// ListPlans lists all plans for your Marketplace listing.
@@ -155,7 +171,6 @@ func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context
if err != nil {
return nil, resp, err
}
return purchases, resp, nil
}

View File

@@ -24,6 +24,7 @@ type CheckRun struct {
ExternalID *string `json:"external_id,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
DetailsURL *string `json:"details_url,omitempty"`
Status *string `json:"status,omitempty"`
Conclusion *string `json:"conclusion,omitempty"`
StartedAt *Timestamp `json:"started_at,omitempty"`
@@ -133,16 +134,24 @@ func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, c
// CreateCheckRunOptions sets up parameters needed to create a CheckRun.
type CreateCheckRunOptions struct {
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.)
HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch string `json:"head_branch"` // The name of the branch to perform a check against. (Required.)
HeadSHA string `json:"head_sha"` // The SHA of the commit. (Required.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
StartedAt *Timestamp `json:"started_at,omitempty"` // The time that the check run began. (Optional.)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
Actions []*CheckRunAction `json:"actions,omitempty"` // Possible further actions the integrator can perform, which a user may trigger. (Optional.)
}
// CheckRunAction exposes further actions the integrator can perform, which a user may trigger.
type CheckRunAction struct {
Label string `json:"label"` // The text to be displayed on a button in the web UI. The maximum size is 20 characters. (Required.)
Description string `json:"description"` // A short explanation of what this action would do. The maximum size is 40 characters. (Required.)
Identifier string `json:"identifier"` // A reference for the action on the integrator's system. The maximum size is 20 characters. (Required.)
}
// CreateCheckRun creates a check run for repository.
@@ -168,15 +177,16 @@ func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string,
// UpdateCheckRunOptions sets up parameters needed to update a CheckRun.
type UpdateCheckRunOptions struct {
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.)
HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
HeadBranch *string `json:"head_branch,omitempty"` // The name of the branch to perform a check against. (Optional.)
HeadSHA *string `json:"head_sha,omitempty"` // The SHA of the commit. (Optional.)
DetailsURL *string `json:"details_url,omitempty"` // The URL of the integrator's site that has the full details of the check. (Optional.)
ExternalID *string `json:"external_id,omitempty"` // A reference for the run on the integrator's system. (Optional.)
Status *string `json:"status,omitempty"` // The current status. Can be one of "queued", "in_progress", or "completed". Default: "queued". (Optional.)
Conclusion *string `json:"conclusion,omitempty"` // Can be one of "success", "failure", "neutral", "cancelled", "timed_out", or "action_required". (Optional. Required if you provide a status of "completed".)
CompletedAt *Timestamp `json:"completed_at,omitempty"` // The time the check completed. (Optional. Required if you provide conclusion.)
Output *CheckRunOutput `json:"output,omitempty"` // Provide descriptive details about the run. (Optional)
Actions []*CheckRunAction `json:"actions,omitempty"` // Possible further actions the integrator can perform, which a user may trigger. (Optional.)
}
// UpdateCheckRun updates a check run for a specific commit in a repository.

126
vendor/github.com/google/go-github/github/event.go generated vendored Normal file
View File

@@ -0,0 +1,126 @@
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"encoding/json"
"time"
)
// Event represents a GitHub event.
type Event struct {
Type *string `json:"type,omitempty"`
Public *bool `json:"public,omitempty"`
RawPayload *json.RawMessage `json:"payload,omitempty"`
Repo *Repository `json:"repo,omitempty"`
Actor *User `json:"actor,omitempty"`
Org *Organization `json:"org,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ID *string `json:"id,omitempty"`
}
func (e Event) String() string {
return Stringify(e)
}
// ParsePayload parses the event payload. For recognized event types,
// a value of the corresponding struct type will be returned.
func (e *Event) ParsePayload() (payload interface{}, err error) {
switch *e.Type {
case "CheckRunEvent":
payload = &CheckRunEvent{}
case "CheckSuiteEvent":
payload = &CheckSuiteEvent{}
case "CommitCommentEvent":
payload = &CommitCommentEvent{}
case "CreateEvent":
payload = &CreateEvent{}
case "DeleteEvent":
payload = &DeleteEvent{}
case "DeploymentEvent":
payload = &DeploymentEvent{}
case "DeploymentStatusEvent":
payload = &DeploymentStatusEvent{}
case "ForkEvent":
payload = &ForkEvent{}
case "GitHubAppAuthorizationEvent":
payload = &GitHubAppAuthorizationEvent{}
case "GollumEvent":
payload = &GollumEvent{}
case "InstallationEvent":
payload = &InstallationEvent{}
case "InstallationRepositoriesEvent":
payload = &InstallationRepositoriesEvent{}
case "IssueCommentEvent":
payload = &IssueCommentEvent{}
case "IssuesEvent":
payload = &IssuesEvent{}
case "LabelEvent":
payload = &LabelEvent{}
case "MarketplacePurchaseEvent":
payload = &MarketplacePurchaseEvent{}
case "MemberEvent":
payload = &MemberEvent{}
case "MembershipEvent":
payload = &MembershipEvent{}
case "MilestoneEvent":
payload = &MilestoneEvent{}
case "OrganizationEvent":
payload = &OrganizationEvent{}
case "OrgBlockEvent":
payload = &OrgBlockEvent{}
case "PageBuildEvent":
payload = &PageBuildEvent{}
case "PingEvent":
payload = &PingEvent{}
case "ProjectEvent":
payload = &ProjectEvent{}
case "ProjectCardEvent":
payload = &ProjectCardEvent{}
case "ProjectColumnEvent":
payload = &ProjectColumnEvent{}
case "PublicEvent":
payload = &PublicEvent{}
case "PullRequestEvent":
payload = &PullRequestEvent{}
case "PullRequestReviewEvent":
payload = &PullRequestReviewEvent{}
case "PullRequestReviewCommentEvent":
payload = &PullRequestReviewCommentEvent{}
case "PushEvent":
payload = &PushEvent{}
case "ReleaseEvent":
payload = &ReleaseEvent{}
case "RepositoryEvent":
payload = &RepositoryEvent{}
case "RepositoryVulnerabilityAlertEvent":
payload = &RepositoryVulnerabilityAlertEvent{}
case "StatusEvent":
payload = &StatusEvent{}
case "TeamEvent":
payload = &TeamEvent{}
case "TeamAddEvent":
payload = &TeamAddEvent{}
case "WatchEvent":
payload = &WatchEvent{}
}
err = json.Unmarshal(*e.RawPayload, &payload)
return payload, err
}
// Payload returns the parsed event payload. For recognized event types,
// a value of the corresponding struct type will be returned.
//
// Deprecated: Use ParsePayload instead, which returns an error
// rather than panics if JSON unmarshaling raw payload fails.
func (e *Event) Payload() (payload interface{}) {
var err error
payload, err = e.ParsePayload()
if err != nil {
panic(err)
}
return payload
}

View File

@@ -7,13 +7,19 @@
package github
// RequestedAction is included in a CheckRunEvent when a user has invoked an action,
// i.e. when the CheckRunEvent's Action field is "requested_action".
type RequestedAction struct {
Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
}
// CheckRunEvent is triggered when a check run is "created", "updated", or "re-requested".
// The Webhook event name is "check_run".
//
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent
type CheckRunEvent struct {
CheckRun *CheckRun `json:"check_run,omitempty"`
// The action performed. Can be "created", "updated" or "re-requested".
// The action performed. Can be "created", "updated", "rerequested" or "requested_action".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
@@ -21,6 +27,9 @@ type CheckRunEvent struct {
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
// The action requested by the user. Populated when the Action is "requested_action".
RequestedAction *RequestedAction `json:"requested_action,omitempty"` //
}
// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "re-requested".
@@ -139,6 +148,18 @@ type ForkEvent struct {
Installation *Installation `json:"installation,omitempty"`
}
// GitHubAppAuthorizationEvent is triggered when a user's authorization for a
// GitHub Application is revoked.
//
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#githubappauthorizationevent
type GitHubAppAuthorizationEvent struct {
// The action performed. Can be "revoked".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
}
// Page represents a single Wiki page.
type Page struct {
PageName *string `json:"page_name,omitempty"`
@@ -308,7 +329,7 @@ type LabelEvent struct {
// Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent
type MarketplacePurchaseEvent struct {
// Action is the action that was performed. Possible values are:
// "purchased", "cancelled", "changed".
// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
Action *string `json:"action,omitempty"`
// The following fields are only populated by Webhook events.

View File

@@ -68,9 +68,6 @@ func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, s
return nil, nil, err
}
// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
c := new(Commit)
resp, err := s.client.Do(ctx, req, c)
if err != nil {

View File

@@ -43,9 +43,6 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha
return nil, nil, err
}
// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
tag := new(Tag)
resp, err := s.client.Do(ctx, req, tag)
return tag, resp, err

View File

@@ -492,6 +492,14 @@ func (c *CheckRun) GetConclusion() string {
return *c.Conclusion
}
// GetDetailsURL returns the DetailsURL field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetDetailsURL() string {
if c == nil || c.DetailsURL == nil {
return ""
}
return *c.DetailsURL
}
// GetExternalID returns the ExternalID field if it's non-nil, zero value otherwise.
func (c *CheckRun) GetExternalID() string {
if c == nil || c.ExternalID == nil {
@@ -676,6 +684,14 @@ func (c *CheckRunEvent) GetRepo() *Repository {
return c.Repo
}
// GetRequestedAction returns the RequestedAction field.
func (c *CheckRunEvent) GetRequestedAction() *RequestedAction {
if c == nil {
return nil
}
return c.RequestedAction
}
// GetSender returns the Sender field.
func (c *CheckRunEvent) GetSender() *User {
if c == nil {
@@ -1292,6 +1308,14 @@ func (c *CommitFile) GetPatch() string {
return *c.Patch
}
// GetPreviousFilename returns the PreviousFilename field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetPreviousFilename() string {
if c == nil || c.PreviousFilename == nil {
return ""
}
return *c.PreviousFilename
}
// GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetRawURL() string {
if c == nil || c.RawURL == nil {
@@ -2292,6 +2316,14 @@ func (d *DeploymentStatusRequest) GetDescription() string {
return *d.Description
}
// GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetEnvironment() string {
if d == nil || d.Environment == nil {
return ""
}
return *d.Environment
}
// GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetEnvironmentURL() string {
if d == nil || d.EnvironmentURL == nil {
@@ -2916,6 +2948,22 @@ func (g *GistStats) GetTotalGists() int {
return *g.TotalGists
}
// GetAction returns the Action field if it's non-nil, zero value otherwise.
func (g *GitHubAppAuthorizationEvent) GetAction() string {
if g == nil || g.Action == nil {
return ""
}
return *g.Action
}
// GetSender returns the Sender field.
func (g *GitHubAppAuthorizationEvent) GetSender() *User {
if g == nil {
return nil
}
return g.Sender
}
// GetName returns the Name field if it's non-nil, zero value otherwise.
func (g *Gitignore) GetName() string {
if g == nil || g.Name == nil {
@@ -3564,6 +3612,30 @@ func (i *InstallationToken) GetToken() string {
return *i.Token
}
// GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
func (i *InteractionRestriction) GetExpiresAt() Timestamp {
if i == nil || i.ExpiresAt == nil {
return Timestamp{}
}
return *i.ExpiresAt
}
// GetLimit returns the Limit field if it's non-nil, zero value otherwise.
func (i *InteractionRestriction) GetLimit() string {
if i == nil || i.Limit == nil {
return ""
}
return *i.Limit
}
// GetOrigin returns the Origin field if it's non-nil, zero value otherwise.
func (i *InteractionRestriction) GetOrigin() string {
if i == nil || i.Origin == nil {
return ""
}
return *i.Origin
}
// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (i *Invitation) GetCreatedAt() time.Time {
if i == nil || i.CreatedAt == nil {
@@ -4060,6 +4132,14 @@ func (i *IssueEvent) GetMilestone() *Milestone {
return i.Milestone
}
// GetProjectCard returns the ProjectCard field.
func (i *IssueEvent) GetProjectCard() *ProjectCard {
if i == nil {
return nil
}
return i.ProjectCard
}
// GetRename returns the Rename field.
func (i *IssueEvent) GetRename() *Rename {
if i == nil {
@@ -4636,6 +4716,46 @@ func (l *ListCheckSuiteResults) GetTotal() int {
return *l.Total
}
// GetAffiliation returns the Affiliation field if it's non-nil, zero value otherwise.
func (l *ListCollaboratorOptions) GetAffiliation() string {
if l == nil || l.Affiliation == nil {
return ""
}
return *l.Affiliation
}
// GetEffectiveDate returns the EffectiveDate field if it's non-nil, zero value otherwise.
func (m *MarketplacePendingChange) GetEffectiveDate() Timestamp {
if m == nil || m.EffectiveDate == nil {
return Timestamp{}
}
return *m.EffectiveDate
}
// GetID returns the ID field if it's non-nil, zero value otherwise.
func (m *MarketplacePendingChange) GetID() int64 {
if m == nil || m.ID == nil {
return 0
}
return *m.ID
}
// GetPlan returns the Plan field.
func (m *MarketplacePendingChange) GetPlan() *MarketplacePlan {
if m == nil {
return nil
}
return m.Plan
}
// GetUnitCount returns the UnitCount field if it's non-nil, zero value otherwise.
func (m *MarketplacePendingChange) GetUnitCount() int {
if m == nil || m.UnitCount == nil {
return 0
}
return *m.UnitCount
}
// GetAccountsURL returns the AccountsURL field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetAccountsURL() string {
if m == nil || m.AccountsURL == nil {
@@ -4660,6 +4780,14 @@ func (m *MarketplacePlan) GetDescription() string {
return *m.Description
}
// GetHasFreeTrial returns the HasFreeTrial field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetHasFreeTrial() bool {
if m == nil || m.HasFreeTrial == nil {
return false
}
return *m.HasFreeTrial
}
// GetID returns the ID field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetID() int64 {
if m == nil || m.ID == nil {
@@ -4692,6 +4820,14 @@ func (m *MarketplacePlan) GetPriceModel() string {
return *m.PriceModel
}
// GetState returns the State field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetState() string {
if m == nil || m.State == nil {
return ""
}
return *m.State
}
// GetUnitName returns the UnitName field if it's non-nil, zero value otherwise.
func (m *MarketplacePlan) GetUnitName() string {
if m == nil || m.UnitName == nil {
@@ -4740,6 +4876,14 @@ func (m *MarketplacePlanAccount) GetLogin() string {
return *m.Login
}
// GetMarketplacePendingChange returns the MarketplacePendingChange field.
func (m *MarketplacePlanAccount) GetMarketplacePendingChange() *MarketplacePendingChange {
if m == nil {
return nil
}
return m.MarketplacePendingChange
}
// GetMarketplacePurchase returns the MarketplacePurchase field.
func (m *MarketplacePlanAccount) GetMarketplacePurchase() *MarketplacePurchase {
if m == nil {
@@ -4788,14 +4932,30 @@ func (m *MarketplacePurchase) GetBillingCycle() string {
return *m.BillingCycle
}
// GetFreeTrialEndsOn returns the FreeTrialEndsOn field if it's non-nil, zero value otherwise.
func (m *MarketplacePurchase) GetFreeTrialEndsOn() Timestamp {
if m == nil || m.FreeTrialEndsOn == nil {
return Timestamp{}
}
return *m.FreeTrialEndsOn
}
// GetNextBillingDate returns the NextBillingDate field if it's non-nil, zero value otherwise.
func (m *MarketplacePurchase) GetNextBillingDate() string {
func (m *MarketplacePurchase) GetNextBillingDate() Timestamp {
if m == nil || m.NextBillingDate == nil {
return ""
return Timestamp{}
}
return *m.NextBillingDate
}
// GetOnFreeTrial returns the OnFreeTrial field if it's non-nil, zero value otherwise.
func (m *MarketplacePurchase) GetOnFreeTrial() bool {
if m == nil || m.OnFreeTrial == nil {
return false
}
return *m.OnFreeTrial
}
// GetPlan returns the Plan field.
func (m *MarketplacePurchase) GetPlan() *MarketplacePlan {
if m == nil {
@@ -6404,6 +6564,14 @@ func (p *ProjectCard) GetColumnID() int64 {
return *p.ColumnID
}
// GetColumnName returns the ColumnName field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetColumnName() string {
if p == nil || p.ColumnName == nil {
return ""
}
return *p.ColumnName
}
// GetColumnURL returns the ColumnURL field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetColumnURL() string {
if p == nil || p.ColumnURL == nil {
@@ -6460,6 +6628,30 @@ func (p *ProjectCard) GetNote() string {
return *p.Note
}
// GetPreviousColumnName returns the PreviousColumnName field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetPreviousColumnName() string {
if p == nil || p.PreviousColumnName == nil {
return ""
}
return *p.PreviousColumnName
}
// GetProjectID returns the ProjectID field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetProjectID() int64 {
if p == nil || p.ProjectID == nil {
return 0
}
return *p.ProjectID
}
// GetProjectURL returns the ProjectURL field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetProjectURL() string {
if p == nil || p.ProjectURL == nil {
return ""
}
return *p.ProjectURL
}
// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
func (p *ProjectCard) GetUpdatedAt() Timestamp {
if p == nil || p.UpdatedAt == nil {
@@ -6556,6 +6748,14 @@ func (p *ProjectCardOptions) GetArchived() bool {
return *p.Archived
}
// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
func (p *ProjectCollaboratorOptions) GetPermission() string {
if p == nil || p.Permission == nil {
return ""
}
return *p.Permission
}
// GetCardsURL returns the CardsURL field if it's non-nil, zero value otherwise.
func (p *ProjectColumn) GetCardsURL() string {
if p == nil || p.CardsURL == nil {
@@ -6780,6 +6980,22 @@ func (p *ProjectOptions) GetState() string {
return *p.State
}
// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
func (p *ProjectPermissionLevel) GetPermission() string {
if p == nil || p.Permission == nil {
return ""
}
return *p.Permission
}
// GetUser returns the User field.
func (p *ProjectPermissionLevel) GetUser() *User {
if p == nil {
return nil
}
return p.User
}
// GetEnforceAdmins returns the EnforceAdmins field.
func (p *Protection) GetEnforceAdmins() *AdminEnforcement {
if p == nil {
@@ -10100,6 +10316,22 @@ func (s *ServiceHook) GetName() string {
return *s.Name
}
// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise.
func (s *SignaturesProtectedBranch) GetEnabled() bool {
if s == nil || s.Enabled == nil {
return false
}
return *s.Enabled
}
// GetURL returns the URL field if it's non-nil, zero value otherwise.
func (s *SignaturesProtectedBranch) GetURL() string {
if s == nil || s.URL == nil {
return ""
}
return *s.URL
}
// GetPayload returns the Payload field if it's non-nil, zero value otherwise.
func (s *SignatureVerification) GetPayload() string {
if s == nil || s.Payload == nil {
@@ -10900,6 +11132,14 @@ func (t *TeamLDAPMapping) GetURL() string {
return *t.URL
}
// GetPermission returns the Permission field if it's non-nil, zero value otherwise.
func (t *TeamProjectOptions) GetPermission() string {
if t == nil || t.Permission == nil {
return ""
}
return *t.Permission
}
// GetFragment returns the Fragment field if it's non-nil, zero value otherwise.
func (t *TextMatch) GetFragment() string {
if t == nil || t.Fragment == nil {
@@ -11004,6 +11244,14 @@ func (t *Timeline) GetMilestone() *Milestone {
return t.Milestone
}
// GetProjectCard returns the ProjectCard field.
func (t *Timeline) GetProjectCard() *ProjectCard {
if t == nil {
return nil
}
return t.ProjectCard
}
// GetRename returns the Rename field.
func (t *Timeline) GetRename() *Rename {
if t == nil {
@@ -11564,6 +11812,14 @@ func (u *User) GetTotalPrivateRepos() int {
return *u.TotalPrivateRepos
}
// GetTwoFactorAuthentication returns the TwoFactorAuthentication field if it's non-nil, zero value otherwise.
func (u *User) GetTwoFactorAuthentication() bool {
if u == nil || u.TwoFactorAuthentication == nil {
return false
}
return *u.TwoFactorAuthentication
}
// GetType returns the Type field if it's non-nil, zero value otherwise.
func (u *User) GetType() string {
if u == nil || u.Type == nil {

View File

@@ -54,21 +54,18 @@ const (
// https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/
mediaTypeDeploymentStatusPreview = "application/vnd.github.ant-man-preview+json"
// https://developer.github.com/changes/2018-10-16-deployments-environments-states-and-auto-inactive-updates/
mediaTypeExpandDeploymentStatusPreview = "application/vnd.github.flash-preview+json"
// https://developer.github.com/changes/2016-02-19-source-import-preview-api/
mediaTypeImportPreview = "application/vnd.github.barred-rock-preview"
// https://developer.github.com/changes/2016-05-12-reactions-api-preview/
mediaTypeReactionsPreview = "application/vnd.github.squirrel-girl-preview"
// https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
mediaTypeGitSigningPreview = "application/vnd.github.cryptographer-preview+json"
// https://developer.github.com/changes/2016-05-23-timeline-preview-api/
mediaTypeTimelinePreview = "application/vnd.github.mockingbird-preview+json"
// https://developer.github.com/changes/2016-06-14-repository-invitations/
mediaTypeRepositoryInvitationsPreview = "application/vnd.github.swamp-thing-preview+json"
// https://developer.github.com/changes/2016-07-06-github-pages-preiew-api/
mediaTypePagesPreview = "application/vnd.github.mister-fantastic-preview+json"
@@ -122,6 +119,15 @@ const (
// https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/
mediaTypePreReceiveHooksPreview = "application/vnd.github.eye-scream-preview"
// https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/
mediaTypeSignaturePreview = "application/vnd.github.zzzax-preview+json"
// https://developer.github.com/changes/2018-09-05-project-card-events/
mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json"
// https://developer.github.com/changes/2018-12-18-interactions-preview/
mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json"
)
// A Client manages communication with the GitHub API.
@@ -154,6 +160,7 @@ type Client struct {
Gists *GistsService
Git *GitService
Gitignores *GitignoresService
Interactions *InteractionsService
Issues *IssuesService
Licenses *LicensesService
Marketplace *MarketplaceService
@@ -246,6 +253,7 @@ func NewClient(httpClient *http.Client) *Client {
c.Gists = (*GistsService)(&c.common)
c.Git = (*GitService)(&c.common)
c.Gitignores = (*GitignoresService)(&c.common)
c.Interactions = (*InteractionsService)(&c.common)
c.Issues = (*IssuesService)(&c.common)
c.Licenses = (*LicensesService)(&c.common)
c.Marketplace = &MarketplaceService{client: c}

View File

@@ -0,0 +1,28 @@
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
// InteractionsService handles communication with the repository and organization related
// methods of the GitHub API.
//
// GitHub API docs: https://developer.github.com/v3/interactions/
type InteractionsService service
// InteractionRestriction represents the interaction restrictions for repository and organization.
type InteractionRestriction struct {
// Specifies the group of GitHub users who can
// comment, open issues, or create pull requests for the given repository.
// Possible values are: "existing_users", "contributors_only" and "collaborators_only".
Limit *string `json:"limit,omitempty"`
// Origin specifies the type of the resource to interact with.
// Possible values are: "repository" and "organization".
Origin *string `json:"origin,omitempty"`
// ExpiresAt specifies the time after which the interaction restrictions expire.
// The default expiry time is 24 hours from the time restriction is created.
ExpiresAt *Timestamp `json:"expires_at,omitempty"`
}

View File

@@ -0,0 +1,80 @@
// Copyright 2019 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// GetRestrictionsForOrg fetches the interaction restrictions for an organization.
//
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#get-interaction-restrictions-for-an-organization
func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) {
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
organizationInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, organizationInteractions)
if err != nil {
return nil, resp, err
}
return organizationInteractions, resp, nil
}
// UpdateRestrictionsForOrg adds or updates the interaction restrictions for an organization.
//
// limit specifies the group of GitHub users who can comment, open issues, or create pull requests
// in public repositories for the given organization.
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
//
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#add-or-update-interaction-restrictions-for-an-organization
func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) {
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
interaction := &InteractionRestriction{Limit: String(limit)}
req, err := s.client.NewRequest("PUT", u, interaction)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
organizationInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, organizationInteractions)
if err != nil {
return nil, resp, err
}
return organizationInteractions, resp, nil
}
// RemoveRestrictionsFromOrg removes the interaction restrictions for an organization.
//
// GitHub API docs: https://developer.github.com/v3/interactions/orgs/#remove-interaction-restrictions-for-an-organization
func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) {
u := fmt.Sprintf("orgs/%v/interaction-limits", organization)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
return s.client.Do(ctx, req, nil)
}

View File

@@ -0,0 +1,80 @@
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package github
import (
"context"
"fmt"
)
// GetRestrictionsForRepo fetches the interaction restrictions for a repository.
//
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#get-interaction-restrictions-for-a-repository
func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
repositoryInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, repositoryInteractions)
if err != nil {
return nil, resp, err
}
return repositoryInteractions, resp, nil
}
// UpdateRestrictionsForRepo adds or updates the interaction restrictions for a repository.
//
// limit specifies the group of GitHub users who can comment, open issues, or create pull requests
// for the given repository.
// Possible values are: "existing_users", "contributors_only", "collaborators_only".
//
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#add-or-update-interaction-restrictions-for-a-repository
func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
interaction := &InteractionRestriction{Limit: String(limit)}
req, err := s.client.NewRequest("PUT", u, interaction)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
repositoryInteractions := new(InteractionRestriction)
resp, err := s.client.Do(ctx, req, repositoryInteractions)
if err != nil {
return nil, resp, err
}
return repositoryInteractions, resp, nil
}
// RemoveRestrictionsFromRepo removes the interaction restrictions for a repository.
//
// GitHub API docs: https://developer.github.com/v3/interactions/repos/#remove-interaction-restrictions-for-a-repository
func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
return s.client.Do(ctx, req, nil)
}

View File

@@ -8,6 +8,7 @@ package github
import (
"context"
"fmt"
"strings"
"time"
)
@@ -68,13 +69,14 @@ type IssueEvent struct {
Issue *Issue `json:"issue,omitempty"`
// Only present on certain events; see above.
Assignee *User `json:"assignee,omitempty"`
Assigner *User `json:"assigner,omitempty"`
CommitID *string `json:"commit_id,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
Label *Label `json:"label,omitempty"`
Rename *Rename `json:"rename,omitempty"`
LockReason *string `json:"lock_reason,omitempty"`
Assignee *User `json:"assignee,omitempty"`
Assigner *User `json:"assigner,omitempty"`
CommitID *string `json:"commit_id,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`
Label *Label `json:"label,omitempty"`
Rename *Rename `json:"rename,omitempty"`
LockReason *string `json:"lock_reason,omitempty"`
ProjectCard *ProjectCard `json:"project_card,omitempty"`
}
// ListIssueEvents lists events for the specified issue.
@@ -92,7 +94,8 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string,
return nil, nil, err
}
req.Header.Set("Accept", mediaTypeLockReasonPreview)
acceptHeaders := []string{mediaTypeLockReasonPreview, mediaTypeProjectCardDetailsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var events []*IssueEvent
resp, err := s.client.Do(ctx, req, &events)

View File

@@ -8,6 +8,7 @@ package github
import (
"context"
"fmt"
"strings"
"time"
)
@@ -115,7 +116,8 @@ type Timeline struct {
Source *Source `json:"source,omitempty"`
// An object containing rename details including 'from' and 'to' attributes.
// Only provided for 'renamed' events.
Rename *Rename `json:"rename,omitempty"`
Rename *Rename `json:"rename,omitempty"`
ProjectCard *ProjectCard `json:"project_card,omitempty"`
}
// Source represents a reference's source.
@@ -141,7 +143,8 @@ func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo strin
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeTimelinePreview)
acceptHeaders := []string{mediaTypeTimelinePreview, mediaTypeProjectCardDetailsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var events []*Timeline
resp, err := s.client.Do(ctx, req, &events)

View File

@@ -193,7 +193,7 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*
return s.client.Do(ctx, req, nil)
}
// UnlockUserRepository will unlock a repo that was locked for migration.
// UnlockUserRepo will unlock a repo that was locked for migration.
// id is migration ID.
// You should unlock each migrated repository and delete them when the migration
// is complete and you no longer need the source data.

View File

@@ -296,6 +296,12 @@ type ProjectCard struct {
// The following fields are only populated by Webhook events.
ColumnID *int64 `json:"column_id,omitempty"`
// The following fields are only populated by Events API.
ProjectID *int64 `json:"project_id,omitempty"`
ProjectURL *string `json:"project_url,omitempty"`
ColumnName *string `json:"column_name,omitempty"`
PreviousColumnName *string `json:"previous_column_name,omitempty"` // Populated in "moved_columns_in_project" event deliveries.
}
// ProjectCardListOptions specifies the optional parameters to the
@@ -366,7 +372,7 @@ type ProjectCardOptions struct {
// The ID (not Number) of the Issue to associate with this card.
// Note and ContentID are mutually exclusive.
ContentID int64 `json:"content_id,omitempty"`
// The type of content to associate with this card. Possible values are: "Issue".
// The type of content to associate with this card. Possible values are: "Issue" and "PullRequest".
ContentType string `json:"content_type,omitempty"`
// Use true to archive a project card.
// Specify false if you need to restore a previously archived project card.
@@ -460,3 +466,129 @@ func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opt
return s.client.Do(ctx, req, nil)
}
// ProjectCollaboratorOptions specifies the optional parameters to the
// ProjectsService.AddProjectCollaborator method.
type ProjectCollaboratorOptions struct {
// Permission specifies the permission to grant to the collaborator.
// Possible values are:
// "read" - can read, but not write to or administer this project.
// "write" - can read and write, but not administer this project.
// "admin" - can read, write and administer this project.
//
// Default value is "write"
Permission *string `json:"permission,omitempty"`
}
// AddProjectCollaborator adds a collaborator to an organization project and sets
// their permission level. You must be an organization owner or a project admin to add a collaborator.
//
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#add-user-as-a-collaborator
func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opt *ProjectCollaboratorOptions) (*Response, error) {
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
req, err := s.client.NewRequest("PUT", u, opt)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeProjectsPreview)
return s.client.Do(ctx, req, nil)
}
// RemoveProjectCollaborator removes a collaborator from an organization project.
// You must be an organization owner or a project admin to remove a collaborator.
//
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#remove-user-as-a-collaborator
func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) {
u := fmt.Sprintf("projects/%v/collaborators/%v", id, username)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeProjectsPreview)
return s.client.Do(ctx, req, nil)
}
// ListCollaboratorOptions specifies the optional parameters to the
// ProjectsService.ListProjectCollaborators method.
type ListCollaboratorOptions struct {
// Affiliation specifies how collaborators should be filtered by their affiliation.
// Possible values are:
// "outside" - All outside collaborators of an organization-owned repository
// "direct" - All collaborators with permissions to an organization-owned repository,
// regardless of organization membership status
// "all" - All collaborators the authenticated user can see
//
// Default value is "all".
Affiliation *string `url:"affiliation,omitempty"`
ListOptions
}
// ListProjectCollaborators lists the collaborators for an organization project. For a project,
// the list of collaborators includes outside collaborators, organization members that are direct
// collaborators, organization members with access through team memberships, organization members
// with access through default organization permissions, and organization owners. You must be an
// organization owner or a project admin to list collaborators.
//
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#list-collaborators
func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opt *ListCollaboratorOptions) ([]*User, *Response, error) {
u := fmt.Sprintf("projects/%v/collaborators", id)
u, err := addOptions(u, opt)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeProjectsPreview)
var users []*User
resp, err := s.client.Do(ctx, req, &users)
if err != nil {
return nil, resp, err
}
return users, resp, nil
}
// ProjectPermissionLevel represents the permission level an organization
// member has for a given project.
type ProjectPermissionLevel struct {
// Possible values: "admin", "write", "read", "none"
Permission *string `json:"permission,omitempty"`
User *User `json:"user,omitempty"`
}
// ReviewProjectCollaboratorPermission returns the collaborator's permission level for an organization
// project. Possible values for the permission key: "admin", "write", "read", "none".
// You must be an organization owner or a project admin to review a user's permission level.
//
// GitHub API docs: https://developer.github.com/v3/projects/collaborators/#review-a-users-permission-level
func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) {
u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeProjectsPreview)
ppl := new(ProjectPermissionLevel)
resp, err := s.client.Do(ctx, req, ppl)
if err != nil {
return nil, resp, err
}
return ppl, resp, nil
}

View File

@@ -107,7 +107,7 @@ type PullRequestBranch struct {
// PullRequestsService.List method.
type PullRequestListOptions struct {
// State filters pull requests based on their state. Possible values are:
// open, closed. Default is "open".
// open, closed, all. Default is "open".
State string `url:"state,omitempty"`
// Head filters pull requests by head user and branch name in the format of:
@@ -303,9 +303,6 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
var commits []*RepositoryCommit
resp, err := s.client.Do(ctx, req, &commits)
if err != nil {

View File

@@ -329,7 +329,9 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex
var m []*Reaction
resp, err := s.client.Do(ctx, req, &m)
if err != nil {
return nil, nil, err
}
return m, resp, nil
}

View File

@@ -179,7 +179,7 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opt *Reposi
}
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
acceptHeaders := []string{mediaTypeTopicsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var repos []*Repository
@@ -217,7 +217,7 @@ func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opt *Re
}
// TODO: remove custom Accept headers when APIs fully launch.
acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
acceptHeaders := []string{mediaTypeTopicsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var repos []*Repository
@@ -698,6 +698,13 @@ type DismissalRestrictionsRequest struct {
Teams *[]string `json:"teams,omitempty"`
}
// SignaturesProtectedBranch represents the protection status of an individual branch.
type SignaturesProtectedBranch struct {
URL *string `json:"url,omitempty"`
// Commits pushed to matching branches must have verified signatures.
Enabled *bool `json:"enabled,omitempty"`
}
// ListBranches lists branches for the specified repository.
//
// GitHub API docs: https://developer.github.com/v3/repos/#list-branches
@@ -850,6 +857,67 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner,
return s.client.Do(ctx, req, nil)
}
// GetSignaturesProtectedBranch gets required signatures of protected branch.
//
// GitHub API docs: https://developer.github.com/v3/repos/branches/#get-required-signatures-of-protected-branch
func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeSignaturePreview)
p := new(SignaturesProtectedBranch)
resp, err := s.client.Do(ctx, req, p)
if err != nil {
return nil, resp, err
}
return p, resp, nil
}
// RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch.
// It requires admin access and branch protection to be enabled.
//
// GitHub API docs: https://developer.github.com/v3/repos/branches/#add-required-signatures-of-protected-branch
func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
req, err := s.client.NewRequest("POST", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeSignaturePreview)
r := new(SignaturesProtectedBranch)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
return nil, resp, err
}
return r, resp, err
}
// OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch.
//
// GitHub API docs: https://developer.github.com/v3/repos/branches/#remove-required-signatures-of-protected-branch
func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) {
u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches
req.Header.Set("Accept", mediaTypeSignaturePreview)
return s.client.Do(ctx, req, nil)
}
// UpdateRequiredStatusChecks updates the required status checks for a given protected branch.
//
// GitHub API docs: https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch

View File

@@ -120,9 +120,6 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo,
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
return s.client.Do(ctx, req, nil)
}

View File

@@ -48,16 +48,17 @@ func (c CommitStats) String() string {
// CommitFile represents a file modified in a commit.
type CommitFile struct {
SHA *string `json:"sha,omitempty"`
Filename *string `json:"filename,omitempty"`
Additions *int `json:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty"`
Changes *int `json:"changes,omitempty"`
Status *string `json:"status,omitempty"`
Patch *string `json:"patch,omitempty"`
BlobURL *string `json:"blob_url,omitempty"`
RawURL *string `json:"raw_url,omitempty"`
ContentsURL *string `json:"contents_url,omitempty"`
SHA *string `json:"sha,omitempty"`
Filename *string `json:"filename,omitempty"`
Additions *int `json:"additions,omitempty"`
Deletions *int `json:"deletions,omitempty"`
Changes *int `json:"changes,omitempty"`
Status *string `json:"status,omitempty"`
Patch *string `json:"patch,omitempty"`
BlobURL *string `json:"blob_url,omitempty"`
RawURL *string `json:"raw_url,omitempty"`
ContentsURL *string `json:"contents_url,omitempty"`
PreviousFilename *string `json:"previous_filename,omitempty"`
}
func (c CommitFile) String() string {
@@ -127,9 +128,6 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
var commits []*RepositoryCommit
resp, err := s.client.Do(ctx, req, &commits)
if err != nil {
@@ -151,9 +149,6 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
commit := new(RepositoryCommit)
resp, err := s.client.Do(ctx, req, commit)
if err != nil {

View File

@@ -9,6 +9,7 @@ import (
"context"
"encoding/json"
"fmt"
"strings"
)
// Deployment represents a deployment in a repo
@@ -116,7 +117,8 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo
}
// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(Deployment)
resp, err := s.client.Do(ctx, req, d)
@@ -149,6 +151,7 @@ type DeploymentStatusRequest struct {
State *string `json:"state,omitempty"`
LogURL *string `json:"log_url,omitempty"`
Description *string `json:"description,omitempty"`
Environment *string `json:"environment,omitempty"`
EnvironmentURL *string `json:"environment_url,omitempty"`
AutoInactive *bool `json:"auto_inactive,omitempty"`
}
@@ -189,7 +192,8 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re
}
// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(DeploymentStatus)
resp, err := s.client.Do(ctx, req, d)
@@ -212,7 +216,8 @@ func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner,
}
// TODO: remove custom Accept headers when APIs fully launch.
req.Header.Set("Accept", mediaTypeDeploymentStatusPreview)
acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
d := new(DeploymentStatus)
resp, err := s.client.Do(ctx, req, d)

View File

@@ -40,9 +40,6 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
invites := []*RepositoryInvitation{}
resp, err := s.client.Do(ctx, req, &invites)
if err != nil {
@@ -62,9 +59,6 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
return s.client.Do(ctx, req, nil)
}
@@ -85,9 +79,6 @@ func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
invite := &RepositoryInvitation{}
resp, err := s.client.Do(ctx, req, invite)
if err != nil {

View File

@@ -355,3 +355,103 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opt *ListOptions) ([]*
return teams, resp, nil
}
// ListTeamProjects lists the organization projects for a team.
//
// GitHub API docs: https://developer.github.com/v3/teams/#list-team-projects
func (s *TeamsService) ListTeamProjects(ctx context.Context, teamID int64) ([]*Project, *Response, error) {
u := fmt.Sprintf("teams/%v/projects", teamID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
var projects []*Project
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
return nil, resp, err
}
return projects, resp, nil
}
// ReviewTeamProjects checks whether a team has read, write, or admin
// permissions for an organization project.
//
// GitHub API docs: https://developer.github.com/v3/teams/#review-a-team-project
func (s *TeamsService) ReviewTeamProjects(ctx context.Context, teamID, projectID int64) (*Project, *Response, error) {
u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
projects := &Project{}
resp, err := s.client.Do(ctx, req, &projects)
if err != nil {
return nil, resp, err
}
return projects, resp, nil
}
// TeamProjectOptions specifies the optional parameters to the
// TeamsService.AddTeamProject method.
type TeamProjectOptions struct {
// Permission specifies the permission to grant to the team for this project.
// Possible values are:
// "read" - team members can read, but not write to or administer this project.
// "write" - team members can read and write, but not administer this project.
// "admin" - team members can read, write and administer this project.
//
Permission *string `json:"permission,omitempty"`
}
// AddTeamProject adds an organization project to a team. To add a project to a team or
// update the team's permission on a project, the authenticated user must have admin
// permissions for the project.
//
// GitHub API docs: https://developer.github.com/v3/teams/#add-or-update-team-project
func (s *TeamsService) AddTeamProject(ctx context.Context, teamID, projectID int64, opt *TeamProjectOptions) (*Response, error) {
u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID)
req, err := s.client.NewRequest("PUT", u, opt)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
return s.client.Do(ctx, req, nil)
}
// RemoveTeamProject removes an organization project from a team. An organization owner or
// a team maintainer can remove any project from the team. To remove a project from a team
// as an organization member, the authenticated user must have "read" access to both the team
// and project, or "admin" access to the team or project.
// Note: This endpoint removes the project from the team, but does not delete it.
//
// GitHub API docs: https://developer.github.com/v3/teams/#remove-team-project
func (s *TeamsService) RemoveTeamProject(ctx context.Context, teamID int64, projectID int64) (*Response, error) {
u := fmt.Sprintf("teams/%v/projects/%v", teamID, projectID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
return s.client.Do(ctx, req, nil)
}

View File

@@ -18,34 +18,35 @@ type UsersService service
// User represents a GitHub user.
type User struct {
Login *string `json:"login,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
AvatarURL *string `json:"avatar_url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
GravatarID *string `json:"gravatar_id,omitempty"`
Name *string `json:"name,omitempty"`
Company *string `json:"company,omitempty"`
Blog *string `json:"blog,omitempty"`
Location *string `json:"location,omitempty"`
Email *string `json:"email,omitempty"`
Hireable *bool `json:"hireable,omitempty"`
Bio *string `json:"bio,omitempty"`
PublicRepos *int `json:"public_repos,omitempty"`
PublicGists *int `json:"public_gists,omitempty"`
Followers *int `json:"followers,omitempty"`
Following *int `json:"following,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
SuspendedAt *Timestamp `json:"suspended_at,omitempty"`
Type *string `json:"type,omitempty"`
SiteAdmin *bool `json:"site_admin,omitempty"`
TotalPrivateRepos *int `json:"total_private_repos,omitempty"`
OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"`
PrivateGists *int `json:"private_gists,omitempty"`
DiskUsage *int `json:"disk_usage,omitempty"`
Collaborators *int `json:"collaborators,omitempty"`
Plan *Plan `json:"plan,omitempty"`
Login *string `json:"login,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
AvatarURL *string `json:"avatar_url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
GravatarID *string `json:"gravatar_id,omitempty"`
Name *string `json:"name,omitempty"`
Company *string `json:"company,omitempty"`
Blog *string `json:"blog,omitempty"`
Location *string `json:"location,omitempty"`
Email *string `json:"email,omitempty"`
Hireable *bool `json:"hireable,omitempty"`
Bio *string `json:"bio,omitempty"`
PublicRepos *int `json:"public_repos,omitempty"`
PublicGists *int `json:"public_gists,omitempty"`
Followers *int `json:"followers,omitempty"`
Following *int `json:"following,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
SuspendedAt *Timestamp `json:"suspended_at,omitempty"`
Type *string `json:"type,omitempty"`
SiteAdmin *bool `json:"site_admin,omitempty"`
TotalPrivateRepos *int `json:"total_private_repos,omitempty"`
OwnedPrivateRepos *int `json:"owned_private_repos,omitempty"`
PrivateGists *int `json:"private_gists,omitempty"`
DiskUsage *int `json:"disk_usage,omitempty"`
Collaborators *int `json:"collaborators,omitempty"`
TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"`
Plan *Plan `json:"plan,omitempty"`
// API URLs
URL *string `json:"url,omitempty"`
@@ -238,9 +239,6 @@ func (s *UsersService) ListInvitations(ctx context.Context, opt *ListOptions) ([
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
invites := []*RepositoryInvitation{}
resp, err := s.client.Do(ctx, req, &invites)
if err != nil {
@@ -261,9 +259,6 @@ func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64)
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
return s.client.Do(ctx, req, nil)
}
@@ -278,8 +273,5 @@ func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeRepositoryInvitationsPreview)
return s.client.Do(ctx, req, nil)
}

View File

@@ -62,9 +62,6 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opt *ListOp
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
var keys []*GPGKey
resp, err := s.client.Do(ctx, req, &keys)
if err != nil {
@@ -85,9 +82,6 @@ func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Respo
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
key := &GPGKey{}
resp, err := s.client.Do(ctx, req, key)
if err != nil {
@@ -110,9 +104,6 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string
return nil, nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
key := &GPGKey{}
resp, err := s.client.Do(ctx, req, key)
if err != nil {
@@ -133,8 +124,5 @@ func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, e
return nil, err
}
// TODO: remove custom Accept header when this API fully launches.
req.Header.Set("Accept", mediaTypeGitSigningPreview)
return s.client.Do(ctx, req, nil)
}