gitee

package
v0.0.0-...-4f8e644 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2021 License: BSD-3-Clause, CC-BY-3.0 Imports: 27 Imported by: 0

Documentation

Overview

package gitee provides a client for using the GitHub API.

Usage:

import "github.com/weilaihui/go-gitee/gitee"

Construct a new GitHub client, then use the various services on the client to access different parts of the GitHub API. For example:

client := github.NewClient(nil)

// list all organizations for user "willnorris"
orgs, _, err := client.Organizations.List(ctx, "willnorris", nil)

Some API methods have optional parameters that can be passed. For example:

client := github.NewClient(nil)

// list public repositories for org "github"
opt := &github.RepositoryListByOrgOptions{Type: "public"}
repos, _, err := client.Repositories.ListByOrg(ctx, "github", opt)

The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at https://developer.github.com/v3/.

Authentication

The go-github library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you. The easiest and recommended way to do this is using the golang.org/x/oauth2 library, but you can always use any other library that provides an http.Client. If you have an OAuth2 access token (for example, a personal API token), you can use it with the oauth2 library using:

import "golang.org/x/oauth2"

func main() {
	ctx := context.Background()
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: "... your access token ..."},
	)
	tc := oauth2.NewClient(ctx, ts)

	client := github.NewClient(tc)

	// list all repositories for the authenticated user
	repos, _, err := client.Repositories.List(ctx, "", nil)
}

Note that when using an authenticated Client, all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users.

See the oauth2 docs for complete instructions on using that library.

For API methods that require HTTP Basic Authentication, use the BasicAuthTransport.

GitHub Apps authentication can be provided by the https://github.com/bradleyfalzon/ghinstallation package.

import "github.com/bradleyfalzon/ghinstallation"

func main() {
	// Wrap the shared transport for use with the integration ID 1 authenticating with installation ID 99.
	itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, 1, 99, "2016-10-19.private-key.pem")
	if err != nil {
		// Handle error.
	}

	// Use installation transport with client
	client := github.NewClient(&http.Client{Transport: itr})

	// Use client...
}

Rate Limiting

GitHub imposes a rate limit on all API clients. Unauthenticated clients are limited to 60 requests per hour, while authenticated clients can make up to 5,000 requests per hour. The Search API has a custom rate limit. Unauthenticated clients are limited to 10 requests per minute, while authenticated clients can make up to 30 requests per minute. To receive the higher rate limit when making calls that are not issued on behalf of a user, use UnauthenticatedRateLimitedTransport.

The returned Response.Rate value contains the rate limit information from the most recent API call. If a recent enough response isn't available, you can use RateLimits to fetch the most up-to-date rate limit data for the client.

To detect an API rate limit error, you can check if its type is *github.RateLimitError:

repos, _, err := client.Repositories.List(ctx, "", nil)
if _, ok := err.(*github.RateLimitError); ok {
	log.Println("hit rate limit")
}

Learn more about GitHub rate limiting at https://developer.github.com/v3/#rate-limiting.

Accepted Status

Some endpoints may return a 202 Accepted status code, meaning that the information required is not yet ready and was scheduled to be gathered on the GitHub side. Methods known to behave like this are documented specifying this behavior.

To detect this condition of error, you can check if its type is *github.AcceptedError:

stats, _, err := client.Repositories.ListContributorsStats(ctx, org, repo)
if _, ok := err.(*github.AcceptedError); ok {
	log.Println("scheduled on GitHub side")
}

Conditional Requests

The GitHub API has good support for conditional requests which will help prevent you from burning through your rate limit, as well as help speed up your application. go-github does not handle conditional requests directly, but is instead designed to work with a caching http.Transport. We recommend using https://github.com/gregjones/httpcache for that.

Learn more about GitHub conditional requests at https://developer.github.com/v3/#conditional-requests.

Creating and Updating Resources

All structs for GitHub resources use pointer values for all non-repeated fields. This allows distinguishing between unset fields and those set to a zero-value. Helper functions have been provided to easily create these pointers for string, bool, and int values. For example:

// create a new private repository named "foo"
repo := &github.Repository{
	Name:    github.String("foo"),
	Private: github.Bool(true),
}
client.Repositories.Create(ctx, "", repo)

Users who have worked with protocol buffers should find this pattern familiar.

Pagination

All requests for resource collections (repos, pull requests, issues, etc.) support pagination. Pagination options are described in the github.ListOptions struct and passed to the list methods directly or as an embedded type of a more specific list options struct (for example github.PullRequestListOptions). Pages information is available via the github.Response struct.

client := github.NewClient(nil)

opt := &github.RepositoryListByOrgOptions{
	ListOptions: github.ListOptions{PerPage: 10},
}
// get all pages of results
var allRepos []*github.Repository
for {
	repos, resp, err := client.Repositories.ListByOrg(ctx, "github", opt)
	if err != nil {
		return err
	}
	allRepos = append(allRepos, repos...)
	if resp.NextPage == 0 {
		break
	}
	opt.Page = resp.NextPage
}

Google App Engine

Go on App Engine Classic (which as of this writing uses Go 1.6) can not use the "context" import and still relies on "golang.org/x/net/context". As a result, if you wish to continue to use "go-github" on App Engine Classic, you will need to rewrite all the "context" imports using the following command:

gofmt -w -r '"context" -> "golang.org/x/net/context"' *.go

See "with_appengine.go" for more details.

Index

Constants

View Source
const (
	// Tarball specifies an archive in gzipped tar format.
	Tarball archiveFormat = "tarball"

	// Zipball specifies an archive in zip format.
	Zipball archiveFormat = "zipball"
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range or equal to 202 Accepted. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

The error type will be *RateLimitError for rate limit exceeded errors, *AcceptedError for 202 Accepted status codes, and *TwoFactorAuthError for two-factor authentication errors.

func DeliveryID

func DeliveryID(r *http.Request) string

DeliveryID returns the unique delivery ID of webhook request r.

GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func ParseWebHook

func ParseWebHook(messageType string, payload []byte) (interface{}, error)

ParseWebHook parses the event payload. For recognized event types, a value of the corresponding struct type will be returned (as returned by Event.ParsePayload()). An error will be returned for unrecognized event types.

Example usage:

func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  payload, err := github.ValidatePayload(r, s.webhookSecretKey)
  if err != nil { ... }
  event, err := github.ParseWebHook(github.WebHookType(r), payload)
  if err != nil { ... }
  switch event := event.(type) {
  case *github.CommitCommentEvent:
      processCommitCommentEvent(event)
  case *github.CreateEvent:
      processCreateEvent(event)
  ...
  }
}

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

func ValidatePayload

func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error)

ValidatePayload validates an incoming GitHub Webhook event request and returns the (JSON) payload. The Content-Type header of the payload can be "application/json" or "application/x-www-form-urlencoded". If the Content-Type is neither then an error is returned. secretKey is the GitHub Webhook secret message.

Example usage:

func (s *GitHubEventMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  payload, err := github.ValidatePayload(r, s.webhookSecretKey)
  if err != nil { ... }
  // Process payload...
}

func WebHookType

func WebHookType(r *http.Request) string

WebHookType returns the event type of webhook request r.

GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers

Types

type APIMeta

type APIMeta struct {
	// An Array of IP addresses in CIDR format specifying the addresses
	// that incoming service hooks will originate from on GitHub.com.
	Hooks []string `json:"hooks,omitempty"`

	// An Array of IP addresses in CIDR format specifying the Git servers
	// for GitHub.com.
	Git []string `json:"git,omitempty"`

	// Whether authentication with username and password is supported.
	// (GitHub Enterprise instances using CAS or OAuth for authentication
	// will return false. Features like Basic Authentication with a
	// username and password, sudo mode, and two-factor authentication are
	// not supported on these servers.)
	VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"`

	// An array of IP addresses in CIDR format specifying the addresses
	// which serve GitHub Pages websites.
	Pages []string `json:"pages,omitempty"`
}

APIMeta represents metadata about the GitHub API.

func (*APIMeta) GetVerifiablePasswordAuthentication

func (a *APIMeta) GetVerifiablePasswordAuthentication() bool

GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise.

type AbuseRateLimitError

type AbuseRateLimitError struct {
	Response *http.Response // HTTP response that caused this error
	Message  string         `json:"message"` // error message

	// RetryAfter is provided with some abuse rate limit errors. If present,
	// it is the amount of time that the client should wait before retrying.
	// Otherwise, the client should try again later (after an unspecified amount of time).
	RetryAfter *time.Duration
}

AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the "documentation_url" field value equal to "https://developer.github.com/v3#abuse-rate-limits".

func (*AbuseRateLimitError) Error

func (r *AbuseRateLimitError) Error() string

func (*AbuseRateLimitError) GetRetryAfter

func (a *AbuseRateLimitError) GetRetryAfter() time.Duration

GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise.

type AcceptedError

type AcceptedError struct{}

AcceptedError occurs when GitHub returns 202 Accepted response with an empty body, which means a job was scheduled on the GitHub side to process the information needed and cache it. Technically, 202 Accepted is not a real error, it's just used to indicate that results are not ready yet, but should be available soon. The request can be repeated after some time.

func (*AcceptedError) Error

func (*AcceptedError) Error() string

type ActivityListStarredOptions

type ActivityListStarredOptions struct {
	// How to sort the repository list. Possible values are: created, updated,
	// pushed, full_name. Default is "full_name".
	Sort string `url:"sort,omitempty"`

	// Direction in which to sort repositories. Possible values are: asc, desc.
	// Default is "asc" when sort is "full_name", otherwise default is "desc".
	Direction string `url:"direction,omitempty"`

	ListOptions
}

ActivityListStarredOptions specifies the optional parameters to the ActivityService.ListStarred method.

type ActivityService

type ActivityService service

ActivityService handles communication with the activity related methods of the GitHub API.

GitHub API docs: https://developer.github.com/v3/activity/

func (*ActivityService) DeleteRepositorySubscription

func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error)

DeleteRepositorySubscription deletes the subscription for the specified repository for the authenticated user.

This is used to stop watching a repository. To control whether or not to receive notifications from a repository, use SetRepositorySubscription.

GitHub API docs: https://developer.github.com/v3/activity/watching/#delete-a-repository-subscription

func (*ActivityService) DeleteThreadSubscription

func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error)

DeleteThreadSubscription deletes the subscription for the specified thread for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription

func (*ActivityService) GetRepositorySubscription

func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (bool, *Response, error)

GetRepositorySubscription returns the subscription for the specified repository for the authenticated user. If the authenticated user is not watching the repository, a nil Subscription is returned.

GitHub API docs: https://developer.github.com/v3/activity/watching/#get-a-repository-subscription

func (*ActivityService) GetThread

func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error)

GetThread gets the specified notification thread.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread

func (*ActivityService) GetThreadSubscription

func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error)

GetThreadSubscription checks to see if the authenticated user is subscribed to a thread.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription

func (*ActivityService) IsStarred

func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error)

IsStarred checks if a repository is starred by authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/starring/#check-if-you-are-starring-a-repository

func (*ActivityService) ListEvents

func (s *ActivityService) ListEvents(ctx context.Context, opt *ListOptions) ([]*Event, *Response, error)

ListEvents drinks from the firehose of all public events across GitHub.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events

func (*ActivityService) ListEventsForOrganization

func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opt *ListOptions) ([]*Event, *Response, error)

ListEventsForOrganization lists public events for an organization.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization

func (*ActivityService) ListEventsForRepoNetwork

func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error)

ListEventsForRepoNetwork lists public events for a network of repositories.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories

func (*ActivityService) ListEventsPerformedByUser

func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error)

ListEventsPerformedByUser lists the events performed by a user. If publicOnly is true, only public events will be returned.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user

func (*ActivityService) ListEventsReceivedByUser

func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error)

ListEventsReceivedByUser lists the events received by a user. If publicOnly is true, only public events will be returned.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received

func (*ActivityService) ListFeeds

func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error)

ListFeeds lists all the feeds available to the authenticated user.

GitHub provides several timeline resources in Atom format:

Timeline: The GitHub global public timeline
User: The public timeline for any user, using URI template
Current user public: The public timeline for the authenticated user
Current user: The private timeline for the authenticated user
Current user actor: The private timeline for activity created by the
    authenticated user
Current user organizations: The private timeline for the organizations
    the authenticated user is a member of.

Note: Private feeds are only returned when authenticating via Basic Auth since current feed URIs use the older, non revocable auth tokens.

func (*ActivityService) ListIssueEventsForRepository

func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error)

ListIssueEventsForRepository lists issue events for a repository.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository

func (*ActivityService) ListNotifications

func (s *ActivityService) ListNotifications(ctx context.Context, opt *NotificationListOptions) ([]*Notification, *Response, error)

ListNotifications lists all notifications for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications

func (*ActivityService) ListRepositoryEvents

func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Event, *Response, error)

ListRepositoryEvents lists events for a repository.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-repository-events

func (*ActivityService) ListRepositoryNotifications

func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error)

ListRepositoryNotifications lists all notifications in a given repository for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository

func (*ActivityService) ListStargazers

func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*Stargazer, *Response, error)

ListStargazers lists people who have starred the specified repo.

GitHub API docs: https://developer.github.com/v3/activity/starring/#list-stargazers

func (*ActivityService) ListStarred

ListStarred lists all the repos starred by a user. Passing the empty string will list the starred repositories for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/starring/#list-repositories-being-starred

func (*ActivityService) ListUserEventsForOrganization

func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opt *ListOptions) ([]*Event, *Response, error)

ListUserEventsForOrganization provides the user’s organization dashboard. You must be authenticated as the user to view this.

GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-for-an-organization

func (*ActivityService) ListWatched

func (s *ActivityService) ListWatched(ctx context.Context, user string, opt *ListOptions) ([]*Repository, *Response, error)

ListWatched lists the repositories the specified user is watching. Passing the empty string will fetch watched repos for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/watching/#list-repositories-being-watched

func (*ActivityService) ListWatchers

func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error)

ListWatchers lists watchers of a particular repo.

GitHub API docs: https://developer.github.com/v3/activity/watching/#list-watchers

func (*ActivityService) MarkNotificationsRead

func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error)

MarkNotificationsRead marks all notifications up to lastRead as read.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-as-read

func (*ActivityService) MarkRepositoryNotificationsRead

func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error)

MarkRepositoryNotificationsRead marks all notifications up to lastRead in the specified repository as read.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository

func (*ActivityService) MarkThreadRead

func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error)

MarkThreadRead marks the specified thread as read.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read

func (*ActivityService) SetRepositorySubscription

func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string) (bool, *Response, error)

SetRepositorySubscription sets the subscription for the specified repository for the authenticated user.

To watch a repository, set subscription.Subscribed to true. To ignore notifications made within a repository, set subscription.Ignored to true. To stop watching a repository, use DeleteRepositorySubscription.

GitHub API docs: https://developer.github.com/v3/activity/watching/#set-a-repository-subscription

func (*ActivityService) SetThreadSubscription

func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error)

SetThreadSubscription sets the subscription for the specified thread for the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription

func (*ActivityService) Star

func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error)

Star a repository as the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository

func (*ActivityService) Unstar

func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error)

Unstar a repository as the authenticated user.

GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository

type AdminEnforcement

type AdminEnforcement struct {
	URL     *string `json:"url,omitempty"`
	Enabled bool    `json:"enabled"`
}

AdminEnforcement represents the configuration to enforce required status checks for repository administrators.

func (*AdminEnforcement) GetURL

func (a *AdminEnforcement) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

type AdminService

type AdminService service

AdminService handles communication with the admin related methods of the GitHub API. These API routes are normally only accessible for GitHub Enterprise installations.

GitHub API docs: https://developer.github.com/v3/enterprise/

func (*AdminService) UpdateTeamLDAPMapping

func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error)

UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group.

GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team

func (*AdminService) UpdateUserLDAPMapping

func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error)

UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user.

GitHub API docs: https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user

type App

type App struct {
	ID          *int       `json:"id,omitempty"`
	Owner       *User      `json:"owner,omitempty"`
	Name        *string    `json:"name,omitempty"`
	Description *string    `json:"description,omitempty"`
	ExternalURL *string    `json:"external_url,omitempty"`
	HTMLURL     *string    `json:"html_url,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

App represents a GitHub App.

func (*App) GetCreatedAt

func (a *App) GetCreatedAt() time.Time

GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.

func (*App) GetDescription

func (a *App) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*App) GetExternalURL

func (a *App) GetExternalURL() string

GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise.

func (*App) GetHTMLURL

func (a *App) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*App) GetID

func (a *App) GetID() int

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*App) GetName

func (a *App) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*App) GetUpdatedAt

func (a *App) GetUpdatedAt() time.Time

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

type AppsService

type AppsService service

AppsService provides access to the installation related functions in the GitHub API.

GitHub API docs: https://developer.github.com/v3/apps/

func (*AppsService) AddRepository

func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int) (*Repository, *Response, error)

AddRepository adds a single repository to an installation.

GitHub API docs: https://developer.github.com/v3/apps/installations/#add-repository-to-installation

func (*AppsService) CreateInstallationToken

func (s *AppsService) CreateInstallationToken(ctx context.Context, id int) (*InstallationToken, *Response, error)

CreateInstallationToken creates a new installation token.

GitHub API docs: https://developer.github.com/v3/apps/#create-a-new-installation-token

func (*AppsService) Get

func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error)

Get a single GitHub App. Passing the empty string will get the authenticated GitHub App.

Note: appSlug is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., https://github.com/settings/apps/:app_slug).

GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-github-app

func (*AppsService) GetInstallation

func (s *AppsService) GetInstallation(ctx context.Context, id int) (*Installation, *Response, error)

GetInstallation returns the specified installation.

GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation

func (*AppsService) ListInstallations

func (s *AppsService) ListInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error)

ListInstallations lists the installations that the current GitHub App has.

GitHub API docs: https://developer.github.com/v3/apps/#find-installations

func (*AppsService) ListRepos

func (s *AppsService) ListRepos(ctx context.Context, opt *ListOptions) ([]*Repository, *Response, error)

ListRepos lists the repositories that are accessible to the authenticated installation.

GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories

func (*AppsService) ListUserInstallations

func (s *AppsService) ListUserInstallations(ctx context.Context, opt *ListOptions) ([]*Installation, *Response, error)

ListUserInstallations lists installations that are accessible to the authenticated user.

GitHub API docs: https://developer.github.com/v3/apps/#list-installations-for-user

func (*AppsService) ListUserRepos

func (s *AppsService) ListUserRepos(ctx context.Context, id int, opt *ListOptions) ([]*Repository, *Response, error)

ListUserRepos lists repositories that are accessible to the authenticated user for an installation.

GitHub API docs: https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation

func (*AppsService) RemoveRepository

func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int) (*Response, error)

RemoveRepository removes a single repository from an installation.

GitHub docs: https://developer.github.com/v3/apps/installations/#remove-repository-from-installation

type Authorization

type Authorization struct {
	ID             *int              `json:"id,omitempty"`
	URL            *string           `json:"url,omitempty"`
	Scopes         []Scope           `json:"scopes,omitempty"`
	Token          *string           `json:"token,omitempty"`
	TokenLastEight *string           `json:"token_last_eight,omitempty"`
	HashedToken    *string           `json:"hashed_token,omitempty"`
	App            *AuthorizationApp `json:"app,omitempty"`
	Note           *string           `json:"note,omitempty"`
	NoteURL        *string           `json:"note_url,omitempty"`
	UpdatedAt      *Timestamp        `json:"updated_at,omitempty"`
	CreatedAt      *Timestamp        `json:"created_at,omitempty"`
	Fingerprint    *string           `json:"fingerprint,omitempty"`

	// User is only populated by the Check and Reset methods.
	User *User `json:"user,omitempty"`
}

Authorization represents an individual GitHub authorization.

func (*Authorization) GetCreatedAt

func (a *Authorization) GetCreatedAt() Timestamp

GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.

func (*Authorization) GetFingerprint

func (a *Authorization) GetFingerprint() string

GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.

func (*Authorization) GetHashedToken

func (a *Authorization) GetHashedToken() string

GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise.

func (*Authorization) GetID

func (a *Authorization) GetID() int

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Authorization) GetNote

func (a *Authorization) GetNote() string

GetNote returns the Note field if it's non-nil, zero value otherwise.

func (*Authorization) GetNoteURL

func (a *Authorization) GetNoteURL() string

GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.

func (*Authorization) GetToken

func (a *Authorization) GetToken() string

GetToken returns the Token field if it's non-nil, zero value otherwise.

func (*Authorization) GetTokenLastEight

func (a *Authorization) GetTokenLastEight() string

GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise.

func (*Authorization) GetURL

func (a *Authorization) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (*Authorization) GetUpdatedAt

func (a *Authorization) GetUpdatedAt() Timestamp

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

func (Authorization) String

func (a Authorization) String() string

type AuthorizationApp

type AuthorizationApp struct {
	URL      *string `json:"url,omitempty"`
	Name     *string `json:"name,omitempty"`
	ClientID *string `json:"client_id,omitempty"`
}

AuthorizationApp represents an individual GitHub app (in the context of authorization).

func (*AuthorizationApp) GetClientID

func (a *AuthorizationApp) GetClientID() string

GetClientID returns the ClientID field if it's non-nil, zero value otherwise.

func (*AuthorizationApp) GetName

func (a *AuthorizationApp) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*AuthorizationApp) GetURL

func (a *AuthorizationApp) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (AuthorizationApp) String

func (a AuthorizationApp) String() string

type AuthorizationRequest

type AuthorizationRequest struct {
	Scopes       []Scope `json:"scopes,omitempty"`
	Note         *string `json:"note,omitempty"`
	NoteURL      *string `json:"note_url,omitempty"`
	ClientID     *string `json:"client_id,omitempty"`
	ClientSecret *string `json:"client_secret,omitempty"`
	Fingerprint  *string `json:"fingerprint,omitempty"`
}

AuthorizationRequest represents a request to create an authorization.

func (*AuthorizationRequest) GetClientID

func (a *AuthorizationRequest) GetClientID() string

GetClientID returns the ClientID field if it's non-nil, zero value otherwise.

func (*AuthorizationRequest) GetClientSecret

func (a *AuthorizationRequest) GetClientSecret() string

GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise.

func (*AuthorizationRequest) GetFingerprint

func (a *AuthorizationRequest) GetFingerprint() string

GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.

func (*AuthorizationRequest) GetNote

func (a *AuthorizationRequest) GetNote() string

GetNote returns the Note field if it's non-nil, zero value otherwise.

func (*AuthorizationRequest) GetNoteURL

func (a *AuthorizationRequest) GetNoteURL() string

GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.

func (AuthorizationRequest) String

func (a AuthorizationRequest) String() string

type AuthorizationUpdateRequest

type AuthorizationUpdateRequest struct {
	Scopes       []string `json:"scopes,omitempty"`
	AddScopes    []string `json:"add_scopes,omitempty"`
	RemoveScopes []string `json:"remove_scopes,omitempty"`
	Note         *string  `json:"note,omitempty"`
	NoteURL      *string  `json:"note_url,omitempty"`
	Fingerprint  *string  `json:"fingerprint,omitempty"`
}

AuthorizationUpdateRequest represents a request to update an authorization.

Note that for any one update, you must only provide one of the "scopes" fields. That is, you may provide only one of "Scopes", or "AddScopes", or "RemoveScopes".

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization

func (*AuthorizationUpdateRequest) GetFingerprint

func (a *AuthorizationUpdateRequest) GetFingerprint() string

GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.

func (*AuthorizationUpdateRequest) GetNote

func (a *AuthorizationUpdateRequest) GetNote() string

GetNote returns the Note field if it's non-nil, zero value otherwise.

func (*AuthorizationUpdateRequest) GetNoteURL

func (a *AuthorizationUpdateRequest) GetNoteURL() string

GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.

func (AuthorizationUpdateRequest) String

type AuthorizationsService

type AuthorizationsService service

AuthorizationsService handles communication with the authorization related methods of the GitHub API.

This service requires HTTP Basic Authentication; it cannot be accessed using an OAuth token.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/

func (*AuthorizationsService) Check

func (s *AuthorizationsService) Check(ctx context.Context, clientID string, token string) (*Authorization, *Response, error)

Check if an OAuth token is valid for a specific app.

Note that this operation requires the use of BasicAuth, but where the username is the OAuth application clientID, and the password is its clientSecret. Invalid tokens will return a 404 Not Found.

The returned Authorization.User field will be populated.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#check-an-authorization

func (*AuthorizationsService) Create

Create a new authorization for the specified OAuth application.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization

func (*AuthorizationsService) CreateImpersonation

func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error)

CreateImpersonation creates an impersonation OAuth token.

This requires admin permissions. With the returned Authorization.Token you can e.g. create or delete a user's public SSH key. NOTE: creating a new token automatically revokes an existing one.

GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#create-an-impersonation-oauth-token

func (*AuthorizationsService) Delete

func (s *AuthorizationsService) Delete(ctx context.Context, id int) (*Response, error)

Delete a single authorization.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization

func (*AuthorizationsService) DeleteGrant

func (s *AuthorizationsService) DeleteGrant(ctx context.Context, id int) (*Response, error)

DeleteGrant deletes an OAuth application grant. Deleting an application's grant will also delete all OAuth tokens associated with the application for the user.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-a-grant

func (*AuthorizationsService) DeleteImpersonation

func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error)

DeleteImpersonation deletes an impersonation OAuth token.

NOTE: there can be only one at a time.

GitHub API docs: https://developer.github.com/enterprise/2.5/v3/users/administration/#delete-an-impersonation-oauth-token

func (*AuthorizationsService) Edit

Edit a single authorization.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization

func (*AuthorizationsService) Get

Get a single authorization.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization

func (*AuthorizationsService) GetGrant

func (s *AuthorizationsService) GetGrant(ctx context.Context, id int) (*Grant, *Response, error)

GetGrant gets a single OAuth application grant.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant

func (*AuthorizationsService) GetOrCreateForApp

func (s *AuthorizationsService) GetOrCreateForApp(ctx context.Context, clientID string, auth *AuthorizationRequest) (*Authorization, *Response, error)

GetOrCreateForApp creates a new authorization for the specified OAuth application, only if an authorization for that application doesn’t already exist for the user.

If a new token is created, the HTTP status code will be "201 Created", and the returned Authorization.Token field will be populated. If an existing token is returned, the status code will be "200 OK" and the Authorization.Token field will be empty.

clientID is the OAuth Client ID with which to create the token.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app https://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint

func (*AuthorizationsService) List

List the authorizations for the authenticated user.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations

func (*AuthorizationsService) ListGrants

func (s *AuthorizationsService) ListGrants(ctx context.Context, opt *ListOptions) ([]*Grant, *Response, error)

ListGrants lists the set of OAuth applications that have been granted access to a user's account. This will return one entry for each application that has been granted access to the account, regardless of the number of tokens an application has generated for the user.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-grants

func (*AuthorizationsService) Reset

func (s *AuthorizationsService) Reset(ctx context.Context, clientID string, token string) (*Authorization, *Response, error)

Reset is used to reset a valid OAuth token without end user involvement. Applications must save the "token" property in the response, because changes take effect immediately.

Note that this operation requires the use of BasicAuth, but where the username is the OAuth application clientID, and the password is its clientSecret. Invalid tokens will return a 404 Not Found.

The returned Authorization.User field will be populated.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization

func (*AuthorizationsService) Revoke

func (s *AuthorizationsService) Revoke(ctx context.Context, clientID string, token string) (*Response, error)

Revoke an authorization for an application.

Note that this operation requires the use of BasicAuth, but where the username is the OAuth application clientID, and the password is its clientSecret. Invalid tokens will return a 404 Not Found.

GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application

type BasicAuthTransport

type BasicAuthTransport struct {
	Username string // GitHub username
	Password string // GitHub password
	OTP      string // one-time password for users with two-factor auth enabled

	ClientID     string
	ClientSecret string
	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password. It additionally supports users who have two-factor authentication enabled on their GitHub account.

func (*BasicAuthTransport) Client

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Blob

type Blob struct {
	Content  *string `json:"content,omitempty"`
	Encoding *string `json:"encoding,omitempty"`
	SHA      *string `json:"sha,omitempty"`
	Size     *int    `json:"size,omitempty"`
	URL      *string `json:"url,omitempty"`
}

Blob represents a blob object.

func (*Blob) GetContent

func (b *Blob) GetContent() string

GetContent returns the Content field if it's non-nil, zero value otherwise.

func (*Blob) GetEncoding

func (b *Blob) GetEncoding() string

GetEncoding returns the Encoding field if it's non-nil, zero value otherwise.

func (*Blob) GetSHA

func (b *Blob) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*Blob) GetSize

func (b *Blob) GetSize() int

GetSize returns the Size field if it's non-nil, zero value otherwise.

func (*Blob) GetURL

func (b *Blob) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

type Branch

type Branch struct {
	Name      *string           `json:"name,omitempty"`
	Commit    *RepositoryCommit `json:"commit,omitempty"`
	Protected *bool             `json:"protected,omitempty"`
}

Branch represents a repository branch

func (*Branch) GetName

func (b *Branch) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Branch) GetProtected

func (b *Branch) GetProtected() bool

GetProtected returns the Protected field if it's non-nil, zero value otherwise.

type BranchRestrictions

type BranchRestrictions struct {
	// The list of user logins with push access.
	Users []*User `json:"users"`
	// The list of team slugs with push access.
	Teams []*Team `json:"teams"`
}

BranchRestrictions represents the restriction that only certain users or teams may push to a branch.

type BranchRestrictionsRequest

type BranchRestrictionsRequest struct {
	// The list of user logins with push access. (Required; use []string{} instead of nil for empty list.)
	Users []string `json:"users"`
	// The list of team slugs with push access. (Required; use []string{} instead of nil for empty list.)
	Teams []string `json:"teams"`
}

BranchRestrictionsRequest represents the request to create/edit the restriction that only certain users or teams may push to a branch. It is separate from BranchRestrictions above because the request structure is different from the response structure.

type Client

type Client struct {

	// Base URL for API requests. Defaults to the public GitHub API, but can be
	// set to a domain endpoint to use with GitHub Enterprise. BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// Base URL for uploading files.
	UploadURL *url.URL

	// User agent used when communicating with the GitHub API.
	UserAgent string

	// Services used for talking to different parts of the GitHub API.
	Activity *ActivityService
	Gists    *GistsService
	Git      *GitService
	Issues   *IssuesService
	// TODO Labels
	// TODO Milestones
	// TODO Miscellaneous
	Organizations *OrganizationsService
	PullRequests  *PullRequestsService
	Repositories  *RepositoriesService
	Users         *UsersService

	// Admin          *AdminService
	// Apps           *AppsService
	Authorizations *AuthorizationsService
	// contains filtered or unexported fields
}

A Client manages communication with the GitHub API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new GitHub API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).

func NewEnterpriseClient

func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error)

NewEnterpriseClient returns a new GitHub API client with provided base URL and upload URL (often the same URL). If either URL does not have a trailing slash, one is added automatically. If a nil httpClient is provided, http.DefaultClient will be used.

Note that NewEnterpriseClient is a convenience helper only; its behavior is equivalent to using NewClient, followed by setting the BaseURL and UploadURL fields.

func (*Client) APIMeta

func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error)

APIMeta returns information about GitHub.com, the service. Or, if you access this endpoint on your organization’s GitHub Enterprise installation, this endpoint provides information about that installation.

GitHub API docs: https://developer.github.com/v3/meta/

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If rate limit is exceeded and reset time is in the future, Do returns *RateLimitError immediately without making a network API call.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) GetCodeOfConduct

func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error)

GetCodeOfConduct returns an individual code of conduct.

https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct

func (*Client) ListCodesOfConduct

func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error)

ListCodesOfConduct returns all codes of conduct.

GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct

func (*Client) ListEmojis

func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error)

ListEmojis returns the emojis available to use on GitHub.

GitHub API docs: https://developer.github.com/v3/emojis/

func (*Client) ListServiceHooks

func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error)

ListServiceHooks lists all of the available service hooks.

GitHub API docs: https://developer.github.com/webhooks/#services

func (*Client) Markdown

func (c *Client) Markdown(ctx context.Context, text string, opt *MarkdownOptions) (string, *Response, error)

Markdown renders an arbitrary Markdown document.

GitHub API docs: https://developer.github.com/v3/markdown/

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

func (*Client) NewUploadRequest

func (c *Client) NewUploadRequest(urlStr string, reader io.Reader, size int64, mediaType string) (*http.Request, error)

NewUploadRequest creates an upload request. A relative URL can be provided in urlStr, in which case it is resolved relative to the UploadURL of the Client. Relative URLs should always be specified without a preceding slash.

func (*Client) Octocat

func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error)

Octocat returns an ASCII art octocat with the specified message in a speech bubble. If message is empty, a random zen phrase is used.

func (*Client) RateLimits

func (c *Client) RateLimits(ctx context.Context) (*RateLimits, *Response, error)

RateLimits returns the rate limits for the current client.

func (*Client) Zen

func (c *Client) Zen(ctx context.Context) (string, *Response, error)

Zen returns a random line from The Zen of GitHub.

see also: http://warpspire.com/posts/taste/

type CodeOfConduct

type CodeOfConduct struct {
	Name *string `json:"name,omitempty"`
	Key  *string `json:"key,omitempty"`
	URL  *string `json:"url,omitempty"`
	Body *string `json:"body,omitempty"`
}

CodeOfConduct represents a code of conduct.

func (*CodeOfConduct) GetBody

func (c *CodeOfConduct) GetBody() string

GetBody returns the Body field if it's non-nil, zero value otherwise.

func (*CodeOfConduct) GetKey

func (c *CodeOfConduct) GetKey() string

GetKey returns the Key field if it's non-nil, zero value otherwise.

func (*CodeOfConduct) GetName

func (c *CodeOfConduct) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*CodeOfConduct) GetURL

func (c *CodeOfConduct) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (*CodeOfConduct) String

func (c *CodeOfConduct) String() string

type CodeResult

type CodeResult struct {
	Name        *string     `json:"name,omitempty"`
	Path        *string     `json:"path,omitempty"`
	SHA         *string     `json:"sha,omitempty"`
	HTMLURL     *string     `json:"html_url,omitempty"`
	Repository  *Repository `json:"repository,omitempty"`
	TextMatches []TextMatch `json:"text_matches,omitempty"`
}

CodeResult represents a single search result.

func (*CodeResult) GetHTMLURL

func (c *CodeResult) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*CodeResult) GetName

func (c *CodeResult) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*CodeResult) GetPath

func (c *CodeResult) GetPath() string

GetPath returns the Path field if it's non-nil, zero value otherwise.

func (*CodeResult) GetSHA

func (c *CodeResult) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (CodeResult) String

func (c CodeResult) String() string

type CodeSearchResult

type CodeSearchResult struct {
	Total             *int         `json:"total_count,omitempty"`
	IncompleteResults *bool        `json:"incomplete_results,omitempty"`
	CodeResults       []CodeResult `json:"items,omitempty"`
}

CodeSearchResult represents the result of a code search.

func (*CodeSearchResult) GetIncompleteResults

func (c *CodeSearchResult) GetIncompleteResults() bool

GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.

func (*CodeSearchResult) GetTotal

func (c *CodeSearchResult) GetTotal() int

GetTotal returns the Total field if it's non-nil, zero value otherwise.

type CombinedStatus

type CombinedStatus struct {
	// State is the combined state of the repository. Possible values are:
	// failure, pending, or success.
	State *string `json:"state,omitempty"`

	Name       *string      `json:"name,omitempty"`
	SHA        *string      `json:"sha,omitempty"`
	TotalCount *int         `json:"total_count,omitempty"`
	Statuses   []RepoStatus `json:"statuses,omitempty"`

	CommitURL     *string `json:"commit_url,omitempty"`
	RepositoryURL *string `json:"repository_url,omitempty"`
}

CombinedStatus represents the combined status of a repository at a particular reference.

func (*CombinedStatus) GetCommitURL

func (c *CombinedStatus) GetCommitURL() string

GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise.

func (*CombinedStatus) GetName

func (c *CombinedStatus) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*CombinedStatus) GetRepositoryURL

func (c *CombinedStatus) GetRepositoryURL() string

GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.

func (*CombinedStatus) GetSHA

func (c *CombinedStatus) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*CombinedStatus) GetState

func (c *CombinedStatus) GetState() string

GetState returns the State field if it's non-nil, zero value otherwise.

func (*CombinedStatus) GetTotalCount

func (c *CombinedStatus) GetTotalCount() int

GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.

func (CombinedStatus) String

func (s CombinedStatus) String() string

type Commit

type Commit struct {
	SHA          *string                `json:"sha,omitempty"`
	Author       *CommitAuthor          `json:"author,omitempty"`
	Committer    *CommitAuthor          `json:"committer,omitempty"`
	Message      *string                `json:"message,omitempty"`
	Tree         *Tree                  `json:"tree,omitempty"`
	Parents      []Commit               `json:"parents,omitempty"`
	Stats        *CommitStats           `json:"stats,omitempty"`
	HTMLURL      *string                `json:"html_url,omitempty"`
	URL          *string                `json:"url,omitempty"`
	Verification *SignatureVerification `json:"verification,omitempty"`

	// CommentCount is the number of GitHub comments on the commit. This
	// is only populated for requests that fetch GitHub data like
	// Pulls.ListCommits, Repositories.ListCommits, etc.
	CommentCount *int `json:"comment_count,omitempty"`
}

Commit represents a GitHub commit.

func (*Commit) GetCommentCount

func (c *Commit) GetCommentCount() int

GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise.

func (*Commit) GetHTMLURL

func (c *Commit) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*Commit) GetMessage

func (c *Commit) GetMessage() string

GetMessage returns the Message field if it's non-nil, zero value otherwise.

func (*Commit) GetSHA

func (c *Commit) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*Commit) GetURL

func (c *Commit) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (Commit) String

func (c Commit) String() string

type CommitAuthor

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.
}

CommitAuthor represents the author or committer of a commit. The commit author may not correspond to a GitHub User.

func (*CommitAuthor) GetDate

func (c *CommitAuthor) GetDate() time.Time

GetDate returns the Date field if it's non-nil, zero value otherwise.

func (*CommitAuthor) GetEmail

func (c *CommitAuthor) GetEmail() string

GetEmail returns the Email field if it's non-nil, zero value otherwise.

func (*CommitAuthor) GetLogin

func (c *CommitAuthor) GetLogin() string

GetLogin returns the Login field if it's non-nil, zero value otherwise.

func (*CommitAuthor) GetName

func (c *CommitAuthor) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (CommitAuthor) String

func (c CommitAuthor) String() string

type CommitCommentEvent

type CommitCommentEvent struct {
	Comment *RepositoryComment `json:"comment,omitempty"`

	// The following fields are only populated by Webhook events.
	Action       *string       `json:"action,omitempty"`
	Repo         *Repository   `json:"repository,omitempty"`
	Sender       *User         `json:"sender,omitempty"`
	Installation *Installation `json:"installation,omitempty"`
}

CommitCommentEvent is triggered when a commit comment is created. The Webhook event name is "commit_comment".

GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent

func (*CommitCommentEvent) GetAction

func (c *CommitCommentEvent) GetAction() string

GetAction returns the Action field if it's non-nil, zero value otherwise.

type CommitFile

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"`
}

CommitFile represents a file modified in a commit.

func (*CommitFile) GetAdditions

func (c *CommitFile) GetAdditions() int

GetAdditions returns the Additions field if it's non-nil, zero value otherwise.

func (*CommitFile) GetBlobURL

func (c *CommitFile) GetBlobURL() string

GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise.

func (*CommitFile) GetChanges

func (c *CommitFile) GetChanges() int

GetChanges returns the Changes field if it's non-nil, zero value otherwise.

func (*CommitFile) GetContentsURL

func (c *CommitFile) GetContentsURL() string

GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise.

func (*CommitFile) GetDeletions

func (c *CommitFile) GetDeletions() int

GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.

func (*CommitFile) GetFilename

func (c *CommitFile) GetFilename() string

GetFilename returns the Filename field if it's non-nil, zero value otherwise.

func (*CommitFile) GetPatch

func (c *CommitFile) GetPatch() string

GetPatch returns the Patch field if it's non-nil, zero value otherwise.

func (*CommitFile) GetRawURL

func (c *CommitFile) GetRawURL() string

GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.

func (*CommitFile) GetSHA

func (c *CommitFile) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*CommitFile) GetStatus

func (c *CommitFile) GetStatus() string

GetStatus returns the Status field if it's non-nil, zero value otherwise.

func (CommitFile) String

func (c CommitFile) String() string

type CommitResult

type CommitResult struct {
	SHA         *string   `json:"sha,omitempty"`
	Commit      *Commit   `json:"commit,omitempty"`
	Author      *User     `json:"author,omitempty"`
	Committer   *User     `json:"committer,omitempty"`
	Parents     []*Commit `json:"parents,omitempty"`
	HTMLURL     *string   `json:"html_url,omitempty"`
	URL         *string   `json:"url,omitempty"`
	CommentsURL *string   `json:"comments_url,omitempty"`

	Repository *Repository `json:"repository,omitempty"`
	Score      *float64    `json:"score,omitempty"`
}

CommitResult represents a commit object as returned in commit search endpoint response.

func (*CommitResult) GetCommentsURL

func (c *CommitResult) GetCommentsURL() string

GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.

func (*CommitResult) GetHTMLURL

func (c *CommitResult) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*CommitResult) GetSHA

func (c *CommitResult) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*CommitResult) GetURL

func (c *CommitResult) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

type CommitStats

type CommitStats struct {
	Additions *int `json:"additions,omitempty"`
	Deletions *int `json:"deletions,omitempty"`
	Total     *int `json:"total,omitempty"`
}

CommitStats represents the number of additions / deletions from a file in a given RepositoryCommit or GistCommit.

func (*CommitStats) GetAdditions

func (c *CommitStats) GetAdditions() int

GetAdditions returns the Additions field if it's non-nil, zero value otherwise.

func (*CommitStats) GetDeletions

func (c *CommitStats) GetDeletions() int

GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.

func (*CommitStats) GetTotal

func (c *CommitStats) GetTotal() int

GetTotal returns the Total field if it's non-nil, zero value otherwise.

func (CommitStats) String

func (c CommitStats) String() string

type CommitsComparison

type CommitsComparison struct {
	BaseCommit      *RepositoryCommit `json:"base_commit,omitempty"`
	MergeBaseCommit *RepositoryCommit `json:"merge_base_commit,omitempty"`

	// Head can be 'behind' or 'ahead'
	Status       *string `json:"status,omitempty"`
	AheadBy      *int    `json:"ahead_by,omitempty"`
	BehindBy     *int    `json:"behind_by,omitempty"`
	TotalCommits *int    `json:"total_commits,omitempty"`

	Commits []RepositoryCommit `json:"commits,omitempty"`

	Files []CommitFile `json:"files,omitempty"`

	HTMLURL      *string `json:"html_url,omitempty"`
	PermalinkURL *string `json:"permalink_url,omitempty"`
	DiffURL      *string `json:"diff_url,omitempty"`
	PatchURL     *string `json:"patch_url,omitempty"`
	URL          *string `json:"url,omitempty"` // API URL.
}

CommitsComparison is the result of comparing two commits. See CompareCommits() for details.

func (*CommitsComparison) GetAheadBy

func (c *CommitsComparison) GetAheadBy() int

GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetBehindBy

func (c *CommitsComparison) GetBehindBy() int

GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetDiffURL

func (c *CommitsComparison) GetDiffURL() string

GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetHTMLURL

func (c *CommitsComparison) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetPatchURL

func (c *CommitsComparison) GetPatchURL() string

GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetPermalinkURL

func (c *CommitsComparison) GetPermalinkURL() string

GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetStatus

func (c *CommitsComparison) GetStatus() string

GetStatus returns the Status field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetTotalCommits

func (c *CommitsComparison) GetTotalCommits() int

GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise.

func (*CommitsComparison) GetURL

func (c *CommitsComparison) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (CommitsComparison) String

func (c CommitsComparison) String() string

type CommitsListOptions

type CommitsListOptions struct {
	// SHA or branch to start listing Commits from.
	SHA string `url:"sha,omitempty"`

	// Path that should be touched by the returned Commits.
	Path string `url:"path,omitempty"`

	// Author of by which to filter Commits.
	Author string `url:"author,omitempty"`

	// Since when should Commits be included in the response.
	Since time.Time `url:"since,omitempty"`

	// Until when should Commits be included in the response.
	Until time.Time `url:"until,omitempty"`

	ListOptions
}

CommitsListOptions specifies the optional parameters to the RepositoriesService.ListCommits method.

type CommitsSearchResult

type CommitsSearchResult struct {
	Total             *int            `json:"total_count,omitempty"`
	IncompleteResults *bool           `json:"incomplete_results,omitempty"`
	Commits           []*CommitResult `json:"items,omitempty"`
}

CommitsSearchResult represents the result of a commits search.

func (*CommitsSearchResult) GetIncompleteResults

func (c *CommitsSearchResult) GetIncompleteResults() bool

GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.

func (*CommitsSearchResult) GetTotal

func (c *CommitsSearchResult) GetTotal() int

GetTotal returns the Total field if it's non-nil, zero value otherwise.

type CommunityHealthFiles

type CommunityHealthFiles struct {
	CodeOfConduct *Metric `json:"code_of_conduct"`
	Contributing  *Metric `json:"contributing"`
	License       *Metric `json:"license"`
	Readme        *Metric `json:"readme"`
}

CommunityHealthFiles represents the different files in the community health metrics response.

type CommunityHealthMetrics

type CommunityHealthMetrics struct {
	HealthPercentage *int                  `json:"health_percentage"`
	Files            *CommunityHealthFiles `json:"files"`
	UpdatedAt        *time.Time            `json:"updated_at"`
}

CommunityHealthMetrics represents a response containing the community metrics of a repository.

func (*CommunityHealthMetrics) GetHealthPercentage

func (c *CommunityHealthMetrics) GetHealthPercentage() int

GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise.

func (*CommunityHealthMetrics) GetUpdatedAt

func (c *CommunityHealthMetrics) GetUpdatedAt() time.Time

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

type Contributor

type Contributor struct {
	Login             *string `json:"login,omitempty"`
	ID                *int    `json:"id,omitempty"`
	AvatarURL         *string `json:"avatar_url,omitempty"`
	GravatarID        *string `json:"gravatar_id,omitempty"`
	URL               *string `json:"url,omitempty"`
	HTMLURL           *string `json:"html_url,omitempty"`
	FollowersURL      *string `json:"followers_url,omitempty"`
	FollowingURL      *string `json:"following_url,omitempty"`
	GistsURL          *string `json:"gists_url,omitempty"`
	StarredURL        *string `json:"starred_url,omitempty"`
	SubscriptionsURL  *string `json:"subscriptions_url,omitempty"`
	OrganizationsURL  *string `json:"organizations_url,omitempty"`
	ReposURL          *string `json:"repos_url,omitempty"`
	EventsURL         *string `json:"events_url,omitempty"`
	ReceivedEventsURL *string `json:"received_events_url,omitempty"`
	Type              *string `json:"type,omitempty"`
	SiteAdmin         *bool   `json:"site_admin"`
	Contributions     *int    `json:"contributions,omitempty"`
}

Contributor represents a repository contributor

func (*Contributor) GetAvatarURL

func (c *Contributor) GetAvatarURL() string

GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetContributions

func (c *Contributor) GetContributions() int

GetContributions returns the Contributions field if it's non-nil, zero value otherwise.

func (*Contributor) GetEventsURL

func (c *Contributor) GetEventsURL() string

GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetFollowersURL

func (c *Contributor) GetFollowersURL() string

GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetFollowingURL

func (c *Contributor) GetFollowingURL() string

GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetGistsURL

func (c *Contributor) GetGistsURL() string

GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetGravatarID

func (c *Contributor) GetGravatarID() string

GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.

func (*Contributor) GetHTMLURL

func (c *Contributor) GetHTMLURL() string

GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetID

func (c *Contributor) GetID() int

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Contributor) GetLogin

func (c *Contributor) GetLogin() string

GetLogin returns the Login field if it's non-nil, zero value otherwise.

func (*Contributor) GetOrganizationsURL

func (c *Contributor) GetOrganizationsURL() string

GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetReceivedEventsURL

func (c *Contributor) GetReceivedEventsURL() string

GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetReposURL

func (c *Contributor) GetReposURL() string

GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetSiteAdmin

func (c *Contributor) GetSiteAdmin() bool

GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise.

func (*Contributor) GetStarredURL

func (c *Contributor) GetStarredURL() string

GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetSubscriptionsURL

func (c *Contributor) GetSubscriptionsURL() string

GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise.

func (*Contributor) GetType

func (c *Contributor) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

func (*Contributor) GetURL

func (c *Contributor) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

type ContributorStats

type ContributorStats struct {
	Author *Contributor  `json:"author,omitempty"`
	Total  *int          `json:"total,omitempty"`
	Weeks  []WeeklyStats `json:"weeks,omitempty"`
}

ContributorStats represents a contributor to a repository and their weekly contributions to a given repo.

func (*ContributorStats) GetTotal

func (c *ContributorStats) GetTotal() int

GetTotal returns the Total field if it's non-nil, zero value otherwise.

func (ContributorStats) String

func (c ContributorStats) String() string

type CreateEvent

type CreateEvent struct {
	Ref *string `json:"ref,omitempty"`
	// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
	RefType      *string `json:"ref_type,omitempty"`
	MasterBranch *string `json:"master_branch,omitempty"`
	Description  *string `json:"description,omitempty"`

	// The following fields are only populated by Webhook events.
	PusherType   *string       `json:"pusher_type,omitempty"`
	Repo         *Repository   `json:"repository,omitempty"`
	Sender       *User         `json:"sender,omitempty"`
	Installation *Installation `json:"installation,omitempty"`
}

CreateEvent represents a created repository, branch, or tag. The Webhook event name is "create".

Note: webhooks will not receive this event for created repositories. Additionally, webhooks will not receive this event for tags if more than three tags are pushed at once.

GitHub API docs: https://developer.github.com/v3/activity/events/types/#createevent

func (*CreateEvent) GetDescription

func (c *CreateEvent) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*CreateEvent) GetMasterBranch

func (c *CreateEvent) GetMasterBranch() string

GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise.

func (*CreateEvent) GetPusherType

func (c *CreateEvent) GetPusherType() string

GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.

func (*CreateEvent) GetRef

func (c *CreateEvent) GetRef() string

GetRef returns the Ref field if it's non-nil, zero value otherwise.

func (*CreateEvent) GetRefType

func (c *CreateEvent) GetRefType() string

GetRefType returns the RefType field if it's non-nil, zero value otherwise.

type DeleteEvent

type DeleteEvent struct {
	Ref *string `json:"ref,omitempty"`
	// RefType is the object that was deleted. Possible values are: "branch", "tag".
	RefType *string `json:"ref_type,omitempty"`

	// The following fields are only populated by Webhook events.
	PusherType   *string       `json:"pusher_type,omitempty"`
	Repo         *Repository   `json:"repository,omitempty"`
	Sender       *User         `json:"sender,omitempty"`
	Installation *Installation `json:"installation,omitempty"`
}

DeleteEvent represents a deleted branch or tag. The Webhook event name is "delete".

Note: webhooks will not receive this event for tags if more than three tags are deleted at once.

GitHub API docs: https://developer.github.com/v3/activity/events/types/#deleteevent

func (*DeleteEvent) GetPusherType

func (d *DeleteEvent) GetPusherType() string

GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.

func (*DeleteEvent) GetRef

func (d *DeleteEvent) GetRef() string

GetRef returns the Ref field if it's non-nil, zero value otherwise.

func (*DeleteEvent) GetRefType

func (d *DeleteEvent) GetRefType() string

GetRefType returns the RefType field if it's non-nil, zero value otherwise.

type Deployment

type Deployment struct {
	URL           *string         `json:"url,omitempty"`
	ID            *int            `json:"id,omitempty"`
	SHA           *string         `json:"sha,omitempty"`
	Ref           *string         `json:"ref,omitempty"`
	Task          *string         `json:"task,omitempty"`
	Payload       json.RawMessage `json:"payload,omitempty"`
	Environment   *string         `json:"environment,omitempty"`
	Description   *string         `json:"description,omitempty"`
	Creator       *User           `json:"creator,omitempty"`
	CreatedAt     *Timestamp      `json:"created_at,omitempty"`
	UpdatedAt     *Timestamp      `json:"updated_at,omitempty"`
	StatusesURL   *string         `json:"statuses_url,omitempty"`
	RepositoryURL *string         `json:"repository_url,omitempty"`
}

Deployment represents a deployment in a repo

func (*Deployment) GetCreatedAt

func (d *Deployment) GetCreatedAt() Timestamp

GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.

func (*Deployment) GetDescription

func (d *Deployment) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Deployment) GetEnvironment

func (d *Deployment) GetEnvironment() string

GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.

func (*Deployment) GetID

func (d *Deployment) GetID() int

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Deployment) GetRef

func (d *Deployment) GetRef() string

GetRef returns the Ref field if it's non-nil, zero value otherwise.

func (*Deployment) GetRepositoryURL

func (d *Deployment) GetRepositoryURL() string

GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.

func (*Deployment) GetSHA

func (d *Deployment) GetSHA() string

GetSHA returns the SHA field if it's non-nil, zero value otherwise.

func (*Deployment) GetStatusesURL

func (d *Deployment) GetStatusesURL() string

GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.

func (*Deployment) GetTask

func (d *Deployment) GetTask() string

GetTask returns the Task field if it's non-nil, zero value otherwise.

func (*Deployment) GetURL

func (d *Deployment) GetURL() string

GetURL returns the URL field if it's non-nil, zero value otherwise.

func (*Deployment) GetUpdatedAt

func (d *Deployment) GetUpdatedAt() Timestamp

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

type DeploymentEvent

type DeploymentEvent struct {
	Deployment *Deployment `json:"deployment,omitempty"`
	Repo       *Repository `json:"repository,omitempty"`

	// The following fields are only populated by Webhook events.
	Sender       *User         `json:"sender,omitempty"`
	Installation *Installation `json:"installation,omitempty"`
}

DeploymentEvent represents a deployment. The Webhook event name is "deployment".

Events of this type are not visible in timelines, they are only used to trigger hooks.

GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentevent

type DeploymentRequest

type DeploymentRequest struct {
	Ref                   *string   `json:"ref,omitempty"`
	Task                  *string   `json:"task,omitempty"`
	AutoMerge             *bool     `json:"auto_merge,omitempty"`
	RequiredContexts      *[]string `json:"required_contexts,omitempty"`
	Payload               *string   `json:"payload,omitempty"`
	Environment           *string   `json:"environment,omitempty"`
	Description           *string   `json:"description,omitempty"`
	TransientEnvironment  *bool     `json:"transient_environment,omitempty"`
	ProductionEnvironment *bool     `json:"production_environment,omitempty"`
}

DeploymentRequest represents a deployment request

func (*DeploymentRequest) GetAutoMerge

func (d *DeploymentRequest) GetAutoMerge() bool

GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetDescription

func (d *DeploymentRequest) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetEnvironment

func (d *DeploymentRequest) GetEnvironment() string

GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetPayload

func (d *DeploymentRequest) GetPayload() string

GetPayload returns the Payload field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetProductionEnvironment

func (d *DeploymentRequest) GetProductionEnvironment() bool

GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetRef

func (d *DeploymentRequest) GetRef() string

GetRef returns the Ref field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetRequiredContexts

func (d *DeploymentRequest) GetRequiredContexts() []string

GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetTask

func (d *DeploymentRequest) GetTask() string

GetTask returns the Task field if it's non-nil, zero value otherwise.

func (*DeploymentRequest) GetTransientEnvironment

func (d *DeploymentRequest) GetTransientEnvironment() bool

GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise.

type DeploymentStatus

type DeploymentStatus struct {
	ID *int `json:"id,omitempty"`
	// State is the deployment state.
	// Possible values are: "pending", "success", "failure", "error", "inactive".
	State         *string    `json:"state,omitempty"`
	Creator       *User      `json:"creator,omitempty"`
	Description   *string    `json:"description,omitempty"`
	TargetURL     *string    `json:"target_url,omitempty"`
	CreatedAt     *Timestamp `json:"created_at,omitempty"`
	UpdatedAt     *Timestamp `json:"updated_at,omitempty"`
	DeploymentURL *string    `json:"deployment_url,omitempty"`
	RepositoryURL *string    `json:"repository_url,omitempty"`
}

DeploymentStatus represents the status of a particular deployment.

func (*DeploymentStatus) GetCreatedAt

func (d *DeploymentStatus) GetCreatedAt() Timestamp

GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetDeploymentURL

func (d *DeploymentStatus) GetDeploymentURL() string

GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetDescription

func (d *DeploymentStatus) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetID

func (d *DeploymentStatus) GetID() int

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetRepositoryURL

func (d *DeploymentStatus) GetRepositoryURL() string

GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetState

func (d *DeploymentStatus) GetState() string

GetState returns the State field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetTargetURL

func (d *DeploymentStatus) GetTargetURL() string

GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise.

func (*DeploymentStatus) GetUpdatedAt

func (d *DeploymentStatus) GetUpdatedAt() Timestamp

GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.

type DeploymentStatusEvent

type DeploymentStatusEvent struct {
	Deployment       *Deployment       `json:"deployment,omitempty"`
	DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
	Repo             *Repository       `json:"repository,omitempty"`

	// The following fields are only populated by Webhook events.
	Sender       *User         `json:"sender,omitempty"`
	Installation *Installation `json:"installation,omitempty"`
}

DeploymentStatusEvent represents a deployment status. The Webhook event name is "deployment_status".

Events of this type are not visible in timelines, they are only used to trigger hooks.

GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent

type DeploymentStatusRequest

type DeploymentStatusRequest struct {
	State          *string `json:"state,omitempty"`
	LogURL         *string `json:"log_url,omitempty"`
	Description    *string `json:"description,omitempty"`
	EnvironmentURL *string `json:"environment_url,omitempty"`
	AutoInactive   *bool   `json:"auto_inactive,omitempty"`
}

DeploymentStatusRequest represents a deployment request

func (*DeploymentStatusRequest) GetAutoInactive

func (d *DeploymentStatusRequest) GetAutoInactive() bool

GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise.

func (*DeploymentStatusRequest) GetDescription

func (d *DeploymentStatusRequest) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*DeploymentStatusRequest) GetEnvironmentURL

func (d *DeploymentStatusRequest) GetEnvironmentURL() string

GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise.

func (*DeploymentStatusRequest) GetLogURL

func (d *DeploymentStatusRequest) GetLogURL() string

GetLogURL returns the LogURL field if it's non-nil, zero value otherwise.

func (*DeploymentStatusRequest) GetState

func (d *DeploymentStatusRequest) GetState() string

GetState returns the State field if it's non-nil, zero value otherwise.

type DeploymentsListOptions

type DeploymentsListOptions struct {
	// SHA of the Deployment.
	SHA string `url:"sha,omitempty"`

	// List deployments for a given ref.
	Ref string `url:"ref,omitempty"`

	// List deployments for a given task.
	Task string `url:"task,omitempty"`

	// List deployments for a given environment.
	Environment string `url:"environment,omitempty"`

	ListOptions
}

DeploymentsListOptions specifies the optional parameters to the RepositoriesService.ListDeployments method.

type DismissalRestrictions

type DismissalRestrictions struct {
	// The list of users who can dimiss pull request reviews.
	Users []*User `json:"users"`
	// The list of teams which can dismiss pull request reviews.
	Teams []*Team `json:"teams"`
}

DismissalRestrictions specifies which users and teams can dismiss pull request reviews.

type DismissalRestrictionsRequest

type DismissalRestrictionsRequest struct {
	// The list of user logins who can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
	Users []string `json:"users"`
	// The list of team slugs which can dismiss pull request reviews. (Required; use []string{} instead of nil for empty list.)
	Teams []string `json:"teams"`
}

DismissalRestrictionsRequest represents the request to create/edit the restriction to allows only specific users or teams to dimiss pull request reviews. It is separate from DismissalRestrictions above because the request structure is different from the response structure.

type DraftReviewComment

type DraftReviewComment struct {
	Path     *string `json:"path,omitempty"`
	Position *int    `json:"position,omitempty"`
	Body     *string `json:"body,omitempty"`
}

DraftReviewComment represents a comment part of the review.

func (*DraftReviewComment) GetBody

func (d *DraftReviewComment) GetBody() string

GetBody returns the Body field if it's non-nil, zero value otherwise.

func (*DraftReviewComment) GetPath

func (d *DraftReviewComment) GetPath() string

GetPath returns the Path field if it's non-nil, zero value otherwise.

func (*DraftReviewComment) GetPosition

func (d *DraftReviewComment) GetPosition() int

GetPosition returns the Position field if it's non-nil, zero value otherwise.

func (DraftReviewComment) String

func (c DraftReviewComment) String() string

type EditChange

type EditChange struct {
	Title *struct {
		From *string `json:"from,omitempty"`
	} `json:"title,omitempty"`
	Body *struct {
		From *string `json:"from,omitempty"`
	} `json:"body,omitempty"`
}

EditChange represents the changes when an issue, pull request, or comment has been edited.

type Error

type Error struct {
	Resource string `json:"resource"` // resource on which the error occurred
	Field    string `json:"field"`    // field on which the error occurred
	Code     string `json:"code"`     // validation error code
	Message  string `json:"message"`  // Message describing the error. Errors with Code == "custom" will always have this set.
}

An Error reports more details on an individual error in an ErrorResponse. These are the possible validation error codes:

missing:
    resource does not exist
missing_field:
    a required field on a resource has not been set
invalid:
    the formatting of a field is invalid
already_exists:
    another resource has the same valid as this field
custom:
    some resources return this (e.g. github.User.CreateKey()), additional
    information is set in the Message field of the Error

GitHub API docs: https://developer.github.com/v3/#client-errors

func (*Error) Error