import "github.com/google/go-github/github"
Package github provides a client for using the GitHub API.
Usage:
import "github.com/google/go-github/github"
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/.
NOTE: Using the https://godoc.org/context package, one can easily pass cancelation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.
For more sample code snippets, head over to the https://github.com/google/go-github/tree/master/example directory.
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... }
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.
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") }
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.
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.
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 }
activity.go activity_events.go activity_notifications.go activity_star.go activity_watching.go admin.go admin_stats.go apps.go apps_installation.go apps_marketplace.go authorizations.go doc.go event_types.go gists.go gists_comments.go git.go git_blobs.go git_commits.go git_refs.go git_tags.go git_trees.go github-accessors.go github.go gitignore.go issues.go issues_assignees.go issues_comments.go issues_events.go issues_labels.go issues_milestones.go issues_timeline.go licenses.go messages.go migrations.go migrations_source_import.go misc.go orgs.go orgs_hooks.go orgs_members.go orgs_outside_collaborators.go orgs_projects.go orgs_teams.go orgs_users_blocking.go projects.go pulls.go pulls_comments.go pulls_reviewers.go pulls_reviews.go reactions.go repos.go repos_collaborators.go repos_comments.go repos_commits.go repos_community_health.go repos_contents.go repos_deployments.go repos_forks.go repos_hooks.go repos_invitations.go repos_keys.go repos_merging.go repos_pages.go repos_projects.go repos_releases.go repos_stats.go repos_statuses.go repos_traffic.go search.go strings.go timestamp.go users.go users_administration.go users_blocking.go users_emails.go users_followers.go users_gpg_keys.go users_keys.go without_appengine.go
const ( // Tarball specifies an archive in gzipped tar format. Tarball archiveFormat = "tarball" // Zipball specifies an archive in zip format. Zipball archiveFormat = "zipball" )
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
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.
DeliveryID returns the unique delivery ID of webhook request r.
GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.
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) ... } }
String is a helper routine that allocates a new string value to store v and returns a pointer to it.
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.
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... }
WebHookType returns the event type of webhook request r.
GitHub API docs: https://developer.github.com/v3/repos/hooks/#webhook-headers
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"` // An Array of IP addresses specifying the addresses that source imports // will originate from on GitHub.com. Importer []string `json:"importer,omitempty"` }
APIMeta represents metadata about the GitHub API.
GetVerifiablePasswordAuthentication returns the VerifiablePasswordAuthentication field if it's non-nil, zero value otherwise.
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 (r *AbuseRateLimitError) Error() string
func (a *AbuseRateLimitError) GetRetryAfter() time.Duration
GetRetryAfter returns the RetryAfter field if it's non-nil, zero value otherwise.
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() string
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 service
ActivityService handles communication with the activity related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/activity/
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 (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 (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *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 (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 (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 (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 (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 (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 (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 (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 (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
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 (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 (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 (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 (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 (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 (s *ActivityService) ListStarred(ctx context.Context, user string, opt *ActivityListStarredOptions) ([]*StarredRepository, *Response, error)
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 (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 (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 (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 (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 (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
MarkThreadRead marks the specified thread as read.
GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *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 (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
Star a repository as the authenticated user.
GitHub API docs: https://developer.github.com/v3/activity/starring/#star-a-repository
Unstar a repository as the authenticated user.
GitHub API docs: https://developer.github.com/v3/activity/starring/#unstar-a-repository
AdminEnforcement represents the configuration to enforce required status checks for repository administrators.
func (a *AdminEnforcement) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
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 (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error)
GetAdminStats returns a variety of metrics about a Github Enterprise installation.
Please note that this is only available to site administrators, otherwise it will error with a 404 not found (instead of 401 or 403).
GitHub API docs: https://developer.github.com/v3/enterprise-admin/admin_stats/
func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, 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 (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 AdminStats struct { Issues *IssueStats `json:"issues,omitempty"` Hooks *HookStats `json:"hooks,omitempty"` Milestones *MilestoneStats `json:"milestones,omitempty"` Orgs *OrgStats `json:"orgs,omitempty"` Comments *CommentStats `json:"comments,omitempty"` Pages *PageStats `json:"pages,omitempty"` Users *UserStats `json:"users,omitempty"` Gists *GistStats `json:"gists,omitempty"` Pulls *PullStats `json:"pulls,omitempty"` Repos *RepoStats `json:"repos,omitempty"` }
AdminStats represents a variety of stats of a Github Enterprise installation.
func (a *AdminStats) GetComments() *CommentStats
GetComments returns the Comments field.
func (a *AdminStats) GetGists() *GistStats
GetGists returns the Gists field.
func (a *AdminStats) GetHooks() *HookStats
GetHooks returns the Hooks field.
func (a *AdminStats) GetIssues() *IssueStats
GetIssues returns the Issues field.
func (a *AdminStats) GetMilestones() *MilestoneStats
GetMilestones returns the Milestones field.
func (a *AdminStats) GetOrgs() *OrgStats
GetOrgs returns the Orgs field.
func (a *AdminStats) GetPages() *PageStats
GetPages returns the Pages field.
func (a *AdminStats) GetPulls() *PullStats
GetPulls returns the Pulls field.
func (a *AdminStats) GetRepos() *RepoStats
GetRepos returns the Repos field.
func (a *AdminStats) GetUsers() *UserStats
GetUsers returns the Users field.
func (s AdminStats) String() string
type App struct { ID *int64 `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.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetDescription returns the Description field if it's non-nil, zero value otherwise.
GetExternalURL returns the ExternalURL field if it's non-nil, zero value otherwise.
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetName returns the Name field if it's non-nil, zero value otherwise.
GetOwner returns the Owner field.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
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 (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*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 (s *AppsService) CreateInstallationToken(ctx context.Context, id int64) (*InstallationToken, *Response, error)
CreateInstallationToken creates a new installation token.
GitHub API docs: https://developer.github.com/v3/apps/#create-a-new-installation-token
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 (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error)
GetInstallation returns the specified installation.
GitHub API docs: https://developer.github.com/v3/apps/#get-a-single-installation
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 (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 (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 (s *AppsService) ListUserRepos(ctx context.Context, id int64, 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 (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*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 struct { ID *int64 `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 (a *Authorization) GetApp() *AuthorizationApp
GetApp returns the App field.
func (a *Authorization) GetCreatedAt() Timestamp
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (a *Authorization) GetFingerprint() string
GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
func (a *Authorization) GetHashedToken() string
GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise.
func (a *Authorization) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (a *Authorization) GetNote() string
GetNote returns the Note field if it's non-nil, zero value otherwise.
func (a *Authorization) GetNoteURL() string
GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
func (a *Authorization) GetToken() string
GetToken returns the Token field if it's non-nil, zero value otherwise.
func (a *Authorization) GetTokenLastEight() string
GetTokenLastEight returns the TokenLastEight field if it's non-nil, zero value otherwise.
func (a *Authorization) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (a *Authorization) GetUpdatedAt() Timestamp
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
func (a *Authorization) GetUser() *User
GetUser returns the User field.
func (a Authorization) String() string
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 (a *AuthorizationApp) GetClientID() string
GetClientID returns the ClientID field if it's non-nil, zero value otherwise.
func (a *AuthorizationApp) GetName() string
GetName returns the Name field if it's non-nil, zero value otherwise.
func (a *AuthorizationApp) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (a AuthorizationApp) String() string
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 (a *AuthorizationRequest) GetClientID() string
GetClientID returns the ClientID field if it's non-nil, zero value otherwise.
func (a *AuthorizationRequest) GetClientSecret() string
GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise.
func (a *AuthorizationRequest) GetFingerprint() string
GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
func (a *AuthorizationRequest) GetNote() string
GetNote returns the Note field if it's non-nil, zero value otherwise.
func (a *AuthorizationRequest) GetNoteURL() string
GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
func (a AuthorizationRequest) String() string
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 (a *AuthorizationUpdateRequest) GetFingerprint() string
GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise.
func (a *AuthorizationUpdateRequest) GetNote() string
GetNote returns the Note field if it's non-nil, zero value otherwise.
func (a *AuthorizationUpdateRequest) GetNoteURL() string
GetNoteURL returns the NoteURL field if it's non-nil, zero value otherwise.
func (a AuthorizationUpdateRequest) String() string
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 (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 (s *AuthorizationsService) Create(ctx context.Context, auth *AuthorizationRequest) (*Authorization, *Response, error)
Create a new authorization for the specified OAuth application.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
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
Delete a single authorization.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#delete-an-authorization
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 (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 (s *AuthorizationsService) Edit(ctx context.Context, id int64, auth *AuthorizationUpdateRequest) (*Authorization, *Response, error)
Edit a single authorization.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#update-an-existing-authorization
func (s *AuthorizationsService) Get(ctx context.Context, id int64) (*Authorization, *Response, error)
Get a single authorization.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-authorization
GetGrant gets a single OAuth application grant.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#get-a-single-grant
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 (s *AuthorizationsService) List(ctx context.Context, opt *ListOptions) ([]*Authorization, *Response, error)
List the authorizations for the authenticated user.
GitHub API docs: https://developer.github.com/v3/oauth_authorizations/#list-your-authorizations
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 (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 (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 struct { Username string // GitHub username Password string // GitHub password OTP string // one-time password for users with two-factor auth enabled // 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 (t *BasicAuthTransport) Client() *http.Client
Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.
RoundTrip implements the RoundTripper interface.
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"` NodeID *string `json:"node_id,omitempty"` }
Blob represents a blob object.
GetContent returns the Content field if it's non-nil, zero value otherwise.
GetEncoding returns the Encoding field if it's non-nil, zero value otherwise.
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
GetSize returns the Size field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
type Branch struct { Name *string `json:"name,omitempty"` Commit *RepositoryCommit `json:"commit,omitempty"` Protected *bool `json:"protected,omitempty"` }
Branch represents a repository branch
func (b *Branch) GetCommit() *RepositoryCommit
GetCommit returns the Commit field.
GetName returns the Name field if it's non-nil, zero value otherwise.
GetProtected returns the Protected field if it's non-nil, zero value otherwise.
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 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 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 Admin *AdminService Apps *AppsService Authorizations *AuthorizationsService Gists *GistsService Git *GitService Gitignores *GitignoresService Issues *IssuesService Licenses *LicensesService Marketplace *MarketplaceService Migrations *MigrationService Organizations *OrganizationsService Projects *ProjectsService PullRequests *PullRequestsService Reactions *ReactionsService Repositories *RepositoriesService Search *SearchService Users *UsersService // contains filtered or unexported fields }
A Client manages communication with the GitHub API.
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).
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.
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/
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 (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
ListCodesOfConduct returns all codes of conduct.
GitHub API docs: https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct
ListEmojis returns the emojis available to use on GitHub.
GitHub API docs: https://developer.github.com/v3/emojis/
ListServiceHooks lists all of the available service hooks.
GitHub API docs: https://developer.github.com/webhooks/#services
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/
Code:
client := github.NewClient(nil) input := "# heading #\n\nLink to issue #1" opt := &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"} output, _, err := client.Markdown(context.Background(), input, opt) if err != nil { fmt.Println(err) } fmt.Println(output)
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 (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.
Octocat returns an ASCII art octocat with the specified message in a speech bubble. If message is empty, a random zen phrase is used.
RateLimits returns the rate limits for the current client.
Zen returns a random line from The Zen of GitHub.
see also: http://warpspire.com/posts/taste/
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 (c *CodeOfConduct) GetBody() string
GetBody returns the Body field if it's non-nil, zero value otherwise.
func (c *CodeOfConduct) GetKey() string
GetKey returns the Key field if it's non-nil, zero value otherwise.
func (c *CodeOfConduct) GetName() string
GetName returns the Name field if it's non-nil, zero value otherwise.
func (c *CodeOfConduct) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (c *CodeOfConduct) String() string
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 (c *CodeResult) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (c *CodeResult) GetName() string
GetName returns the Name field if it's non-nil, zero value otherwise.
func (c *CodeResult) GetPath() string
GetPath returns the Path field if it's non-nil, zero value otherwise.
func (c *CodeResult) GetRepository() *Repository
GetRepository returns the Repository field.
func (c *CodeResult) GetSHA() string
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (c CodeResult) String() string
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 (c *CodeSearchResult) GetIncompleteResults() bool
GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
func (c *CodeSearchResult) GetTotal() int
GetTotal returns the Total field if it's non-nil, zero value otherwise.
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 (c *CombinedStatus) GetCommitURL() string
GetCommitURL returns the CommitURL field if it's non-nil, zero value otherwise.
func (c *CombinedStatus) GetName() string
GetName returns the Name field if it's non-nil, zero value otherwise.
func (c *CombinedStatus) GetRepositoryURL() string
GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
func (c *CombinedStatus) GetSHA() string
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (c *CombinedStatus) GetState() string
GetState returns the State field if it's non-nil, zero value otherwise.
func (c *CombinedStatus) GetTotalCount() int
GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
func (s CombinedStatus) String() string
type CommentStats struct { TotalCommitComments *int `json:"total_commit_comments,omitempty"` TotalGistComments *int `json:"total_gist_comments,omitempty"` TotalIssueComments *int `json:"total_issue_comments,omitempty"` TotalPullRequestComments *int `json:"total_pull_request_comments,omitempty"` }
CommentStats represents the number of total comments on commits, gists, issues and pull requests.
func (c *CommentStats) GetTotalCommitComments() int
GetTotalCommitComments returns the TotalCommitComments field if it's non-nil, zero value otherwise.
func (c *CommentStats) GetTotalGistComments() int
GetTotalGistComments returns the TotalGistComments field if it's non-nil, zero value otherwise.
func (c *CommentStats) GetTotalIssueComments() int
GetTotalIssueComments returns the TotalIssueComments field if it's non-nil, zero value otherwise.
func (c *CommentStats) GetTotalPullRequestComments() int
GetTotalPullRequestComments returns the TotalPullRequestComments field if it's non-nil, zero value otherwise.
func (s CommentStats) String() string
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"` NodeID *string `json:"node_id,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 (c *Commit) GetAuthor() *CommitAuthor
GetAuthor returns the Author field.
GetCommentCount returns the CommentCount field if it's non-nil, zero value otherwise.
func (c *Commit) GetCommitter() *CommitAuthor
GetCommitter returns the Committer field.
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
GetMessage returns the Message field if it's non-nil, zero value otherwise.
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (c *Commit) GetStats() *CommitStats
GetStats returns the Stats field.
GetTree returns the Tree field.
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (c *Commit) GetVerification() *SignatureVerification
GetVerification returns the Verification field.
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 (c *CommitAuthor) GetDate() time.Time
GetDate returns the Date field if it's non-nil, zero value otherwise.
func (c *CommitAuthor) GetEmail() string
GetEmail returns the Email field if it's non-nil, zero value otherwise.
func (c *CommitAuthor) GetLogin() string
GetLogin returns the Login field if it's non-nil, zero value otherwise.
func (c *CommitAuthor) GetName() string
GetName returns the Name field if it's non-nil, zero value otherwise.
func (c CommitAuthor) String() string
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 (c *CommitCommentEvent) GetAction() string
GetAction returns the Action field if it's non-nil, zero value otherwise.
func (c *CommitCommentEvent) GetComment() *RepositoryComment
GetComment returns the Comment field.
func (c *CommitCommentEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (c *CommitCommentEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (c *CommitCommentEvent) GetSender() *User
GetSender returns the Sender field.
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 (c *CommitFile) GetAdditions() int
GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetBlobURL() string
GetBlobURL returns the BlobURL field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetChanges() int
GetChanges returns the Changes field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetContentsURL() string
GetContentsURL returns the ContentsURL field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetDeletions() int
GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetFilename() string
GetFilename returns the Filename field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetPatch() string
GetPatch returns the Patch field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetRawURL() string
GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetSHA() string
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (c *CommitFile) GetStatus() string
GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (c CommitFile) String() string
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 (c *CommitResult) GetAuthor() *User
GetAuthor returns the Author field.
func (c *CommitResult) GetCommentsURL() string
GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
func (c *CommitResult) GetCommit() *Commit
GetCommit returns the Commit field.
func (c *CommitResult) GetCommitter() *User
GetCommitter returns the Committer field.
func (c *CommitResult) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (c *CommitResult) GetRepository() *Repository
GetRepository returns the Repository field.
func (c *CommitResult) GetSHA() string
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (c *CommitResult) GetScore() *float64
GetScore returns the Score field.
func (c *CommitResult) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
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 (c *CommitStats) GetAdditions() int
GetAdditions returns the Additions field if it's non-nil, zero value otherwise.
func (c *CommitStats) GetDeletions() int
GetDeletions returns the Deletions field if it's non-nil, zero value otherwise.
func (c *CommitStats) GetTotal() int
GetTotal returns the Total field if it's non-nil, zero value otherwise.
func (c CommitStats) String() string
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 (c *CommitsComparison) GetAheadBy() int
GetAheadBy returns the AheadBy field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetBaseCommit() *RepositoryCommit
GetBaseCommit returns the BaseCommit field.
func (c *CommitsComparison) GetBehindBy() int
GetBehindBy returns the BehindBy field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetDiffURL() string
GetDiffURL returns the DiffURL field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetMergeBaseCommit() *RepositoryCommit
GetMergeBaseCommit returns the MergeBaseCommit field.
func (c *CommitsComparison) GetPatchURL() string
GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetPermalinkURL() string
GetPermalinkURL returns the PermalinkURL field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetStatus() string
GetStatus returns the Status field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetTotalCommits() int
GetTotalCommits returns the TotalCommits field if it's non-nil, zero value otherwise.
func (c *CommitsComparison) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (c CommitsComparison) String() string
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 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 (c *CommitsSearchResult) GetIncompleteResults() bool
GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
func (c *CommitsSearchResult) GetTotal() int
GetTotal returns the Total field if it's non-nil, zero value otherwise.
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.
func (c *CommunityHealthFiles) GetCodeOfConduct() *Metric
GetCodeOfConduct returns the CodeOfConduct field.
func (c *CommunityHealthFiles) GetContributing() *Metric
GetContributing returns the Contributing field.
func (c *CommunityHealthFiles) GetLicense() *Metric
GetLicense returns the License field.
func (c *CommunityHealthFiles) GetReadme() *Metric
GetReadme returns the Readme field.
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 (c *CommunityHealthMetrics) GetFiles() *CommunityHealthFiles
GetFiles returns the Files field.
func (c *CommunityHealthMetrics) GetHealthPercentage() int
GetHealthPercentage returns the HealthPercentage field if it's non-nil, zero value otherwise.
func (c *CommunityHealthMetrics) GetUpdatedAt() time.Time
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
type Contributor struct { Login *string `json:"login,omitempty"` ID *int64 `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,omitempty"` Contributions *int `json:"contributions,omitempty"` }
Contributor represents a repository contributor
func (c *Contributor) GetAvatarURL() string
GetAvatarURL returns the AvatarURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetContributions() int
GetContributions returns the Contributions field if it's non-nil, zero value otherwise.
func (c *Contributor) GetEventsURL() string
GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetFollowersURL() string
GetFollowersURL returns the FollowersURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetFollowingURL() string
GetFollowingURL returns the FollowingURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetGistsURL() string
GetGistsURL returns the GistsURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetGravatarID() string
GetGravatarID returns the GravatarID field if it's non-nil, zero value otherwise.
func (c *Contributor) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (c *Contributor) GetLogin() string
GetLogin returns the Login field if it's non-nil, zero value otherwise.
func (c *Contributor) GetOrganizationsURL() string
GetOrganizationsURL returns the OrganizationsURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetReceivedEventsURL() string
GetReceivedEventsURL returns the ReceivedEventsURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetReposURL() string
GetReposURL returns the ReposURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetSiteAdmin() bool
GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise.
func (c *Contributor) GetStarredURL() string
GetStarredURL returns the StarredURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetSubscriptionsURL() string
GetSubscriptionsURL returns the SubscriptionsURL field if it's non-nil, zero value otherwise.
func (c *Contributor) GetType() string
GetType returns the Type field if it's non-nil, zero value otherwise.
func (c *Contributor) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
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 (c *ContributorStats) GetAuthor() *Contributor
GetAuthor returns the Author field.
func (c *ContributorStats) GetTotal() int
GetTotal returns the Total field if it's non-nil, zero value otherwise.
func (c ContributorStats) String() string
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 (c *CreateEvent) GetDescription() string
GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (c *CreateEvent) GetMasterBranch() string
GetMasterBranch returns the MasterBranch field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetPusherType() string
GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetRef() string
GetRef returns the Ref field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetRefType() string
GetRefType returns the RefType field if it's non-nil, zero value otherwise.
func (c *CreateEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (c *CreateEvent) GetSender() *User
GetSender returns the Sender field.
type CreateOrgInvitationOptions struct { // GitHub user ID for the person you are inviting. Not required if you provide Email. InviteeID *int64 `json:"invitee_id,omitempty"` // Email address of the person you are inviting, which can be an existing GitHub user. // Not required if you provide InviteeID Email *string `json:"email,omitempty"` // Specify role for new member. Can be one of: // * admin - Organization owners with full administrative rights to the // organization and complete access to all repositories and teams. // * direct_member - Non-owner organization members with ability to see // other members and join teams by invitation. // * billing_manager - Non-owner organization members with ability to // manage the billing settings of your organization. // Default is "direct_member". Role *string `json:"role"` TeamID []int64 `json:"team_ids"` }
CreateOrgInvitationOptions specifies the parameters to the OrganizationService.Invite method.
func (c *CreateOrgInvitationOptions) GetEmail() string
GetEmail returns the Email field if it's non-nil, zero value otherwise.
func (c *CreateOrgInvitationOptions) GetInviteeID() int64
GetInviteeID returns the InviteeID field if it's non-nil, zero value otherwise.
func (c *CreateOrgInvitationOptions) GetRole() string
GetRole returns the Role field if it's non-nil, zero value otherwise.
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 (d *DeleteEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (d *DeleteEvent) GetPusherType() string
GetPusherType returns the PusherType field if it's non-nil, zero value otherwise.
func (d *DeleteEvent) GetRef() string
GetRef returns the Ref field if it's non-nil, zero value otherwise.
func (d *DeleteEvent) GetRefType() string
GetRefType returns the RefType field if it's non-nil, zero value otherwise.
func (d *DeleteEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (d *DeleteEvent) GetSender() *User
GetSender returns the Sender field.
type Deployment struct { URL *string `json:"url,omitempty"` ID *int64 `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"` NodeID *string `json:"node_id,omitempty"` }
Deployment represents a deployment in a repo
func (d *Deployment) GetCreatedAt() Timestamp
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (d *Deployment) GetCreator() *User
GetCreator returns the Creator field.
func (d *Deployment) GetDescription() string
GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (d *Deployment) GetEnvironment() string
GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.
func (d *Deployment) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (d *Deployment) GetNodeID() string
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
func (d *Deployment) GetRef() string
GetRef returns the Ref field if it's non-nil, zero value otherwise.
func (d *Deployment) GetRepositoryURL() string
GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
func (d *Deployment) GetSHA() string
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
func (d *Deployment) GetStatusesURL() string
GetStatusesURL returns the StatusesURL field if it's non-nil, zero value otherwise.
func (d *Deployment) GetTask() string
GetTask returns the Task field if it's non-nil, zero value otherwise.
func (d *Deployment) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (d *Deployment) GetUpdatedAt() Timestamp
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
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
func (d *DeploymentEvent) GetDeployment() *Deployment
GetDeployment returns the Deployment field.
func (d *DeploymentEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (d *DeploymentEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (d *DeploymentEvent) GetSender() *User
GetSender returns the Sender field.
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 (d *DeploymentRequest) GetAutoMerge() bool
GetAutoMerge returns the AutoMerge field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetDescription() string
GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetEnvironment() string
GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetPayload() string
GetPayload returns the Payload field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetProductionEnvironment() bool
GetProductionEnvironment returns the ProductionEnvironment field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetRef() string
GetRef returns the Ref field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetRequiredContexts() []string
GetRequiredContexts returns the RequiredContexts field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetTask() string
GetTask returns the Task field if it's non-nil, zero value otherwise.
func (d *DeploymentRequest) GetTransientEnvironment() bool
GetTransientEnvironment returns the TransientEnvironment field if it's non-nil, zero value otherwise.
type DeploymentStatus struct { ID *int64 `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"` NodeID *string `json:"node_id,omitempty"` }
DeploymentStatus represents the status of a particular deployment.
func (d *DeploymentStatus) GetCreatedAt() Timestamp
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetCreator() *User
GetCreator returns the Creator field.
func (d *DeploymentStatus) GetDeploymentURL() string
GetDeploymentURL returns the DeploymentURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetDescription() string
GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetNodeID() string
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetRepositoryURL() string
GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetState() string
GetState returns the State field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetTargetURL() string
GetTargetURL returns the TargetURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatus) GetUpdatedAt() Timestamp
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
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
func (d *DeploymentStatusEvent) GetDeployment() *Deployment
GetDeployment returns the Deployment field.
func (d *DeploymentStatusEvent) GetDeploymentStatus() *DeploymentStatus
GetDeploymentStatus returns the DeploymentStatus field.
func (d *DeploymentStatusEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (d *DeploymentStatusEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (d *DeploymentStatusEvent) GetSender() *User
GetSender returns the Sender field.
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 (d *DeploymentStatusRequest) GetAutoInactive() bool
GetAutoInactive returns the AutoInactive field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetDescription() string
GetDescription returns the Description field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetEnvironmentURL() string
GetEnvironmentURL returns the EnvironmentURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetLogURL() string
GetLogURL returns the LogURL field if it's non-nil, zero value otherwise.
func (d *DeploymentStatusRequest) GetState() string
GetState returns the State field if it's non-nil, zero value otherwise.
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 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 struct { // The list of user logins who can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.) Users *[]string `json:"users,omitempty"` // The list of team slugs which can dismiss pull request reviews. (Required; use nil to disable dismissal_restrictions or &[]string{} otherwise.) Teams *[]string `json:"teams,omitempty"` }
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. Note: Both Users and Teams must be nil, or both must be non-nil.
func (d *DismissalRestrictionsRequest) GetTeams() []string
GetTeams returns the Teams field if it's non-nil, zero value otherwise.
func (d *DismissalRestrictionsRequest) GetUsers() []string
GetUsers returns the Users field if it's non-nil, zero value otherwise.
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 (d *DraftReviewComment) GetBody() string
GetBody returns the Body field if it's non-nil, zero value otherwise.
func (d *DraftReviewComment) GetPath() string
GetPath returns the Path field if it's non-nil, zero value otherwise.
func (d *DraftReviewComment) GetPosition() int
GetPosition returns the Position field if it's non-nil, zero value otherwise.
func (c DraftReviewComment) String() string
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 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
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message Errors []Error `json:"errors"` // more detail on individual errors // Block is only populated on certain types of errors such as code 451. // See https://developer.github.com/changes/2016-03-17-the-451-status-code-is-now-supported/ // for more information. Block *struct { Reason string `json:"reason,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` } `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing // to some content that might help you resolve the error, see // https://developer.github.com/v3/#client-errors DocumentationURL string `json:"documentation_url,omitempty"` }
An ErrorResponse reports one or more errors caused by an API request.
GitHub API docs: https://developer.github.com/v3/#client-errors
func (r *ErrorResponse) Error() string
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"` }
Event represents a GitHub event.
GetActor returns the Actor field.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
func (e *Event) GetOrg() *Organization
GetOrg returns the Org field.
GetPublic returns the Public field if it's non-nil, zero value otherwise.
func (e *Event) GetRawPayload() json.RawMessage
GetRawPayload returns the RawPayload field if it's non-nil, zero value otherwise.
func (e *Event) GetRepo() *Repository
GetRepo returns the Repo field.
GetType returns the Type field if it's non-nil, zero value otherwise.
ParsePayload parses the event payload. For recognized event types, a value of the corresponding struct type will be returned.
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.
FeedLink represents a link to a related resource.
GetHRef returns the HRef field if it's non-nil, zero value otherwise.
GetType returns the Type field if it's non-nil, zero value otherwise.
type Feeds struct { TimelineURL *string `json:"timeline_url,omitempty"` UserURL *string `json:"user_url,omitempty"` CurrentUserPublicURL *string `json:"current_user_public_url,omitempty"` CurrentUserURL *string `json:"current_user_url,omitempty"` CurrentUserActorURL *string `json:"current_user_actor_url,omitempty"` CurrentUserOrganizationURL *string `json:"current_user_organization_url,omitempty"` CurrentUserOrganizationURLs []string `json:"current_user_organization_urls,omitempty"` Links *struct { Timeline *FeedLink `json:"timeline,omitempty"` User *FeedLink `json:"user,omitempty"` CurrentUserPublic *FeedLink `json:"current_user_public,omitempty"` CurrentUser *FeedLink `json:"current_user,omitempty"` CurrentUserActor *FeedLink `json:"current_user_actor,omitempty"` CurrentUserOrganization *FeedLink `json:"current_user_organization,omitempty"` CurrentUserOrganizations []FeedLink `json:"current_user_organizations,omitempty"` } `json:"_links,omitempty"` }
Feeds represents timeline resources in Atom format.
GetCurrentUserActorURL returns the CurrentUserActorURL field if it's non-nil, zero value otherwise.
GetCurrentUserOrganizationURL returns the CurrentUserOrganizationURL field if it's non-nil, zero value otherwise.
GetCurrentUserPublicURL returns the CurrentUserPublicURL field if it's non-nil, zero value otherwise.
GetCurrentUserURL returns the CurrentUserURL field if it's non-nil, zero value otherwise.
GetTimelineURL returns the TimelineURL field if it's non-nil, zero value otherwise.
GetUserURL returns the UserURL field if it's non-nil, zero value otherwise.
type ForkEvent struct { // Forkee is the created repository. Forkee *Repository `json:"forkee,omitempty"` // The following fields are only populated by Webhook events. Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
ForkEvent is triggered when a user forks a repository. The Webhook event name is "fork".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#forkevent
func (f *ForkEvent) GetForkee() *Repository
GetForkee returns the Forkee field.
func (f *ForkEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (f *ForkEvent) GetRepo() *Repository
GetRepo returns the Repo field.
GetSender returns the Sender field.
type GPGEmail struct { Email *string `json:"email,omitempty"` Verified *bool `json:"verified,omitempty"` }
GPGEmail represents an email address associated to a GPG key.
GetEmail returns the Email field if it's non-nil, zero value otherwise.
GetVerified returns the Verified field if it's non-nil, zero value otherwise.
type GPGKey struct { ID *int64 `json:"id,omitempty"` PrimaryKeyID *int64 `json:"primary_key_id,omitempty"` KeyID *string `json:"key_id,omitempty"` PublicKey *string `json:"public_key,omitempty"` Emails []GPGEmail `json:"emails,omitempty"` Subkeys []GPGKey `json:"subkeys,omitempty"` CanSign *bool `json:"can_sign,omitempty"` CanEncryptComms *bool `json:"can_encrypt_comms,omitempty"` CanEncryptStorage *bool `json:"can_encrypt_storage,omitempty"` CanCertify *bool `json:"can_certify,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` ExpiresAt *time.Time `json:"expires_at,omitempty"` }
GPGKey represents a GitHub user's public GPG key used to verify GPG signed commits and tags.
https://developer.github.com/changes/2016-04-04-git-signing-api-preview/
GetCanCertify returns the CanCertify field if it's non-nil, zero value otherwise.
GetCanEncryptComms returns the CanEncryptComms field if it's non-nil, zero value otherwise.
GetCanEncryptStorage returns the CanEncryptStorage field if it's non-nil, zero value otherwise.
GetCanSign returns the CanSign field if it's non-nil, zero value otherwise.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetKeyID returns the KeyID field if it's non-nil, zero value otherwise.
GetPrimaryKeyID returns the PrimaryKeyID field if it's non-nil, zero value otherwise.
GetPublicKey returns the PublicKey field if it's non-nil, zero value otherwise.
String stringifies a GPGKey.
type Gist struct { ID *string `json:"id,omitempty"` Description *string `json:"description,omitempty"` Public *bool `json:"public,omitempty"` Owner *User `json:"owner,omitempty"` Files map[GistFilename]GistFile `json:"files,omitempty"` Comments *int `json:"comments,omitempty"` HTMLURL *string `json:"html_url,omitempty"` GitPullURL *string `json:"git_pull_url,omitempty"` GitPushURL *string `json:"git_push_url,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` NodeID *string `json:"node_id,omitempty"` }
Gist represents a GitHub's gist.
GetComments returns the Comments field if it's non-nil, zero value otherwise.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetDescription returns the Description field if it's non-nil, zero value otherwise.
GetGitPullURL returns the GitPullURL field if it's non-nil, zero value otherwise.
GetGitPushURL returns the GitPushURL field if it's non-nil, zero value otherwise.
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
GetOwner returns the Owner field.
GetPublic returns the Public field if it's non-nil, zero value otherwise.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
type GistComment struct { ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` }
GistComment represents a Gist comment.
func (g *GistComment) GetBody() string
GetBody returns the Body field if it's non-nil, zero value otherwise.
func (g *GistComment) GetCreatedAt() time.Time
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (g *GistComment) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (g *GistComment) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (g *GistComment) GetUser() *User
GetUser returns the User field.
func (g GistComment) String() string
type GistCommit struct { URL *string `json:"url,omitempty"` Version *string `json:"version,omitempty"` User *User `json:"user,omitempty"` ChangeStatus *CommitStats `json:"change_status,omitempty"` CommittedAt *Timestamp `json:"committed_at,omitempty"` NodeID *string `json:"node_id,omitempty"` }
GistCommit represents a commit on a gist.
func (g *GistCommit) GetChangeStatus() *CommitStats
GetChangeStatus returns the ChangeStatus field.
func (g *GistCommit) GetCommittedAt() Timestamp
GetCommittedAt returns the CommittedAt field if it's non-nil, zero value otherwise.
func (g *GistCommit) GetNodeID() string
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
func (g *GistCommit) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (g *GistCommit) GetUser() *User
GetUser returns the User field.
func (g *GistCommit) GetVersion() string
GetVersion returns the Version field if it's non-nil, zero value otherwise.
func (gc GistCommit) String() string
type GistFile struct { Size *int `json:"size,omitempty"` Filename *string `json:"filename,omitempty"` Language *string `json:"language,omitempty"` Type *string `json:"type,omitempty"` RawURL *string `json:"raw_url,omitempty"` Content *string `json:"content,omitempty"` }
GistFile represents a file on a gist.
GetContent returns the Content field if it's non-nil, zero value otherwise.
GetFilename returns the Filename field if it's non-nil, zero value otherwise.
GetLanguage returns the Language field if it's non-nil, zero value otherwise.
GetRawURL returns the RawURL field if it's non-nil, zero value otherwise.
GetSize returns the Size field if it's non-nil, zero value otherwise.
GetType returns the Type field if it's non-nil, zero value otherwise.
GistFilename represents filename on a gist.
type GistFork struct { URL *string `json:"url,omitempty"` User *User `json:"user,omitempty"` ID *string `json:"id,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` NodeID *string `json:"node_id,omitempty"` }
GistFork represents a fork of a gist.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
GetUser returns the User field.
type GistListOptions struct { // Since filters Gists by time. Since time.Time `url:"since,omitempty"` ListOptions }
GistListOptions specifies the optional parameters to the GistsService.List, GistsService.ListAll, and GistsService.ListStarred methods.
type GistStats struct { TotalGists *int `json:"total_gists,omitempty"` PrivateGists *int `json:"private_gists,omitempty"` PublicGists *int `json:"public_gists,omitempty"` }
GistStats represents the number of total, private and public gists.
GetPrivateGists returns the PrivateGists field if it's non-nil, zero value otherwise.
GetPublicGists returns the PublicGists field if it's non-nil, zero value otherwise.
GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise.
type GistsService service
GistsService handles communication with the Gist related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/gists/
Create a gist for authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#create-a-gist
func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error)
CreateComment creates a comment for a gist.
GitHub API docs: https://developer.github.com/v3/gists/comments/#create-a-comment
Delete a gist.
GitHub API docs: https://developer.github.com/v3/gists/#delete-a-gist
func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error)
DeleteComment deletes a gist comment.
GitHub API docs: https://developer.github.com/v3/gists/comments/#delete-a-comment
Edit a gist.
GitHub API docs: https://developer.github.com/v3/gists/#edit-a-gist
func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error)
EditComment edits an existing gist comment.
GitHub API docs: https://developer.github.com/v3/gists/comments/#edit-a-comment
Fork a gist.
GitHub API docs: https://developer.github.com/v3/gists/#fork-a-gist
Get a single gist.
GitHub API docs: https://developer.github.com/v3/gists/#get-a-single-gist
func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error)
GetComment retrieves a single comment from a gist.
GitHub API docs: https://developer.github.com/v3/gists/comments/#get-a-single-comment
GetRevision gets a specific revision of a gist.
GitHub API docs: https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
IsStarred checks if a gist is starred by authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#check-if-a-gist-is-starred
func (s *GistsService) List(ctx context.Context, user string, opt *GistListOptions) ([]*Gist, *Response, error)
List gists for a user. Passing the empty string will list all public gists if called anonymously. However, if the call is authenticated, it will returns all gists for the authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#list-gists
func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error)
ListAll lists all public gists.
GitHub API docs: https://developer.github.com/v3/gists/#list-gists
func (s *GistsService) ListComments(ctx context.Context, gistID string, opt *ListOptions) ([]*GistComment, *Response, error)
ListComments lists all comments for a gist.
GitHub API docs: https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
func (s *GistsService) ListCommits(ctx context.Context, id string, opt *ListOptions) ([]*GistCommit, *Response, error)
ListCommits lists commits of a gist.
GitHub API docs: https://developer.github.com/v3/gists/#list-gist-commits
ListForks lists forks of a gist.
GitHub API docs: https://developer.github.com/v3/gists/#list-gist-forks
func (s *GistsService) ListStarred(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error)
ListStarred lists starred gists of authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#list-gists
Star a gist on behalf of authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#star-a-gist
Unstar a gist on a behalf of authenticated user.
GitHub API docs: https://developer.github.com/v3/gists/#unstar-a-gist
type GitObject struct { Type *string `json:"type"` SHA *string `json:"sha"` URL *string `json:"url"` }
GitObject represents a Git object.
GetSHA returns the SHA field if it's non-nil, zero value otherwise.
GetType returns the Type field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
type GitService service
GitService handles communication with the git data related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/git/
func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error)
CreateBlob creates a blob object.
GitHub API docs: https://developer.github.com/v3/git/blobs/#create-a-blob
func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error)
CreateCommit creates a new commit in a repository. commit must not be nil.
The commit.Committer is optional and will be filled with the commit.Author data if omitted. If the commit.Author is omitted, it will be filled in with the authenticated user’s information and the current date.
GitHub API docs: https://developer.github.com/v3/git/commits/#create-a-commit
func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error)
CreateRef creates a new ref in a repository.
GitHub API docs: https://developer.github.com/v3/git/refs/#create-a-reference
func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error)
CreateTag creates a tag object.
GitHub API docs: https://developer.github.com/v3/git/tags/#create-a-tag-object
func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []TreeEntry) (*Tree, *Response, error)
CreateTree creates a new tree in a repository. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out.
GitHub API docs: https://developer.github.com/v3/git/trees/#create-a-tree
func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error)
DeleteRef deletes a ref from a repository.
GitHub API docs: https://developer.github.com/v3/git/refs/#delete-a-reference
func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error)
GetBlob fetches a blob from a repo given a SHA.
GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error)
GetBlobRaw fetches a blob's contents from a repo. Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data.
GitHub API docs: https://developer.github.com/v3/git/blobs/#get-a-blob
func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error)
GetCommit fetchs the Commit object for a given SHA.
GitHub API docs: https://developer.github.com/v3/git/commits/#get-a-commit
func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error)
GetRef fetches a single Reference object for a given Git ref. If there is no exact match, GetRef will return an error.
Note: The GitHub API can return multiple matches. If you wish to use this functionality please use the GetRefs() method.
GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
func (s *GitService) GetRefs(ctx context.Context, owner string, repo string, ref string) ([]*Reference, *Response, error)
GetRefs fetches a slice of Reference objects for a given Git ref. If there is an exact match, only that ref is returned. If there is no exact match, GitHub returns all refs that start with ref. If returned error is nil, there will be at least 1 ref returned. For example:
"heads/featureA" -> ["refs/heads/featureA"] // Exact match, single ref is returned. "heads/feature" -> ["refs/heads/featureA", "refs/heads/featureB"] // All refs that start with ref. "heads/notexist" -> [] // Returns an error.
GitHub API docs: https://developer.github.com/v3/git/refs/#get-a-reference
func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error)
GetTag fetchs a tag from a repo given a SHA.
GitHub API docs: https://developer.github.com/v3/git/tags/#get-a-tag
func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error)
GetTree fetches the Tree object for a given sha hash from a repository.
GitHub API docs: https://developer.github.com/v3/git/trees/#get-a-tree
func (s *GitService) ListRefs(ctx context.Context, owner, repo string, opt *ReferenceListOptions) ([]*Reference, *Response, error)
ListRefs lists all refs in a repository.
GitHub API docs: https://developer.github.com/v3/git/refs/#get-all-references
func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error)
UpdateRef updates an existing ref in a repository.
GitHub API docs: https://developer.github.com/v3/git/refs/#update-a-reference
type Gitignore struct { Name *string `json:"name,omitempty"` Source *string `json:"source,omitempty"` }
Gitignore represents a .gitignore file as returned by the GitHub API.
GetName returns the Name field if it's non-nil, zero value otherwise.
GetSource returns the Source field if it's non-nil, zero value otherwise.
type GitignoresService service
GitignoresService provides access to the gitignore related functions in the GitHub API.
GitHub API docs: https://developer.github.com/v3/gitignore/
Get a Gitignore by name.
GitHub API docs: https://developer.github.com/v3/gitignore/#get-a-single-template
List all available Gitignore templates.
GitHub API docs: https://developer.github.com/v3/gitignore/#listing-available-templates
type GollumEvent struct { Pages []*Page `json:"pages,omitempty"` // The following fields are only populated by Webhook events. Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
GollumEvent is triggered when a Wiki page is created or updated. The Webhook event name is "gollum".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent
func (g *GollumEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (g *GollumEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (g *GollumEvent) GetSender() *User
GetSender returns the Sender field.
type Grant struct { ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` App *AuthorizationApp `json:"app,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` Scopes []string `json:"scopes,omitempty"` }
Grant represents an OAuth application that has been granted access to an account.
func (g *Grant) GetApp() *AuthorizationApp
GetApp returns the App field.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
type Hook struct { CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Name *string `json:"name,omitempty"` URL *string `json:"url,omitempty"` Events []string `json:"events,omitempty"` Active *bool `json:"active,omitempty"` Config map[string]interface{} `json:"config,omitempty"` ID *int64 `json:"id,omitempty"` }
Hook represents a GitHub (web and service) hook for a repository.
GetActive returns the Active field if it's non-nil, zero value otherwise.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetName returns the Name field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
type HookStats struct { TotalHooks *int `json:"total_hooks,omitempty"` ActiveHooks *int `json:"active_hooks,omitempty"` InactiveHooks *int `json:"inactive_hooks,omitempty"` }
HookStats represents the number of total, active and inactive hooks.
GetActiveHooks returns the ActiveHooks field if it's non-nil, zero value otherwise.
GetInactiveHooks returns the InactiveHooks field if it's non-nil, zero value otherwise.
GetTotalHooks returns the TotalHooks field if it's non-nil, zero value otherwise.
type Import struct { // The URL of the originating repository. VCSURL *string `json:"vcs_url,omitempty"` // The originating VCS type. Can be one of 'subversion', 'git', // 'mercurial', or 'tfvc'. Without this parameter, the import job will // take additional time to detect the VCS type before beginning the // import. This detection step will be reflected in the response. VCS *string `json:"vcs,omitempty"` // VCSUsername and VCSPassword are only used for StartImport calls that // are importing a password-protected repository. VCSUsername *string `json:"vcs_username,omitempty"` VCSPassword *string `json:"vcs_password,omitempty"` // For a tfvc import, the name of the project that is being imported. TFVCProject *string `json:"tfvc_project,omitempty"` // Describes whether the import has been opted in or out of using Git // LFS. The value can be 'opt_in', 'opt_out', or 'undecided' if no // action has been taken. UseLFS *string `json:"use_lfs,omitempty"` // Describes whether files larger than 100MB were found during the // importing step. HasLargeFiles *bool `json:"has_large_files,omitempty"` // The total size in gigabytes of files larger than 100MB found in the // originating repository. LargeFilesSize *int `json:"large_files_size,omitempty"` // The total number of files larger than 100MB found in the originating // repository. To see a list of these files, call LargeFiles. LargeFilesCount *int `json:"large_files_count,omitempty"` // Identifies the current status of an import. An import that does not // have errors will progress through these steps: // // detecting - the "detection" step of the import is in progress // because the request did not include a VCS parameter. The // import is identifying the type of source control present at // the URL. // importing - the "raw" step of the import is in progress. This is // where commit data is fetched from the original repository. // The import progress response will include CommitCount (the // total number of raw commits that will be imported) and // Percent (0 - 100, the current progress through the import). // mapping - the "rewrite" step of the import is in progress. This // is where SVN branches are converted to Git branches, and // where author updates are applied. The import progress // response does not include progress information. // pushing - the "push" step of the import is in progress. This is // where the importer updates the repository on GitHub. The // import progress response will include PushPercent, which is // the percent value reported by git push when it is "Writing // objects". // complete - the import is complete, and the repository is ready // on GitHub. // // If there are problems, you will see one of these in the status field: // // auth_failed - the import requires authentication in order to // connect to the original repository. Make an UpdateImport // request, and include VCSUsername and VCSPassword. // error - the import encountered an error. The import progress // response will include the FailedStep and an error message. // Contact GitHub support for more information. // detection_needs_auth - the importer requires authentication for // the originating repository to continue detection. Make an // UpdatImport request, and include VCSUsername and // VCSPassword. // detection_found_nothing - the importer didn't recognize any // source control at the URL. // detection_found_multiple - the importer found several projects // or repositories at the provided URL. When this is the case, // the Import Progress response will also include a // ProjectChoices field with the possible project choices as // values. Make an UpdateImport request, and include VCS and // (if applicable) TFVCProject. Status *string `json:"status,omitempty"` CommitCount *int `json:"commit_count,omitempty"` StatusText *string `json:"status_text,omitempty"` AuthorsCount *int `json:"authors_count,omitempty"` Percent *int `json:"percent,omitempty"` PushPercent *int `json:"push_percent,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` AuthorsURL *string `json:"authors_url,omitempty"` RepositoryURL *string `json:"repository_url,omitempty"` Message *string `json:"message,omitempty"` FailedStep *string `json:"failed_step,omitempty"` // Human readable display name, provided when the Import appears as // part of ProjectChoices. HumanName *string `json:"human_name,omitempty"` // When the importer finds several projects or repositories at the // provided URLs, this will identify the available choices. Call // UpdateImport with the selected Import value. ProjectChoices []Import `json:"project_choices,omitempty"` }
Import represents a repository import request.
GetAuthorsCount returns the AuthorsCount field if it's non-nil, zero value otherwise.
GetAuthorsURL returns the AuthorsURL field if it's non-nil, zero value otherwise.
GetCommitCount returns the CommitCount field if it's non-nil, zero value otherwise.
GetFailedStep returns the FailedStep field if it's non-nil, zero value otherwise.
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
GetHasLargeFiles returns the HasLargeFiles field if it's non-nil, zero value otherwise.
GetHumanName returns the HumanName field if it's non-nil, zero value otherwise.
GetLargeFilesCount returns the LargeFilesCount field if it's non-nil, zero value otherwise.
GetLargeFilesSize returns the LargeFilesSize field if it's non-nil, zero value otherwise.
GetMessage returns the Message field if it's non-nil, zero value otherwise.
GetPercent returns the Percent field if it's non-nil, zero value otherwise.
GetPushPercent returns the PushPercent field if it's non-nil, zero value otherwise.
GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
GetStatus returns the Status field if it's non-nil, zero value otherwise.
GetStatusText returns the StatusText field if it's non-nil, zero value otherwise.
GetTFVCProject returns the TFVCProject field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
GetUseLFS returns the UseLFS field if it's non-nil, zero value otherwise.
GetVCS returns the VCS field if it's non-nil, zero value otherwise.
GetVCSPassword returns the VCSPassword field if it's non-nil, zero value otherwise.
GetVCSURL returns the VCSURL field if it's non-nil, zero value otherwise.
GetVCSUsername returns the VCSUsername field if it's non-nil, zero value otherwise.
type Installation struct { ID *int64 `json:"id,omitempty"` AppID *int64 `json:"app_id,omitempty"` TargetID *int64 `json:"target_id,omitempty"` Account *User `json:"account,omitempty"` AccessTokensURL *string `json:"access_tokens_url,omitempty"` RepositoriesURL *string `json:"repositories_url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` TargetType *string `json:"target_type,omitempty"` SingleFileName *string `json:"single_file_name,omitempty"` RepositorySelection *string `json:"repository_selection,omitempty"` Events []string `json:"events,omitempty"` Permissions *InstallationPermissions `json:"permissions,omitempty"` }
Installation represents a GitHub Apps installation.
func (i *Installation) GetAccessTokensURL() string
GetAccessTokensURL returns the AccessTokensURL field if it's non-nil, zero value otherwise.
func (i *Installation) GetAccount() *User
GetAccount returns the Account field.
func (i *Installation) GetAppID() int64
GetAppID returns the AppID field if it's non-nil, zero value otherwise.
func (i *Installation) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (i *Installation) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (i *Installation) GetPermissions() *InstallationPermissions
GetPermissions returns the Permissions field.
func (i *Installation) GetRepositoriesURL() string
GetRepositoriesURL returns the RepositoriesURL field if it's non-nil, zero value otherwise.
func (i *Installation) GetRepositorySelection() string
GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise.
func (i *Installation) GetSingleFileName() string
GetSingleFileName returns the SingleFileName field if it's non-nil, zero value otherwise.
func (i *Installation) GetTargetID() int64
GetTargetID returns the TargetID field if it's non-nil, zero value otherwise.
func (i *Installation) GetTargetType() string
GetTargetType returns the TargetType field if it's non-nil, zero value otherwise.
func (i Installation) String() string
type InstallationEvent struct { // The action that was performed. Can be either "created" or "deleted". Action *string `json:"action,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
InstallationEvent is triggered when a GitHub App has been installed or uninstalled. The Webhook event name is "installation".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent
func (i *InstallationEvent) GetAction() string
GetAction returns the Action field if it's non-nil, zero value otherwise.
func (i *InstallationEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (i *InstallationEvent) GetSender() *User
GetSender returns the Sender field.
type InstallationPermissions struct { Metadata *string `json:"metadata,omitempty"` Contents *string `json:"contents,omitempty"` Issues *string `json:"issues,omitempty"` SingleFile *string `json:"single_file,omitempty"` }
InstallationPermissions lists the permissions for metadata, contents, issues and single file for an installation.
func (i *InstallationPermissions) GetContents() string
GetContents returns the Contents field if it's non-nil, zero value otherwise.
func (i *InstallationPermissions) GetIssues() string
GetIssues returns the Issues field if it's non-nil, zero value otherwise.
func (i *InstallationPermissions) GetMetadata() string
GetMetadata returns the Metadata field if it's non-nil, zero value otherwise.
func (i *InstallationPermissions) GetSingleFile() string
GetSingleFile returns the SingleFile field if it's non-nil, zero value otherwise.
type InstallationRepositoriesEvent struct { // The action that was performed. Can be either "added" or "removed". Action *string `json:"action,omitempty"` RepositoriesAdded []*Repository `json:"repositories_added,omitempty"` RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"` RepositorySelection *string `json:"repository_selection,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
InstallationRepositoriesEvent is triggered when a repository is added or removed from an installation. The Webhook event name is "installation_repositories".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent
func (i *InstallationRepositoriesEvent) GetAction() string
GetAction returns the Action field if it's non-nil, zero value otherwise.
func (i *InstallationRepositoriesEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (i *InstallationRepositoriesEvent) GetRepositorySelection() string
GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise.
func (i *InstallationRepositoriesEvent) GetSender() *User
GetSender returns the Sender field.
type InstallationToken struct { Token *string `json:"token,omitempty"` ExpiresAt *time.Time `json:"expires_at,omitempty"` }
InstallationToken represents an installation token.
func (i *InstallationToken) GetExpiresAt() time.Time
GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise.
func (i *InstallationToken) GetToken() string
GetToken returns the Token field if it's non-nil, zero value otherwise.
type Invitation struct { ID *int64 `json:"id,omitempty"` Login *string `json:"login,omitempty"` Email *string `json:"email,omitempty"` // Role can be one of the values - 'direct_member', 'admin', 'billing_manager', 'hiring_manager', or 'reinstate'. Role *string `json:"role,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Inviter *User `json:"inviter,omitempty"` TeamCount *int `json:"team_count,omitempty"` InvitationTeamURL *string `json:"invitation_team_url,omitempty"` }
Invitation represents a team member's invitation status.
func (i *Invitation) GetCreatedAt() time.Time
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (i *Invitation) GetEmail() string
GetEmail returns the Email field if it's non-nil, zero value otherwise.
func (i *Invitation) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (i *Invitation) GetInvitationTeamURL() string
GetInvitationTeamURL returns the InvitationTeamURL field if it's non-nil, zero value otherwise.
func (i *Invitation) GetInviter() *User
GetInviter returns the Inviter field.
func (i *Invitation) GetLogin() string
GetLogin returns the Login field if it's non-nil, zero value otherwise.
func (i *Invitation) GetRole() string
GetRole returns the Role field if it's non-nil, zero value otherwise.
func (i *Invitation) GetTeamCount() int
GetTeamCount returns the TeamCount field if it's non-nil, zero value otherwise.
func (i Invitation) String() string
type Issue struct { ID *int64 `json:"id,omitempty"` Number *int `json:"number,omitempty"` State *string `json:"state,omitempty"` Locked *bool `json:"locked,omitempty"` Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` Labels []Label `json:"labels,omitempty"` Assignee *User `json:"assignee,omitempty"` Comments *int `json:"comments,omitempty"` ClosedAt *time.Time `json:"closed_at,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` ClosedBy *User `json:"closed_by,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` CommentsURL *string `json:"comments_url,omitempty"` EventsURL *string `json:"events_url,omitempty"` LabelsURL *string `json:"labels_url,omitempty"` RepositoryURL *string `json:"repository_url,omitempty"` Milestone *Milestone `json:"milestone,omitempty"` PullRequestLinks *PullRequestLinks `json:"pull_request,omitempty"` Repository *Repository `json:"repository,omitempty"` Reactions *Reactions `json:"reactions,omitempty"` Assignees []*User `json:"assignees,omitempty"` NodeID *string `json:"node_id,omitempty"` // TextMatches is only populated from search results that request text matches // See: search.go and https://developer.github.com/v3/search/#text-match-metadata TextMatches []TextMatch `json:"text_matches,omitempty"` }
Issue represents a GitHub issue on a repository.
Note: As far as the GitHub API is concerned, every pull request is an issue, but not every issue is a pull request. Some endpoints, events, and webhooks may also return pull requests via this struct. If PullRequestLinks is nil, this is an issue, and if PullRequestLinks is not nil, this is a pull request. The IsPullRequest helper method can be used to check that.
GetAssignee returns the Assignee field.
GetBody returns the Body field if it's non-nil, zero value otherwise.
GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise.
GetClosedBy returns the ClosedBy field.
GetComments returns the Comments field if it's non-nil, zero value otherwise.
GetCommentsURL returns the CommentsURL field if it's non-nil, zero value otherwise.
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise.
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
GetID returns the ID field if it's non-nil, zero value otherwise.
GetLabelsURL returns the LabelsURL field if it's non-nil, zero value otherwise.
GetLocked returns the Locked field if it's non-nil, zero value otherwise.
GetMilestone returns the Milestone field.
GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
GetNumber returns the Number field if it's non-nil, zero value otherwise.
func (i *Issue) GetPullRequestLinks() *PullRequestLinks
GetPullRequestLinks returns the PullRequestLinks field.
GetReactions returns the Reactions field.
func (i *Issue) GetRepository() *Repository
GetRepository returns the Repository field.
GetRepositoryURL returns the RepositoryURL field if it's non-nil, zero value otherwise.
GetState returns the State field if it's non-nil, zero value otherwise.
GetTitle returns the Title field if it's non-nil, zero value otherwise.
GetURL returns the URL field if it's non-nil, zero value otherwise.
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
GetUser returns the User field.
IsPullRequest reports whether the issue is also a pull request. It uses the method recommended by GitHub's API documentation, which is to check whether PullRequestLinks is non-nil.
type IssueComment struct { ID *int64 `json:"id,omitempty"` Body *string `json:"body,omitempty"` User *User `json:"user,omitempty"` Reactions *Reactions `json:"reactions,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` // AuthorAssociation is the comment author's relationship to the issue's repository. // Possible values are "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MEMBER", "OWNER", or "NONE". AuthorAssociation *string `json:"author_association,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` IssueURL *string `json:"issue_url,omitempty"` }
IssueComment represents a comment left on an issue.
func (i *IssueComment) GetAuthorAssociation() string
GetAuthorAssociation returns the AuthorAssociation field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetBody() string
GetBody returns the Body field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetCreatedAt() time.Time
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetHTMLURL() string
GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetIssueURL() string
GetIssueURL returns the IssueURL field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetReactions() *Reactions
GetReactions returns the Reactions field.
func (i *IssueComment) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetUpdatedAt() time.Time
GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
func (i *IssueComment) GetUser() *User
GetUser returns the User field.
func (i IssueComment) String() string
type IssueCommentEvent struct { // Action is the action that was performed on the comment. // Possible values are: "created", "edited", "deleted". Action *string `json:"action,omitempty"` Issue *Issue `json:"issue,omitempty"` Comment *IssueComment `json:"comment,omitempty"` // The following fields are only populated by Webhook events. Changes *EditChange `json:"changes,omitempty"` Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
IssueCommentEvent is triggered when an issue comment is created on an issue or pull request. The Webhook event name is "issue_comment".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent
func (i *IssueCommentEvent) GetAction() string
GetAction returns the Action field if it's non-nil, zero value otherwise.
func (i *IssueCommentEvent) GetChanges() *EditChange
GetChanges returns the Changes field.
func (i *IssueCommentEvent) GetComment() *IssueComment
GetComment returns the Comment field.
func (i *IssueCommentEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (i *IssueCommentEvent) GetIssue() *Issue
GetIssue returns the Issue field.
func (i *IssueCommentEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (i *IssueCommentEvent) GetSender() *User
GetSender returns the Sender field.
type IssueEvent struct { ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` // The User that generated this event. Actor *User `json:"actor,omitempty"` // Event identifies the actual type of Event that occurred. Possible // values are: // // closed // The Actor closed the issue. // If the issue was closed by commit message, CommitID holds the SHA1 hash of the commit. // // merged // The Actor merged into master a branch containing a commit mentioning the issue. // CommitID holds the SHA1 of the merge commit. // // referenced // The Actor committed to master a commit mentioning the issue in its commit message. // CommitID holds the SHA1 of the commit. // // reopened, locked, unlocked // The Actor did that to the issue. // // renamed // The Actor changed the issue title from Rename.From to Rename.To. // // mentioned // Someone unspecified @mentioned the Actor [sic] in an issue comment body. // // assigned, unassigned // The Assigner assigned the issue to or removed the assignment from the Assignee. // // labeled, unlabeled // The Actor added or removed the Label from the issue. // // milestoned, demilestoned // The Actor added or removed the issue from the Milestone. // // subscribed, unsubscribed // The Actor subscribed to or unsubscribed from notifications for an issue. // // head_ref_deleted, head_ref_restored // The pull request’s branch was deleted or restored. // Event *string `json:"event,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` 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"` }
IssueEvent represents an event that occurred around an Issue or Pull Request.
func (i *IssueEvent) GetActor() *User
GetActor returns the Actor field.
func (i *IssueEvent) GetAssignee() *User
GetAssignee returns the Assignee field.
func (i *IssueEvent) GetAssigner() *User
GetAssigner returns the Assigner field.
func (i *IssueEvent) GetCommitID() string
GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
func (i *IssueEvent) GetCreatedAt() time.Time
GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
func (i *IssueEvent) GetEvent() string
GetEvent returns the Event field if it's non-nil, zero value otherwise.
func (i *IssueEvent) GetID() int64
GetID returns the ID field if it's non-nil, zero value otherwise.
func (i *IssueEvent) GetIssue() *Issue
GetIssue returns the Issue field.
func (i *IssueEvent) GetLabel() *Label
GetLabel returns the Label field.
func (i *IssueEvent) GetMilestone() *Milestone
GetMilestone returns the Milestone field.
func (i *IssueEvent) GetRename() *Rename
GetRename returns the Rename field.
func (i *IssueEvent) GetURL() string
GetURL returns the URL field if it's non-nil, zero value otherwise.
type IssueListByRepoOptions struct { // Milestone limits issues for the specified milestone. Possible values are // a milestone number, "none" for issues with no milestone, "*" for issues // with any milestone. Milestone string `url:"milestone,omitempty"` // State filters issues based on their state. Possible values are: open, // closed, all. Default is "open". State string `url:"state,omitempty"` // Assignee filters issues based on their assignee. Possible values are a // user name, "none" for issues that are not assigned, "*" for issues with // any assigned user. Assignee string `url:"assignee,omitempty"` // Creator filters issues based on their creator. Creator string `url:"creator,omitempty"` // Mentioned filters issues to those mentioned a specific user. Mentioned string `url:"mentioned,omitempty"` // Labels filters issues based on their label. Labels []string `url:"labels,omitempty,comma"` // Sort specifies how to sort issues. Possible values are: created, updated, // and comments. Default value is "created". Sort string `url:"sort,omitempty"` // Direction in which to sort issues. Possible values are: asc, desc. // Default is "desc". Direction string `url:"direction,omitempty"` // Since filters issues by time. Since time.Time `url:"since,omitempty"` ListOptions }
IssueListByRepoOptions specifies the optional parameters to the IssuesService.ListByRepo method.
type IssueListCommentsOptions struct { // Sort specifies how to sort comments. Possible values are: created, updated. Sort string `url:"sort,omitempty"` // Direction in which to sort comments. Possible values are: asc, desc. Direction string `url:"direction,omitempty"` // Since filters comments by time. Since time.Time `url:"since,omitempty"` ListOptions }
IssueListCommentsOptions specifies the optional parameters to the IssuesService.ListComments method.
type IssueListOptions struct { // Filter specifies which issues to list. Possible values are: assigned, // created, mentioned, subscribed, all. Default is "assigned". Filter string `url:"filter,omitempty"` // State filters issues based on their state. Possible values are: open, // closed, all. Default is "open". State string `url:"state,omitempty"` // Labels filters issues based on their label. Labels []string `url:"labels,comma,omitempty"` // Sort specifies how to sort issues. Possible values are: created, updated, // and comments. Default value is "created". Sort string `url:"sort,omitempty"` // Direction in which to sort issues. Possible values are: asc, desc. // Default is "desc". Direction string `url:"direction,omitempty"` // Since filters issues by time. Since time.Time `url:"since,omitempty"` ListOptions }
IssueListOptions specifies the optional parameters to the IssuesService.List and IssuesService.ListByOrg methods.
type IssueRequest struct { Title *string `json:"title,omitempty"` Body *string `json:"body,omitempty"` Labels *[]string `json:"labels,omitempty"` Assignee *string `json:"assignee,omitempty"` State *string `json:"state,omitempty"` Milestone *int `json:"milestone,omitempty"` Assignees *[]string `json:"assignees,omitempty"` }
IssueRequest represents a request to create/edit an issue. It is separate from Issue above because otherwise Labels and Assignee fail to serialize to the correct JSON.
func (i *IssueRequest) GetAssignee() string
GetAssignee returns the Assignee field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetAssignees() []string
GetAssignees returns the Assignees field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetBody() string
GetBody returns the Body field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetLabels() []string
GetLabels returns the Labels field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetMilestone() int
GetMilestone returns the Milestone field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetState() string
GetState returns the State field if it's non-nil, zero value otherwise.
func (i *IssueRequest) GetTitle() string
GetTitle returns the Title field if it's non-nil, zero value otherwise.
type IssueStats struct { TotalIssues *int `json:"total_issues,omitempty"` OpenIssues *int `json:"open_issues,omitempty"` ClosedIssues *int `json:"closed_issues,omitempty"` }
IssueStats represents the number of total, open and closed issues.
func (i *IssueStats) GetClosedIssues() int
GetClosedIssues returns the ClosedIssues field if it's non-nil, zero value otherwise.
func (i *IssueStats) GetOpenIssues() int
GetOpenIssues returns the OpenIssues field if it's non-nil, zero value otherwise.
func (i *IssueStats) GetTotalIssues() int
GetTotalIssues returns the TotalIssues field if it's non-nil, zero value otherwise.
func (s IssueStats) String() string
type IssuesEvent struct { // Action is the action that was performed. Possible values are: "assigned", // "unassigned", "labeled", "unlabeled", "opened", "closed", "reopened", "edited". Action *string `json:"action,omitempty"` Issue *Issue `json:"issue,omitempty"` Assignee *User `json:"assignee,omitempty"` Label *Label `json:"label,omitempty"` // The following fields are only populated by Webhook events. Changes *EditChange `json:"changes,omitempty"` Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` }
IssuesEvent is triggered when an issue is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened. The Webhook event name is "issues".
GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuesevent
func (i *IssuesEvent) GetAction() string
GetAction returns the Action field if it's non-nil, zero value otherwise.
func (i *IssuesEvent) GetAssignee() *User
GetAssignee returns the Assignee field.
func (i *IssuesEvent) GetChanges() *EditChange
GetChanges returns the Changes field.
func (i *IssuesEvent) GetInstallation() *Installation
GetInstallation returns the Installation field.
func (i *IssuesEvent) GetIssue() *Issue
GetIssue returns the Issue field.
func (i *IssuesEvent) GetLabel() *Label
GetLabel returns the Label field.
func (i *IssuesEvent) GetRepo() *Repository
GetRepo returns the Repo field.
func (i *IssuesEvent) GetSender() *User
GetSender returns the Sender field.
type IssuesSearchResult struct { Total *int `json:"total_count,omitempty"` IncompleteResults *bool `json:"incomplete_results,omitempty"` Issues []Issue `json:"items,omitempty"` }
IssuesSearchResult represents the result of an issues search.
func (i *IssuesSearchResult) GetIncompleteResults() bool
GetIncompleteResults returns the IncompleteResults field if it's non-nil, zero value otherwise.
func (i *IssuesSearchResult) GetTotal() int
GetTotal returns the Total field if it's non-nil, zero value otherwise.
type IssuesService service
IssuesService handles communication with the issue related methods of the GitHub API.
GitHub API docs: https://developer.github.com/v3/issues/
func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error)
AddAssignees adds the provided GitHub users as assignees to the issue.
GitHub API docs: https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error)
AddLabelsToIssue adds labels to an issue.
GitHub API docs: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error)
Create a new issue on the specified repository.
GitHub API docs: https://developer.github.com/v3/issues/#create-an-issue
func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error)
CreateComment creates a new comment on the specified issue.
GitHub API docs: https://developer.github.com/v3/issues/comments/#create-a-comment
func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error)
CreateLabel creates a new label on the specified repository.
GitHub API docs: https://developer.github.com/v3/issues/labels/#create-a-label
func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error)
CreateMilestone creates a new milestone on the specified repository.
GitHub API docs: https://developer.github.com/v3/issues/milestones/#create-a-milestone
func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error)
DeleteComment deletes an issue comment.
GitHub API docs: https://developer.github.com/v3/issues/comments/#delete-a-comment
func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error)
DeleteLabel deletes a label.
GitHub API docs: https://developer.github.com/v3/issues/labels/#delete-a-label
func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error)
DeleteMilestone deletes a milestone.
GitHub API docs: https://developer.github.com/v3/issues/milestones/#delete-a-milestone
func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error)
Edit an issue.
GitHub API docs: https://developer.github.com/v3/issues/#edit-an-issue
func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error)
EditComment updates an issue comment. A non-nil comment.Body must be provided. Other comment fields should be left nil.
GitHub API docs: https://developer.github.com/v3/issues/comments/#edit-a-comment
func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error)
EditLabel edits a label.
GitHub API docs: https://developer.github.com/v3/issues/labels/#update-a-label
func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error)
EditMilestone edits a milestone.
GitHub API docs: https://developer.github.com/v3/issues/milestones/#update-a-milestone
func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error)
Get a single issue.
GitHub API docs: https://developer.github.com/v3/issues/#get-a-single-issue
func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error)
GetComment fetches the specified issue comment.
GitHub API docs: https://developer.github.com/v3/issues/comments/#get-a-single-comment
func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error)
GetEvent returns the specified issue event.
GitHub API docs: https://developer.github.com/v3/issues/events/#get-a-single-event
func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error)
GetLabel gets a single label.
GitHub API docs: https://developer.github.com/v3/issues/labels/#get-a-single-label
func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error)
GetMilestone gets a single milestone.
GitHub API docs: https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error)
IsAssignee checks if a user is an assignee for the specified repository.
GitHub API docs: https://developer.github.com/v3/issues/assignees/#check-assignee
func (s *IssuesService) List(ctx context.Context, all bool, opt *IssueListOptions) ([]*Issue, *Response, error)
List the issues for the authenticated user. If all is true, list issues across all the user's visible repositories including owned, member, and organization repositories; if false, list only owned and member repositories.
GitHub API docs: https://developer.github.com/v3/issues/#list-issues
func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opt *ListOptions) ([]*User, *Response, error)
ListAssignees fetches all available assignees (owners and collaborators) to which issues may be assigned.
GitHub API docs: https://developer.github.com/v3/issues/assignees/#list-assignees
func (s *IssuesService) ListByOrg(ctx context.Context, org string, opt *IssueListOptions) ([]*Issue, *Response, error)
ListByOrg fetches the issues in the specified organization for the authenticated user.
GitHub API docs: https://developer.github.com/v3/issues/#list-issues
func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opt *IssueListByRepoOptions) ([]*Issue, *Response, error)
ListByRepo lists the issues for the specified repository.
GitHub API docs: https://developer.github.com/v3/issues/#list-issues-for-a-repository
func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opt *IssueListCommentsOptions) ([]*IssueComment, *Response, error)
ListComments lists all comments on the specified issue. Specifying an issue number of 0 will return all comments on all issues for the repository.
GitHub API docs: https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*IssueEvent, *Response, error)
ListIssueEvents lists events for the specified issue.
GitHub API docs: https://developer.github.com/v3/issues/events/#list-events-for-an-issue
func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*Timeline, *Response, error)
ListIssueTimeline lists events for the specified issue.
GitHub API docs: https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opt *ListOptions) ([]*Label, *Response, error)
ListLabels lists all labels for a repository.
GitHub API docs: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opt *ListOptions) ([]*Label, *Response, error)
ListLabelsByIssue lists all labels for an issue.
GitHub API docs: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner