...

Source file src/github.com/google/go-github/v47/github/event_types.go

Documentation: github.com/google/go-github/v47/github

     1  // Copyright 2016 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  // These event types are shared between the Events API and used as Webhook payloads.
     7  
     8  package github
     9  
    10  import "encoding/json"
    11  
    12  // RequestedAction is included in a CheckRunEvent when a user has invoked an action,
    13  // i.e. when the CheckRunEvent's Action field is "requested_action".
    14  type RequestedAction struct {
    15  	Identifier string `json:"identifier"` // The integrator reference of the action requested by the user.
    16  }
    17  
    18  // BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted".
    19  // The Webhook event name is "branch_protection_rule".
    20  //
    21  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
    22  type BranchProtectionRuleEvent struct {
    23  	Action       *string               `json:"action,omitempty"`
    24  	Rule         *BranchProtectionRule `json:"rule,omitempty"`
    25  	Changes      *ProtectionChanges    `json:"changes,omitempty"`
    26  	Repo         *Repository           `json:"repository,omitempty"`
    27  	Org          *Organization         `json:"organization,omitempty"`
    28  	Sender       *User                 `json:"sender,omitempty"`
    29  	Installation *Installation         `json:"installation,omitempty"`
    30  }
    31  
    32  // CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".
    33  // The Webhook event name is "check_run".
    34  //
    35  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_run
    36  type CheckRunEvent struct {
    37  	CheckRun *CheckRun `json:"check_run,omitempty"`
    38  	// The action performed. Possible values are: "created", "completed", "rerequested" or "requested_action".
    39  	Action *string `json:"action,omitempty"`
    40  
    41  	// The following fields are only populated by Webhook events.
    42  	Repo         *Repository   `json:"repository,omitempty"`
    43  	Org          *Organization `json:"organization,omitempty"`
    44  	Sender       *User         `json:"sender,omitempty"`
    45  	Installation *Installation `json:"installation,omitempty"`
    46  
    47  	// The action requested by the user. Populated when the Action is "requested_action".
    48  	RequestedAction *RequestedAction `json:"requested_action,omitempty"` //
    49  }
    50  
    51  // CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested".
    52  // The Webhook event name is "check_suite".
    53  //
    54  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_suite
    55  type CheckSuiteEvent struct {
    56  	CheckSuite *CheckSuite `json:"check_suite,omitempty"`
    57  	// The action performed. Possible values are: "completed", "requested" or "rerequested".
    58  	Action *string `json:"action,omitempty"`
    59  
    60  	// The following fields are only populated by Webhook events.
    61  	Repo         *Repository   `json:"repository,omitempty"`
    62  	Org          *Organization `json:"organization,omitempty"`
    63  	Sender       *User         `json:"sender,omitempty"`
    64  	Installation *Installation `json:"installation,omitempty"`
    65  }
    66  
    67  // CommitCommentEvent is triggered when a commit comment is created.
    68  // The Webhook event name is "commit_comment".
    69  //
    70  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#commit_comment
    71  type CommitCommentEvent struct {
    72  	Comment *RepositoryComment `json:"comment,omitempty"`
    73  
    74  	// The following fields are only populated by Webhook events.
    75  	Action       *string       `json:"action,omitempty"`
    76  	Repo         *Repository   `json:"repository,omitempty"`
    77  	Sender       *User         `json:"sender,omitempty"`
    78  	Installation *Installation `json:"installation,omitempty"`
    79  }
    80  
    81  // ContentReferenceEvent is triggered when the body or comment of an issue or
    82  // pull request includes a URL that matches a configured content reference
    83  // domain.
    84  // The Webhook event name is "content_reference".
    85  //
    86  // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#content_reference
    87  type ContentReferenceEvent struct {
    88  	Action           *string           `json:"action,omitempty"`
    89  	ContentReference *ContentReference `json:"content_reference,omitempty"`
    90  	Repo             *Repository       `json:"repository,omitempty"`
    91  	Sender           *User             `json:"sender,omitempty"`
    92  	Installation     *Installation     `json:"installation,omitempty"`
    93  }
    94  
    95  // CreateEvent represents a created repository, branch, or tag.
    96  // The Webhook event name is "create".
    97  //
    98  // Note: webhooks will not receive this event for created repositories.
    99  // Additionally, webhooks will not receive this event for tags if more
   100  // than three tags are pushed at once.
   101  //
   102  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#createevent
   103  type CreateEvent struct {
   104  	Ref *string `json:"ref,omitempty"`
   105  	// RefType is the object that was created. Possible values are: "repository", "branch", "tag".
   106  	RefType      *string `json:"ref_type,omitempty"`
   107  	MasterBranch *string `json:"master_branch,omitempty"`
   108  	Description  *string `json:"description,omitempty"`
   109  	PusherType   *string `json:"pusher_type,omitempty"`
   110  
   111  	// The following fields are only populated by Webhook events.
   112  	Repo         *Repository   `json:"repository,omitempty"`
   113  	Org          *Organization `json:"organization,omitempty"`
   114  	Sender       *User         `json:"sender,omitempty"`
   115  	Installation *Installation `json:"installation,omitempty"`
   116  }
   117  
   118  // DeleteEvent represents a deleted branch or tag.
   119  // The Webhook event name is "delete".
   120  //
   121  // Note: webhooks will not receive this event for tags if more than three tags
   122  // are deleted at once.
   123  //
   124  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#deleteevent
   125  type DeleteEvent struct {
   126  	Ref *string `json:"ref,omitempty"`
   127  	// RefType is the object that was deleted. Possible values are: "branch", "tag".
   128  	RefType *string `json:"ref_type,omitempty"`
   129  
   130  	// The following fields are only populated by Webhook events.
   131  	PusherType   *string       `json:"pusher_type,omitempty"`
   132  	Repo         *Repository   `json:"repository,omitempty"`
   133  	Sender       *User         `json:"sender,omitempty"`
   134  	Installation *Installation `json:"installation,omitempty"`
   135  }
   136  
   137  // DeployKeyEvent is triggered when a deploy key is added or removed from a repository.
   138  // The Webhook event name is "deploy_key".
   139  //
   140  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key
   141  type DeployKeyEvent struct {
   142  	// Action is the action that was performed. Possible values are:
   143  	// "created" or "deleted".
   144  	Action *string `json:"action,omitempty"`
   145  
   146  	// The deploy key resource.
   147  	Key *Key `json:"key,omitempty"`
   148  
   149  	// The Repository where the event occurred
   150  	Repo *Repository `json:"repository,omitempty"`
   151  
   152  	// The following field is only present when the webhook is triggered on
   153  	// a repository belonging to an organization.
   154  	Organization *Organization `json:"organization,omitempty"`
   155  
   156  	// The following fields are only populated by Webhook events.
   157  	Sender       *User         `json:"sender,omitempty"`
   158  	Installation *Installation `json:"installation,omitempty"`
   159  }
   160  
   161  // DeploymentEvent represents a deployment.
   162  // The Webhook event name is "deployment".
   163  //
   164  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   165  //
   166  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment
   167  type DeploymentEvent struct {
   168  	Deployment *Deployment `json:"deployment,omitempty"`
   169  	Repo       *Repository `json:"repository,omitempty"`
   170  
   171  	// The following fields are only populated by Webhook events.
   172  	Sender       *User         `json:"sender,omitempty"`
   173  	Installation *Installation `json:"installation,omitempty"`
   174  }
   175  
   176  // DeploymentStatusEvent represents a deployment status.
   177  // The Webhook event name is "deployment_status".
   178  //
   179  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   180  //
   181  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status
   182  type DeploymentStatusEvent struct {
   183  	Deployment       *Deployment       `json:"deployment,omitempty"`
   184  	DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"`
   185  	Repo             *Repository       `json:"repository,omitempty"`
   186  
   187  	// The following fields are only populated by Webhook events.
   188  	Sender       *User         `json:"sender,omitempty"`
   189  	Installation *Installation `json:"installation,omitempty"`
   190  }
   191  
   192  // DiscussionEvent represents a webhook event for a discussion.
   193  // The Webhook event name is "discussion".
   194  //
   195  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion
   196  type DiscussionEvent struct {
   197  	// Action is the action that was performed. Possible values are:
   198  	// created, edited, deleted, pinned, unpinned, locked, unlocked,
   199  	// transferred, category_changed, answered, or unanswered.
   200  	Action       *string       `json:"action,omitempty"`
   201  	Discussion   *Discussion   `json:"discussion,omitempty"`
   202  	Repo         *Repository   `json:"repository,omitempty"`
   203  	Org          *Organization `json:"organization,omitempty"`
   204  	Sender       *User         `json:"sender,omitempty"`
   205  	Installation *Installation `json:"installation,omitempty"`
   206  }
   207  
   208  // Discussion represents a discussion in a GitHub DiscussionEvent.
   209  type Discussion struct {
   210  	RepositoryURL      *string             `json:"repository_url,omitempty"`
   211  	DiscussionCategory *DiscussionCategory `json:"category,omitempty"`
   212  	AnswerHTMLURL      *string             `json:"answer_html_url,omitempty"`
   213  	AnswerChosenAt     *Timestamp          `json:"answer_chosen_at,omitempty"`
   214  	AnswerChosenBy     *string             `json:"answer_chosen_by,omitempty"`
   215  	HTMLURL            *string             `json:"html_url,omitempty"`
   216  	ID                 *int64              `json:"id,omitempty"`
   217  	NodeID             *string             `json:"node_id,omitempty"`
   218  	Number             *int                `json:"number,omitempty"`
   219  	Title              *string             `json:"title,omitempty"`
   220  	User               *User               `json:"user,omitempty"`
   221  	State              *string             `json:"state,omitempty"`
   222  	Locked             *bool               `json:"locked,omitempty"`
   223  	Comments           *int                `json:"comments,omitempty"`
   224  	CreatedAt          *Timestamp          `json:"created_at,omitempty"`
   225  	UpdatedAt          *Timestamp          `json:"updated_at,omitempty"`
   226  	AuthorAssociation  *string             `json:"author_association,omitempty"`
   227  	ActiveLockReason   *string             `json:"active_lock_reason,omitempty"`
   228  	Body               *string             `json:"body,omitempty"`
   229  }
   230  
   231  // DiscussionCategory represents a discussion category in a GitHub DiscussionEvent.
   232  type DiscussionCategory struct {
   233  	ID           *int64     `json:"id,omitempty"`
   234  	NodeID       *string    `json:"node_id,omitempty"`
   235  	RepositoryID *int64     `json:"repository_id,omitempty"`
   236  	Emoji        *string    `json:"emoji,omitempty"`
   237  	Name         *string    `json:"name,omitempty"`
   238  	Description  *string    `json:"description,omitempty"`
   239  	CreatedAt    *Timestamp `json:"created_at,omitempty"`
   240  	UpdatedAt    *Timestamp `json:"updated_at,omitempty"`
   241  	Slug         *string    `json:"slug,omitempty"`
   242  	IsAnswerable *bool      `json:"is_answerable,omitempty"`
   243  }
   244  
   245  // ForkEvent is triggered when a user forks a repository.
   246  // The Webhook event name is "fork".
   247  //
   248  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#fork
   249  type ForkEvent struct {
   250  	// Forkee is the created repository.
   251  	Forkee *Repository `json:"forkee,omitempty"`
   252  
   253  	// The following fields are only populated by Webhook events.
   254  	Repo         *Repository   `json:"repository,omitempty"`
   255  	Sender       *User         `json:"sender,omitempty"`
   256  	Installation *Installation `json:"installation,omitempty"`
   257  }
   258  
   259  // GitHubAppAuthorizationEvent is triggered when a user's authorization for a
   260  // GitHub Application is revoked.
   261  //
   262  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization
   263  type GitHubAppAuthorizationEvent struct {
   264  	// The action performed. Possible value is: "revoked".
   265  	Action *string `json:"action,omitempty"`
   266  
   267  	// The following fields are only populated by Webhook events.
   268  	Sender       *User         `json:"sender,omitempty"`
   269  	Installation *Installation `json:"installation,omitempty"`
   270  }
   271  
   272  // Page represents a single Wiki page.
   273  type Page struct {
   274  	PageName *string `json:"page_name,omitempty"`
   275  	Title    *string `json:"title,omitempty"`
   276  	Summary  *string `json:"summary,omitempty"`
   277  	Action   *string `json:"action,omitempty"`
   278  	SHA      *string `json:"sha,omitempty"`
   279  	HTMLURL  *string `json:"html_url,omitempty"`
   280  }
   281  
   282  // GollumEvent is triggered when a Wiki page is created or updated.
   283  // The Webhook event name is "gollum".
   284  //
   285  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#gollum
   286  type GollumEvent struct {
   287  	Pages []*Page `json:"pages,omitempty"`
   288  
   289  	// The following fields are only populated by Webhook events.
   290  	Repo         *Repository   `json:"repository,omitempty"`
   291  	Sender       *User         `json:"sender,omitempty"`
   292  	Installation *Installation `json:"installation,omitempty"`
   293  }
   294  
   295  // EditChange represents the changes when an issue, pull request, comment,
   296  // or repository has been edited.
   297  type EditChange struct {
   298  	Title *EditTitle `json:"title,omitempty"`
   299  	Body  *EditBody  `json:"body,omitempty"`
   300  	Base  *EditBase  `json:"base,omitempty"`
   301  	Repo  *EditRepo  `json:"repository,omitempty"`
   302  }
   303  
   304  // EditTitle represents a pull-request title change.
   305  type EditTitle struct {
   306  	From *string `json:"from,omitempty"`
   307  }
   308  
   309  // EditBody represents a change of pull-request body.
   310  type EditBody struct {
   311  	From *string `json:"from,omitempty"`
   312  }
   313  
   314  // EditBase represents the change of a pull-request base branch.
   315  type EditBase struct {
   316  	Ref *EditRef `json:"ref,omitempty"`
   317  	SHA *EditSHA `json:"sha,omitempty"`
   318  }
   319  
   320  // EditRef represents a ref change of a pull-request.
   321  type EditRef struct {
   322  	From *string `json:"from,omitempty"`
   323  }
   324  
   325  // EditRepo represents a change of repository name.
   326  type EditRepo struct {
   327  	Name *RepoName `json:"name,omitempty"`
   328  }
   329  
   330  // RepoName represents a change of repository name.
   331  type RepoName struct {
   332  	From *string `json:"from,omitempty"`
   333  }
   334  
   335  // EditSHA represents a sha change of a pull-request.
   336  type EditSHA struct {
   337  	From *string `json:"from,omitempty"`
   338  }
   339  
   340  // ProjectChange represents the changes when a project has been edited.
   341  type ProjectChange struct {
   342  	Name *ProjectName `json:"name,omitempty"`
   343  	Body *ProjectBody `json:"body,omitempty"`
   344  }
   345  
   346  // ProjectName represents a project name change.
   347  type ProjectName struct {
   348  	From *string `json:"from,omitempty"`
   349  }
   350  
   351  // ProjectBody represents a project body change.
   352  type ProjectBody struct {
   353  	From *string `json:"from,omitempty"`
   354  }
   355  
   356  // ProjectCardChange represents the changes when a project card has been edited.
   357  type ProjectCardChange struct {
   358  	Note *ProjectCardNote `json:"note,omitempty"`
   359  }
   360  
   361  // ProjectCardNote represents a change of a note of a project card.
   362  type ProjectCardNote struct {
   363  	From *string `json:"from,omitempty"`
   364  }
   365  
   366  // ProjectColumnChange represents the changes when a project column has been edited.
   367  type ProjectColumnChange struct {
   368  	Name *ProjectColumnName `json:"name,omitempty"`
   369  }
   370  
   371  // ProjectColumnName represents a project column name change.
   372  type ProjectColumnName struct {
   373  	From *string `json:"from,omitempty"`
   374  }
   375  
   376  // TeamChange represents the changes when a team has been edited.
   377  type TeamChange struct {
   378  	Description *TeamDescription `json:"description,omitempty"`
   379  	Name        *TeamName        `json:"name,omitempty"`
   380  	Privacy     *TeamPrivacy     `json:"privacy,omitempty"`
   381  	Repository  *TeamRepository  `json:"repository,omitempty"`
   382  }
   383  
   384  // TeamDescription represents a team description change.
   385  type TeamDescription struct {
   386  	From *string `json:"from,omitempty"`
   387  }
   388  
   389  // TeamName represents a team name change.
   390  type TeamName struct {
   391  	From *string `json:"from,omitempty"`
   392  }
   393  
   394  // TeamPrivacy represents a team privacy change.
   395  type TeamPrivacy struct {
   396  	From *string `json:"from,omitempty"`
   397  }
   398  
   399  // TeamRepository represents a team repository permission change.
   400  type TeamRepository struct {
   401  	Permissions *TeamPermissions `json:"permissions,omitempty"`
   402  }
   403  
   404  // TeamPermissions represents a team permission change.
   405  type TeamPermissions struct {
   406  	From *TeamPermissionsFrom `json:"from,omitempty"`
   407  }
   408  
   409  // TeamPermissionsFrom represents a team permission change.
   410  type TeamPermissionsFrom struct {
   411  	Admin *bool `json:"admin,omitempty"`
   412  	Pull  *bool `json:"pull,omitempty"`
   413  	Push  *bool `json:"push,omitempty"`
   414  }
   415  
   416  // InstallationEvent is triggered when a GitHub App has been installed, uninstalled, suspend, unsuspended
   417  // or new permissions have been accepted.
   418  // The Webhook event name is "installation".
   419  //
   420  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation
   421  type InstallationEvent struct {
   422  	// The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted".
   423  	Action       *string       `json:"action,omitempty"`
   424  	Repositories []*Repository `json:"repositories,omitempty"`
   425  	Sender       *User         `json:"sender,omitempty"`
   426  	Installation *Installation `json:"installation,omitempty"`
   427  	// TODO key "requester" is not covered
   428  }
   429  
   430  // InstallationRepositoriesEvent is triggered when a repository is added or
   431  // removed from an installation. The Webhook event name is "installation_repositories".
   432  //
   433  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories
   434  type InstallationRepositoriesEvent struct {
   435  	// The action that was performed. Can be either "added" or "removed".
   436  	Action              *string       `json:"action,omitempty"`
   437  	RepositoriesAdded   []*Repository `json:"repositories_added,omitempty"`
   438  	RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`
   439  	RepositorySelection *string       `json:"repository_selection,omitempty"`
   440  	Sender              *User         `json:"sender,omitempty"`
   441  	Installation        *Installation `json:"installation,omitempty"`
   442  }
   443  
   444  // IssueCommentEvent is triggered when an issue comment is created on an issue
   445  // or pull request.
   446  // The Webhook event name is "issue_comment".
   447  //
   448  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment
   449  type IssueCommentEvent struct {
   450  	// Action is the action that was performed on the comment.
   451  	// Possible values are: "created", "edited", "deleted".
   452  	Action  *string       `json:"action,omitempty"`
   453  	Issue   *Issue        `json:"issue,omitempty"`
   454  	Comment *IssueComment `json:"comment,omitempty"`
   455  
   456  	// The following fields are only populated by Webhook events.
   457  	Changes      *EditChange   `json:"changes,omitempty"`
   458  	Repo         *Repository   `json:"repository,omitempty"`
   459  	Sender       *User         `json:"sender,omitempty"`
   460  	Installation *Installation `json:"installation,omitempty"`
   461  
   462  	// The following field is only present when the webhook is triggered on
   463  	// a repository belonging to an organization.
   464  	Organization *Organization `json:"organization,omitempty"`
   465  }
   466  
   467  // IssuesEvent is triggered when an issue is opened, edited, deleted, transferred,
   468  // pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled,
   469  // locked, unlocked, milestoned, or demilestoned.
   470  // The Webhook event name is "issues".
   471  //
   472  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issues
   473  type IssuesEvent struct {
   474  	// Action is the action that was performed. Possible values are: "opened",
   475  	// "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened",
   476  	// "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked",
   477  	// "milestoned", or "demilestoned".
   478  	Action   *string `json:"action,omitempty"`
   479  	Issue    *Issue  `json:"issue,omitempty"`
   480  	Assignee *User   `json:"assignee,omitempty"`
   481  	Label    *Label  `json:"label,omitempty"`
   482  
   483  	// The following fields are only populated by Webhook events.
   484  	Changes      *EditChange   `json:"changes,omitempty"`
   485  	Repo         *Repository   `json:"repository,omitempty"`
   486  	Sender       *User         `json:"sender,omitempty"`
   487  	Installation *Installation `json:"installation,omitempty"`
   488  }
   489  
   490  // LabelEvent is triggered when a repository's label is created, edited, or deleted.
   491  // The Webhook event name is "label"
   492  //
   493  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#label
   494  type LabelEvent struct {
   495  	// Action is the action that was performed. Possible values are:
   496  	// "created", "edited", "deleted"
   497  	Action  *string     `json:"action,omitempty"`
   498  	Label   *Label      `json:"label,omitempty"`
   499  	Changes *EditChange `json:"changes,omitempty"`
   500  
   501  	// The following fields are only populated by Webhook events.
   502  	Repo         *Repository   `json:"repository,omitempty"`
   503  	Org          *Organization `json:"organization,omitempty"`
   504  	Sender       *User         `json:"sender,omitempty"`
   505  	Installation *Installation `json:"installation,omitempty"`
   506  }
   507  
   508  // MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes
   509  // their GitHub Marketplace plan.
   510  // Webhook event name "marketplace_purchase".
   511  //
   512  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase
   513  type MarketplacePurchaseEvent struct {
   514  	// Action is the action that was performed. Possible values are:
   515  	// "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed".
   516  	Action *string `json:"action,omitempty"`
   517  
   518  	// The following fields are only populated by Webhook events.
   519  	EffectiveDate               *Timestamp           `json:"effective_date,omitempty"`
   520  	MarketplacePurchase         *MarketplacePurchase `json:"marketplace_purchase,omitempty"`
   521  	PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
   522  	Sender                      *User                `json:"sender,omitempty"`
   523  	Installation                *Installation        `json:"installation,omitempty"`
   524  }
   525  
   526  // MemberEvent is triggered when a user is added as a collaborator to a repository.
   527  // The Webhook event name is "member".
   528  //
   529  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#member
   530  type MemberEvent struct {
   531  	// Action is the action that was performed. Possible value is: "added".
   532  	Action *string `json:"action,omitempty"`
   533  	Member *User   `json:"member,omitempty"`
   534  
   535  	// The following fields are only populated by Webhook events.
   536  	Repo         *Repository   `json:"repository,omitempty"`
   537  	Sender       *User         `json:"sender,omitempty"`
   538  	Installation *Installation `json:"installation,omitempty"`
   539  }
   540  
   541  // MembershipEvent is triggered when a user is added or removed from a team.
   542  // The Webhook event name is "membership".
   543  //
   544  // Events of this type are not visible in timelines, they are only used to
   545  // trigger organization webhooks.
   546  //
   547  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#membership
   548  type MembershipEvent struct {
   549  	// Action is the action that was performed. Possible values are: "added", "removed".
   550  	Action *string `json:"action,omitempty"`
   551  	// Scope is the scope of the membership. Possible value is: "team".
   552  	Scope  *string `json:"scope,omitempty"`
   553  	Member *User   `json:"member,omitempty"`
   554  	Team   *Team   `json:"team,omitempty"`
   555  
   556  	// The following fields are only populated by Webhook events.
   557  	Org          *Organization `json:"organization,omitempty"`
   558  	Sender       *User         `json:"sender,omitempty"`
   559  	Installation *Installation `json:"installation,omitempty"`
   560  }
   561  
   562  // MetaEvent is triggered when the webhook that this event is configured on is deleted.
   563  // This event will only listen for changes to the particular hook the event is installed on.
   564  // Therefore, it must be selected for each hook that you'd like to receive meta events for.
   565  // The Webhook event name is "meta".
   566  //
   567  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#meta
   568  type MetaEvent struct {
   569  	// Action is the action that was performed. Possible value is: "deleted".
   570  	Action *string `json:"action,omitempty"`
   571  	// The ID of the modified webhook.
   572  	HookID *int64 `json:"hook_id,omitempty"`
   573  	// The modified webhook.
   574  	// This will contain different keys based on the type of webhook it is: repository,
   575  	// organization, business, app, or GitHub Marketplace.
   576  	Hook *Hook `json:"hook,omitempty"`
   577  
   578  	// The following fields are only populated by Webhook events.
   579  	Repo         *Repository   `json:"repository,omitempty"`
   580  	Org          *Organization `json:"organization,omitempty"`
   581  	Sender       *User         `json:"sender,omitempty"`
   582  	Installation *Installation `json:"installation,omitempty"`
   583  }
   584  
   585  // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted.
   586  // The Webhook event name is "milestone".
   587  //
   588  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#milestone
   589  type MilestoneEvent struct {
   590  	// Action is the action that was performed. Possible values are:
   591  	// "created", "closed", "opened", "edited", "deleted"
   592  	Action    *string    `json:"action,omitempty"`
   593  	Milestone *Milestone `json:"milestone,omitempty"`
   594  
   595  	// The following fields are only populated by Webhook events.
   596  	Changes      *EditChange   `json:"changes,omitempty"`
   597  	Repo         *Repository   `json:"repository,omitempty"`
   598  	Sender       *User         `json:"sender,omitempty"`
   599  	Org          *Organization `json:"organization,omitempty"`
   600  	Installation *Installation `json:"installation,omitempty"`
   601  }
   602  
   603  // OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added,
   604  // removed, or invited to an organization.
   605  // Events of this type are not visible in timelines. These events are only used to trigger organization hooks.
   606  // Webhook event name is "organization".
   607  //
   608  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#organization
   609  type OrganizationEvent struct {
   610  	// Action is the action that was performed.
   611  	// Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited".
   612  	Action *string `json:"action,omitempty"`
   613  
   614  	// Invitation is the invitation for the user or email if the action is "member_invited".
   615  	Invitation *Invitation `json:"invitation,omitempty"`
   616  
   617  	// Membership is the membership between the user and the organization.
   618  	// Not present when the action is "member_invited".
   619  	Membership *Membership `json:"membership,omitempty"`
   620  
   621  	Organization *Organization `json:"organization,omitempty"`
   622  	Sender       *User         `json:"sender,omitempty"`
   623  	Installation *Installation `json:"installation,omitempty"`
   624  }
   625  
   626  // OrgBlockEvent is triggered when an organization blocks or unblocks a user.
   627  // The Webhook event name is "org_block".
   628  //
   629  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#org_block
   630  type OrgBlockEvent struct {
   631  	// Action is the action that was performed.
   632  	// Can be "blocked" or "unblocked".
   633  	Action       *string       `json:"action,omitempty"`
   634  	BlockedUser  *User         `json:"blocked_user,omitempty"`
   635  	Organization *Organization `json:"organization,omitempty"`
   636  	Sender       *User         `json:"sender,omitempty"`
   637  
   638  	// The following fields are only populated by Webhook events.
   639  	Installation *Installation `json:"installation,omitempty"`
   640  }
   641  
   642  // PackageEvent represents activity related to GitHub Packages.
   643  // The Webhook event name is "package".
   644  //
   645  // This event is triggered when a GitHub Package is published or updated.
   646  //
   647  // GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package
   648  type PackageEvent struct {
   649  	// Action is the action that was performed.
   650  	// Can be "published" or "updated".
   651  	Action  *string       `json:"action,omitempty"`
   652  	Package *Package      `json:"package,omitempty"`
   653  	Repo    *Repository   `json:"repository,omitempty"`
   654  	Org     *Organization `json:"organization,omitempty"`
   655  	Sender  *User         `json:"sender,omitempty"`
   656  
   657  	// The following fields are only populated by Webhook events.
   658  	Installation *Installation `json:"installation,omitempty"`
   659  }
   660  
   661  // PageBuildEvent represents an attempted build of a GitHub Pages site, whether
   662  // successful or not.
   663  // The Webhook event name is "page_build".
   664  //
   665  // This event is triggered on push to a GitHub Pages enabled branch (gh-pages
   666  // for project pages, master for user and organization pages).
   667  //
   668  // Events of this type are not visible in timelines, they are only used to trigger hooks.
   669  //
   670  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#page_build
   671  type PageBuildEvent struct {
   672  	Build *PagesBuild `json:"build,omitempty"`
   673  
   674  	// The following fields are only populated by Webhook events.
   675  	ID           *int64        `json:"id,omitempty"`
   676  	Repo         *Repository   `json:"repository,omitempty"`
   677  	Sender       *User         `json:"sender,omitempty"`
   678  	Installation *Installation `json:"installation,omitempty"`
   679  }
   680  
   681  // PingEvent is triggered when a Webhook is added to GitHub.
   682  //
   683  // GitHub API docs: https://developer.github.com/webhooks/#ping-event
   684  type PingEvent struct {
   685  	// Random string of GitHub zen.
   686  	Zen *string `json:"zen,omitempty"`
   687  	// The ID of the webhook that triggered the ping.
   688  	HookID *int64 `json:"hook_id,omitempty"`
   689  	// The webhook configuration.
   690  	Hook *Hook `json:"hook,omitempty"`
   691  
   692  	// The following fields are only populated by Webhook events.
   693  	Repo         *Repository   `json:"repository,omitempty"`
   694  	Org          *Organization `json:"organization,omitempty"`
   695  	Sender       *User         `json:"sender,omitempty"`
   696  	Installation *Installation `json:"installation,omitempty"`
   697  }
   698  
   699  // ProjectEvent is triggered when project is created, modified or deleted.
   700  // The webhook event name is "project".
   701  //
   702  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project
   703  type ProjectEvent struct {
   704  	Action  *string        `json:"action,omitempty"`
   705  	Changes *ProjectChange `json:"changes,omitempty"`
   706  	Project *Project       `json:"project,omitempty"`
   707  
   708  	// The following fields are only populated by Webhook events.
   709  	Repo         *Repository   `json:"repository,omitempty"`
   710  	Org          *Organization `json:"organization,omitempty"`
   711  	Sender       *User         `json:"sender,omitempty"`
   712  	Installation *Installation `json:"installation,omitempty"`
   713  }
   714  
   715  // ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted.
   716  // The webhook event name is "project_card".
   717  //
   718  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_card
   719  type ProjectCardEvent struct {
   720  	Action      *string            `json:"action,omitempty"`
   721  	Changes     *ProjectCardChange `json:"changes,omitempty"`
   722  	AfterID     *int64             `json:"after_id,omitempty"`
   723  	ProjectCard *ProjectCard       `json:"project_card,omitempty"`
   724  
   725  	// The following fields are only populated by Webhook events.
   726  	Repo         *Repository   `json:"repository,omitempty"`
   727  	Org          *Organization `json:"organization,omitempty"`
   728  	Sender       *User         `json:"sender,omitempty"`
   729  	Installation *Installation `json:"installation,omitempty"`
   730  }
   731  
   732  // ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted.
   733  // The webhook event name is "project_column".
   734  //
   735  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_column
   736  type ProjectColumnEvent struct {
   737  	Action        *string              `json:"action,omitempty"`
   738  	Changes       *ProjectColumnChange `json:"changes,omitempty"`
   739  	AfterID       *int64               `json:"after_id,omitempty"`
   740  	ProjectColumn *ProjectColumn       `json:"project_column,omitempty"`
   741  
   742  	// The following fields are only populated by Webhook events.
   743  	Repo         *Repository   `json:"repository,omitempty"`
   744  	Org          *Organization `json:"organization,omitempty"`
   745  	Sender       *User         `json:"sender,omitempty"`
   746  	Installation *Installation `json:"installation,omitempty"`
   747  }
   748  
   749  // PublicEvent is triggered when a private repository is open sourced.
   750  // According to GitHub: "Without a doubt: the best GitHub event."
   751  // The Webhook event name is "public".
   752  //
   753  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#public
   754  type PublicEvent struct {
   755  	// The following fields are only populated by Webhook events.
   756  	Repo         *Repository   `json:"repository,omitempty"`
   757  	Sender       *User         `json:"sender,omitempty"`
   758  	Installation *Installation `json:"installation,omitempty"`
   759  }
   760  
   761  // PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
   762  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
   763  // locked, unlocked, a pull request review is requested, or a review request is removed.
   764  // The Webhook event name is "pull_request".
   765  //
   766  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent
   767  type PullRequestEvent struct {
   768  	// Action is the action that was performed. Possible values are:
   769  	// "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled",
   770  	// "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened".
   771  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
   772  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
   773  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
   774  	// don't include pull request events with the "synchronize" action.
   775  	Action      *string      `json:"action,omitempty"`
   776  	Assignee    *User        `json:"assignee,omitempty"`
   777  	Number      *int         `json:"number,omitempty"`
   778  	PullRequest *PullRequest `json:"pull_request,omitempty"`
   779  
   780  	// The following fields are only populated by Webhook events.
   781  	Changes *EditChange `json:"changes,omitempty"`
   782  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
   783  	// A request affecting multiple reviewers at once is split into multiple
   784  	// such event deliveries, each with a single, different RequestedReviewer.
   785  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
   786  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
   787  	// "requested_user" with the same delivery behavior.
   788  	RequestedTeam *Team         `json:"requested_team,omitempty"`
   789  	Repo          *Repository   `json:"repository,omitempty"`
   790  	Sender        *User         `json:"sender,omitempty"`
   791  	Installation  *Installation `json:"installation,omitempty"`
   792  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
   793  
   794  	// The following field is only present when the webhook is triggered on
   795  	// a repository belonging to an organization.
   796  	Organization *Organization `json:"organization,omitempty"`
   797  
   798  	// The following fields are only populated when the Action is "synchronize".
   799  	Before *string `json:"before,omitempty"`
   800  	After  *string `json:"after,omitempty"`
   801  }
   802  
   803  // PullRequestReviewEvent is triggered when a review is submitted on a pull
   804  // request.
   805  // The Webhook event name is "pull_request_review".
   806  //
   807  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review
   808  type PullRequestReviewEvent struct {
   809  	// Action is always "submitted".
   810  	Action      *string            `json:"action,omitempty"`
   811  	Review      *PullRequestReview `json:"review,omitempty"`
   812  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
   813  
   814  	// The following fields are only populated by Webhook events.
   815  	Repo         *Repository   `json:"repository,omitempty"`
   816  	Sender       *User         `json:"sender,omitempty"`
   817  	Installation *Installation `json:"installation,omitempty"`
   818  
   819  	// The following field is only present when the webhook is triggered on
   820  	// a repository belonging to an organization.
   821  	Organization *Organization `json:"organization,omitempty"`
   822  }
   823  
   824  // PullRequestReviewCommentEvent is triggered when a comment is created on a
   825  // portion of the unified diff of a pull request.
   826  // The Webhook event name is "pull_request_review_comment".
   827  //
   828  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment
   829  type PullRequestReviewCommentEvent struct {
   830  	// Action is the action that was performed on the comment.
   831  	// Possible values are: "created", "edited", "deleted".
   832  	Action      *string             `json:"action,omitempty"`
   833  	PullRequest *PullRequest        `json:"pull_request,omitempty"`
   834  	Comment     *PullRequestComment `json:"comment,omitempty"`
   835  
   836  	// The following fields are only populated by Webhook events.
   837  	Changes      *EditChange   `json:"changes,omitempty"`
   838  	Repo         *Repository   `json:"repository,omitempty"`
   839  	Sender       *User         `json:"sender,omitempty"`
   840  	Installation *Installation `json:"installation,omitempty"`
   841  }
   842  
   843  // PullRequestReviewThreadEvent is triggered when a comment made as part of a
   844  // review of a pull request is marked resolved or unresolved.
   845  // The Webhook event name is "pull_request_review_thread".
   846  //
   847  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread
   848  type PullRequestReviewThreadEvent struct {
   849  	// Action is the action that was performed on the comment.
   850  	// Possible values are: "resolved", "unresolved".
   851  	Action      *string            `json:"action,omitempty"`
   852  	Thread      *PullRequestThread `json:"thread,omitempty"`
   853  	PullRequest *PullRequest       `json:"pull_request,omitempty"`
   854  
   855  	// The following fields are only populated by Webhook events.
   856  	Repo         *Repository   `json:"repository,omitempty"`
   857  	Sender       *User         `json:"sender,omitempty"`
   858  	Installation *Installation `json:"installation,omitempty"`
   859  }
   860  
   861  // PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
   862  // unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review,
   863  // locked, unlocked, a pull request review is requested, or a review request is removed.
   864  // The Webhook event name is "pull_request_target".
   865  //
   866  // GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target
   867  type PullRequestTargetEvent struct {
   868  	// Action is the action that was performed. Possible values are:
   869  	// "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened",
   870  	// "ready_for_review", "locked", "unlocked", "review_requested" or "review_request_removed".
   871  	// If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits.
   872  	// If the action is "closed" and the "merged" key is "true", the pull request was merged.
   873  	// While webhooks are also triggered when a pull request is synchronized, Events API timelines
   874  	// don't include pull request events with the "synchronize" action.
   875  	Action      *string      `json:"action,omitempty"`
   876  	Assignee    *User        `json:"assignee,omitempty"`
   877  	Number      *int         `json:"number,omitempty"`
   878  	PullRequest *PullRequest `json:"pull_request,omitempty"`
   879  
   880  	// The following fields are only populated by Webhook events.
   881  	Changes *EditChange `json:"changes,omitempty"`
   882  	// RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries.
   883  	// A request affecting multiple reviewers at once is split into multiple
   884  	// such event deliveries, each with a single, different RequestedReviewer.
   885  	RequestedReviewer *User `json:"requested_reviewer,omitempty"`
   886  	// In the event that a team is requested instead of a user, "requested_team" gets sent in place of
   887  	// "requested_user" with the same delivery behavior.
   888  	RequestedTeam *Team         `json:"requested_team,omitempty"`
   889  	Repo          *Repository   `json:"repository,omitempty"`
   890  	Sender        *User         `json:"sender,omitempty"`
   891  	Installation  *Installation `json:"installation,omitempty"`
   892  	Label         *Label        `json:"label,omitempty"` // Populated in "labeled" event deliveries.
   893  
   894  	// The following field is only present when the webhook is triggered on
   895  	// a repository belonging to an organization.
   896  	Organization *Organization `json:"organization,omitempty"`
   897  
   898  	// The following fields are only populated when the Action is "synchronize".
   899  	Before *string `json:"before,omitempty"`
   900  	After  *string `json:"after,omitempty"`
   901  }
   902  
   903  // PushEvent represents a git push to a GitHub repository.
   904  //
   905  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#push
   906  type PushEvent struct {
   907  	PushID       *int64        `json:"push_id,omitempty"`
   908  	Head         *string       `json:"head,omitempty"`
   909  	Ref          *string       `json:"ref,omitempty"`
   910  	Size         *int          `json:"size,omitempty"`
   911  	Commits      []*HeadCommit `json:"commits,omitempty"`
   912  	Before       *string       `json:"before,omitempty"`
   913  	DistinctSize *int          `json:"distinct_size,omitempty"`
   914  
   915  	// The following fields are only populated by Webhook events.
   916  	Action       *string              `json:"action,omitempty"`
   917  	After        *string              `json:"after,omitempty"`
   918  	Created      *bool                `json:"created,omitempty"`
   919  	Deleted      *bool                `json:"deleted,omitempty"`
   920  	Forced       *bool                `json:"forced,omitempty"`
   921  	BaseRef      *string              `json:"base_ref,omitempty"`
   922  	Compare      *string              `json:"compare,omitempty"`
   923  	Repo         *PushEventRepository `json:"repository,omitempty"`
   924  	HeadCommit   *HeadCommit          `json:"head_commit,omitempty"`
   925  	Pusher       *User                `json:"pusher,omitempty"`
   926  	Sender       *User                `json:"sender,omitempty"`
   927  	Installation *Installation        `json:"installation,omitempty"`
   928  
   929  	// The following field is only present when the webhook is triggered on
   930  	// a repository belonging to an organization.
   931  	Organization *Organization `json:"organization,omitempty"`
   932  }
   933  
   934  func (p PushEvent) String() string {
   935  	return Stringify(p)
   936  }
   937  
   938  // HeadCommit represents a git commit in a GitHub PushEvent.
   939  type HeadCommit struct {
   940  	Message  *string       `json:"message,omitempty"`
   941  	Author   *CommitAuthor `json:"author,omitempty"`
   942  	URL      *string       `json:"url,omitempty"`
   943  	Distinct *bool         `json:"distinct,omitempty"`
   944  
   945  	// The following fields are only populated by Events API.
   946  	SHA *string `json:"sha,omitempty"`
   947  
   948  	// The following fields are only populated by Webhook events.
   949  	ID        *string       `json:"id,omitempty"`
   950  	TreeID    *string       `json:"tree_id,omitempty"`
   951  	Timestamp *Timestamp    `json:"timestamp,omitempty"`
   952  	Committer *CommitAuthor `json:"committer,omitempty"`
   953  	Added     []string      `json:"added,omitempty"`
   954  	Removed   []string      `json:"removed,omitempty"`
   955  	Modified  []string      `json:"modified,omitempty"`
   956  }
   957  
   958  func (h HeadCommit) String() string {
   959  	return Stringify(h)
   960  }
   961  
   962  // PushEventRepository represents the repo object in a PushEvent payload.
   963  type PushEventRepository struct {
   964  	ID              *int64     `json:"id,omitempty"`
   965  	NodeID          *string    `json:"node_id,omitempty"`
   966  	Name            *string    `json:"name,omitempty"`
   967  	FullName        *string    `json:"full_name,omitempty"`
   968  	Owner           *User      `json:"owner,omitempty"`
   969  	Private         *bool      `json:"private,omitempty"`
   970  	Description     *string    `json:"description,omitempty"`
   971  	Fork            *bool      `json:"fork,omitempty"`
   972  	CreatedAt       *Timestamp `json:"created_at,omitempty"`
   973  	PushedAt        *Timestamp `json:"pushed_at,omitempty"`
   974  	UpdatedAt       *Timestamp `json:"updated_at,omitempty"`
   975  	Homepage        *string    `json:"homepage,omitempty"`
   976  	PullsURL        *string    `json:"pulls_url,omitempty"`
   977  	Size            *int       `json:"size,omitempty"`
   978  	StargazersCount *int       `json:"stargazers_count,omitempty"`
   979  	WatchersCount   *int       `json:"watchers_count,omitempty"`
   980  	Language        *string    `json:"language,omitempty"`
   981  	HasIssues       *bool      `json:"has_issues,omitempty"`
   982  	HasDownloads    *bool      `json:"has_downloads,omitempty"`
   983  	HasWiki         *bool      `json:"has_wiki,omitempty"`
   984  	HasPages        *bool      `json:"has_pages,omitempty"`
   985  	ForksCount      *int       `json:"forks_count,omitempty"`
   986  	Archived        *bool      `json:"archived,omitempty"`
   987  	Disabled        *bool      `json:"disabled,omitempty"`
   988  	OpenIssuesCount *int       `json:"open_issues_count,omitempty"`
   989  	DefaultBranch   *string    `json:"default_branch,omitempty"`
   990  	MasterBranch    *string    `json:"master_branch,omitempty"`
   991  	Organization    *string    `json:"organization,omitempty"`
   992  	URL             *string    `json:"url,omitempty"`
   993  	ArchiveURL      *string    `json:"archive_url,omitempty"`
   994  	HTMLURL         *string    `json:"html_url,omitempty"`
   995  	StatusesURL     *string    `json:"statuses_url,omitempty"`
   996  	GitURL          *string    `json:"git_url,omitempty"`
   997  	SSHURL          *string    `json:"ssh_url,omitempty"`
   998  	CloneURL        *string    `json:"clone_url,omitempty"`
   999  	SVNURL          *string    `json:"svn_url,omitempty"`
  1000  }
  1001  
  1002  // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
  1003  type PushEventRepoOwner struct {
  1004  	Name  *string `json:"name,omitempty"`
  1005  	Email *string `json:"email,omitempty"`
  1006  }
  1007  
  1008  // ReleaseEvent is triggered when a release is published, unpublished, created,
  1009  // edited, deleted, or prereleased.
  1010  // The Webhook event name is "release".
  1011  //
  1012  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release
  1013  type ReleaseEvent struct {
  1014  	// Action is the action that was performed. Possible values are: "published", "unpublished",
  1015  	// "created", "edited", "deleted", or "prereleased".
  1016  	Action  *string            `json:"action,omitempty"`
  1017  	Release *RepositoryRelease `json:"release,omitempty"`
  1018  
  1019  	// The following fields are only populated by Webhook events.
  1020  	Repo         *Repository   `json:"repository,omitempty"`
  1021  	Sender       *User         `json:"sender,omitempty"`
  1022  	Installation *Installation `json:"installation,omitempty"`
  1023  }
  1024  
  1025  // RepositoryEvent is triggered when a repository is created, archived, unarchived,
  1026  // renamed, edited, transferred, made public, or made private. Organization hooks are
  1027  // also trigerred when a repository is deleted.
  1028  // The Webhook event name is "repository".
  1029  //
  1030  // Events of this type are not visible in timelines, they are only used to
  1031  // trigger organization webhooks.
  1032  //
  1033  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository
  1034  type RepositoryEvent struct {
  1035  	// Action is the action that was performed. Possible values are: "created",
  1036  	// "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed",
  1037  	// "transferred", "publicized", or "privatized".
  1038  	Action *string     `json:"action,omitempty"`
  1039  	Repo   *Repository `json:"repository,omitempty"`
  1040  
  1041  	// The following fields are only populated by Webhook events.
  1042  	Changes      *EditChange   `json:"changes,omitempty"`
  1043  	Org          *Organization `json:"organization,omitempty"`
  1044  	Sender       *User         `json:"sender,omitempty"`
  1045  	Installation *Installation `json:"installation,omitempty"`
  1046  }
  1047  
  1048  // RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint.
  1049  //
  1050  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch
  1051  type RepositoryDispatchEvent struct {
  1052  	// Action is the event_type that submitted with the repository dispatch payload. Value can be any string.
  1053  	Action        *string         `json:"action,omitempty"`
  1054  	Branch        *string         `json:"branch,omitempty"`
  1055  	ClientPayload json.RawMessage `json:"client_payload,omitempty"`
  1056  	Repo          *Repository     `json:"repository,omitempty"`
  1057  
  1058  	// The following fields are only populated by Webhook events.
  1059  	Org          *Organization `json:"organization,omitempty"`
  1060  	Sender       *User         `json:"sender,omitempty"`
  1061  	Installation *Installation `json:"installation,omitempty"`
  1062  }
  1063  
  1064  // RepositoryImportEvent represents the activity related to a repository being imported to GitHub.
  1065  //
  1066  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import
  1067  type RepositoryImportEvent struct {
  1068  	// Status represents the final state of the import. This can be one of "success", "cancelled", or "failure".
  1069  	Status *string       `json:"status,omitempty"`
  1070  	Repo   *Repository   `json:"repository,omitempty"`
  1071  	Org    *Organization `json:"organization,omitempty"`
  1072  	Sender *User         `json:"sender,omitempty"`
  1073  }
  1074  
  1075  // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved.
  1076  //
  1077  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert
  1078  type RepositoryVulnerabilityAlertEvent struct {
  1079  	// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
  1080  	Action *string `json:"action,omitempty"`
  1081  
  1082  	// The security alert of the vulnerable dependency.
  1083  	Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"`
  1084  
  1085  	// The repository of the vulnerable dependency.
  1086  	Repository *Repository `json:"repository,omitempty"`
  1087  
  1088  	// The following fields are only populated by Webhook events.
  1089  	Installation *Installation `json:"installation,omitempty"`
  1090  
  1091  	// The user that triggered the event.
  1092  	Sender *User `json:"sender,omitempty"`
  1093  }
  1094  
  1095  // RepositoryVulnerabilityAlert represents a repository security alert.
  1096  type RepositoryVulnerabilityAlert struct {
  1097  	ID                       *int64     `json:"id,omitempty"`
  1098  	AffectedRange            *string    `json:"affected_range,omitempty"`
  1099  	AffectedPackageName      *string    `json:"affected_package_name,omitempty"`
  1100  	ExternalReference        *string    `json:"external_reference,omitempty"`
  1101  	ExternalIdentifier       *string    `json:"external_identifier,omitempty"`
  1102  	GitHubSecurityAdvisoryID *string    `json:"ghsa_id,omitempty"`
  1103  	Severity                 *string    `json:"severity,omitempty"`
  1104  	CreatedAt                *Timestamp `json:"created_at,omitempty"`
  1105  	FixedIn                  *string    `json:"fixed_in,omitempty"`
  1106  	Dismisser                *User      `json:"dismisser,omitempty"`
  1107  	DismissReason            *string    `json:"dismiss_reason,omitempty"`
  1108  	DismissedAt              *Timestamp `json:"dismissed_at,omitempty"`
  1109  }
  1110  
  1111  // SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository.
  1112  // The Webhook name is secret_scanning_alert.
  1113  //
  1114  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert
  1115  type SecretScanningAlertEvent struct {
  1116  	// Action is the action that was performed. Possible values are: "created", "resolved", or "reopened".
  1117  	Action *string `json:"action,omitempty"`
  1118  
  1119  	// Alert is the secret scanning alert involved in the event.
  1120  	Alert *SecretScanningAlert `json:"alert,omitempty"`
  1121  
  1122  	// Only populated by the "resolved" and "reopen" actions
  1123  	Sender *User `json:"sender,omitempty"`
  1124  	// The following fields are only populated by Webhook events.
  1125  	Repo         *Repository   `json:"repository,omitempty"`
  1126  	Organization *Organization `json:"organization,omitempty"`
  1127  	Enterprise   *Enterprise   `json:"enterprise,omitempty"`
  1128  	Installation *Installation `json:"installation,omitempty"`
  1129  }
  1130  
  1131  // StarEvent is triggered when a star is added or removed from a repository.
  1132  // The Webhook event name is "star".
  1133  //
  1134  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#star
  1135  type StarEvent struct {
  1136  	// Action is the action that was performed. Possible values are: "created" or "deleted".
  1137  	Action *string `json:"action,omitempty"`
  1138  
  1139  	// StarredAt is the time the star was created. It will be null for the "deleted" action.
  1140  	StarredAt *Timestamp `json:"starred_at,omitempty"`
  1141  
  1142  	// The following fields are only populated by Webhook events.
  1143  	Org          *Organization `json:"organization,omitempty"`
  1144  	Repo         *Repository   `json:"repository,omitempty"`
  1145  	Sender       *User         `json:"sender,omitempty"`
  1146  	Installation *Installation `json:"installation,omitempty"`
  1147  }
  1148  
  1149  // StatusEvent is triggered when the status of a Git commit changes.
  1150  // The Webhook event name is "status".
  1151  //
  1152  // Events of this type are not visible in timelines, they are only used to
  1153  // trigger hooks.
  1154  //
  1155  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#status
  1156  type StatusEvent struct {
  1157  	SHA *string `json:"sha,omitempty"`
  1158  	// State is the new state. Possible values are: "pending", "success", "failure", "error".
  1159  	State       *string   `json:"state,omitempty"`
  1160  	Description *string   `json:"description,omitempty"`
  1161  	TargetURL   *string   `json:"target_url,omitempty"`
  1162  	Branches    []*Branch `json:"branches,omitempty"`
  1163  
  1164  	// The following fields are only populated by Webhook events.
  1165  	ID           *int64            `json:"id,omitempty"`
  1166  	Name         *string           `json:"name,omitempty"`
  1167  	Context      *string           `json:"context,omitempty"`
  1168  	Commit       *RepositoryCommit `json:"commit,omitempty"`
  1169  	CreatedAt    *Timestamp        `json:"created_at,omitempty"`
  1170  	UpdatedAt    *Timestamp        `json:"updated_at,omitempty"`
  1171  	Repo         *Repository       `json:"repository,omitempty"`
  1172  	Sender       *User             `json:"sender,omitempty"`
  1173  	Installation *Installation     `json:"installation,omitempty"`
  1174  }
  1175  
  1176  // TeamEvent is triggered when an organization's team is created, modified or deleted.
  1177  // The Webhook event name is "team".
  1178  //
  1179  // Events of this type are not visible in timelines. These events are only used
  1180  // to trigger hooks.
  1181  //
  1182  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team
  1183  type TeamEvent struct {
  1184  	Action  *string     `json:"action,omitempty"`
  1185  	Team    *Team       `json:"team,omitempty"`
  1186  	Changes *TeamChange `json:"changes,omitempty"`
  1187  	Repo    *Repository `json:"repository,omitempty"`
  1188  
  1189  	// The following fields are only populated by Webhook events.
  1190  	Org          *Organization `json:"organization,omitempty"`
  1191  	Sender       *User         `json:"sender,omitempty"`
  1192  	Installation *Installation `json:"installation,omitempty"`
  1193  }
  1194  
  1195  // TeamAddEvent is triggered when a repository is added to a team.
  1196  // The Webhook event name is "team_add".
  1197  //
  1198  // Events of this type are not visible in timelines. These events are only used
  1199  // to trigger hooks.
  1200  //
  1201  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team_add
  1202  type TeamAddEvent struct {
  1203  	Team *Team       `json:"team,omitempty"`
  1204  	Repo *Repository `json:"repository,omitempty"`
  1205  
  1206  	// The following fields are only populated by Webhook events.
  1207  	Org          *Organization `json:"organization,omitempty"`
  1208  	Sender       *User         `json:"sender,omitempty"`
  1209  	Installation *Installation `json:"installation,omitempty"`
  1210  }
  1211  
  1212  // UserEvent is triggered when a user is created or deleted.
  1213  // The Webhook event name is "user".
  1214  //
  1215  // Only global webhooks can subscribe to this event type.
  1216  //
  1217  // GitHub API docs: https://developer.github.com/enterprise/v3/activity/events/types/#userevent-enterprise
  1218  type UserEvent struct {
  1219  	User *User `json:"user,omitempty"`
  1220  	// The action performed. Possible values are: "created" or "deleted".
  1221  	Action     *string     `json:"action,omitempty"`
  1222  	Enterprise *Enterprise `json:"enterprise,omitempty"`
  1223  	Sender     *User       `json:"sender,omitempty"`
  1224  
  1225  	// The following fields are only populated by Webhook events.
  1226  	Installation *Installation `json:"installation,omitempty"`
  1227  }
  1228  
  1229  // WatchEvent is related to starring a repository, not watching. See this API
  1230  // blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/
  1231  //
  1232  // The event’s actor is the user who starred a repository, and the event’s
  1233  // repository is the repository that was starred.
  1234  //
  1235  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch
  1236  type WatchEvent struct {
  1237  	// Action is the action that was performed. Possible value is: "started".
  1238  	Action *string `json:"action,omitempty"`
  1239  
  1240  	// The following fields are only populated by Webhook events.
  1241  	Repo         *Repository   `json:"repository,omitempty"`
  1242  	Sender       *User         `json:"sender,omitempty"`
  1243  	Installation *Installation `json:"installation,omitempty"`
  1244  }
  1245  
  1246  // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or
  1247  // sends a POST request to the create a workflow dispatch event endpoint.
  1248  //
  1249  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch
  1250  type WorkflowDispatchEvent struct {
  1251  	Inputs   json.RawMessage `json:"inputs,omitempty"`
  1252  	Ref      *string         `json:"ref,omitempty"`
  1253  	Workflow *string         `json:"workflow,omitempty"`
  1254  
  1255  	// The following fields are only populated by Webhook events.
  1256  	Repo         *Repository   `json:"repository,omitempty"`
  1257  	Org          *Organization `json:"organization,omitempty"`
  1258  	Sender       *User         `json:"sender,omitempty"`
  1259  	Installation *Installation `json:"installation,omitempty"`
  1260  }
  1261  
  1262  // WorkflowJobEvent is triggered when a job is queued, started or completed.
  1263  //
  1264  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job
  1265  type WorkflowJobEvent struct {
  1266  	WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"`
  1267  
  1268  	Action *string `json:"action,omitempty"`
  1269  
  1270  	// The following fields are only populated by Webhook events.
  1271  
  1272  	// Org is not nil when the webhook is configured for an organization or the event
  1273  	// occurs from activity in a repository owned by an organization.
  1274  	Org          *Organization `json:"organization,omitempty"`
  1275  	Repo         *Repository   `json:"repository,omitempty"`
  1276  	Sender       *User         `json:"sender,omitempty"`
  1277  	Installation *Installation `json:"installation,omitempty"`
  1278  }
  1279  
  1280  // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
  1281  //
  1282  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
  1283  type WorkflowRunEvent struct {
  1284  	Action      *string      `json:"action,omitempty"`
  1285  	Workflow    *Workflow    `json:"workflow,omitempty"`
  1286  	WorkflowRun *WorkflowRun `json:"workflow_run,omitempty"`
  1287  
  1288  	// The following fields are only populated by Webhook events.
  1289  	Org          *Organization `json:"organization,omitempty"`
  1290  	Repo         *Repository   `json:"repository,omitempty"`
  1291  	Sender       *User         `json:"sender,omitempty"`
  1292  	Installation *Installation `json:"installation,omitempty"`
  1293  }
  1294  
  1295  // SecurityAdvisory represents the advisory object in SecurityAdvisoryEvent payload.
  1296  //
  1297  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1298  type SecurityAdvisory struct {
  1299  	GHSAID          *string                  `json:"ghsa_id,omitempty"`
  1300  	Summary         *string                  `json:"summary,omitempty"`
  1301  	Description     *string                  `json:"description,omitempty"`
  1302  	Severity        *string                  `json:"severity,omitempty"`
  1303  	Identifiers     []*AdvisoryIdentifier    `json:"identifiers,omitempty"`
  1304  	References      []*AdvisoryReference     `json:"references,omitempty"`
  1305  	PublishedAt     *Timestamp               `json:"published_at,omitempty"`
  1306  	UpdatedAt       *Timestamp               `json:"updated_at,omitempty"`
  1307  	WithdrawnAt     *Timestamp               `json:"withdrawn_at,omitempty"`
  1308  	Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"`
  1309  }
  1310  
  1311  // AdvisoryIdentifier represents the identifier for a Security Advisory.
  1312  type AdvisoryIdentifier struct {
  1313  	Value *string `json:"value,omitempty"`
  1314  	Type  *string `json:"type,omitempty"`
  1315  }
  1316  
  1317  // AdvisoryReference represents the reference url for the security advisory.
  1318  type AdvisoryReference struct {
  1319  	URL *string `json:"url,omitempty"`
  1320  }
  1321  
  1322  // AdvisoryVulnerability represents the vulnerability object for a Security Advisory.
  1323  type AdvisoryVulnerability struct {
  1324  	Package                *VulnerabilityPackage `json:"package,omitempty"`
  1325  	Severity               *string               `json:"severity,omitempty"`
  1326  	VulnerableVersionRange *string               `json:"vulnerable_version_range,omitempty"`
  1327  	FirstPatchedVersion    *FirstPatchedVersion  `json:"first_patched_version,omitempty"`
  1328  }
  1329  
  1330  // VulnerabilityPackage represents the package object for an Advisory Vulnerability.
  1331  type VulnerabilityPackage struct {
  1332  	Ecosystem *string `json:"ecosystem,omitempty"`
  1333  	Name      *string `json:"name,omitempty"`
  1334  }
  1335  
  1336  // FirstPatchedVersion represents the identifier for the first patched version of that vulnerability.
  1337  type FirstPatchedVersion struct {
  1338  	Identifier *string `json:"identifier,omitempty"`
  1339  }
  1340  
  1341  // SecurityAdvisoryEvent is triggered when a security-related vulnerability is found in software on GitHub.
  1342  //
  1343  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory
  1344  type SecurityAdvisoryEvent struct {
  1345  	Action           *string           `json:"action,omitempty"`
  1346  	SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"`
  1347  }
  1348  
  1349  // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code.
  1350  //
  1351  // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert
  1352  type CodeScanningAlertEvent struct {
  1353  	Action *string `json:"action,omitempty"`
  1354  	Alert  *Alert  `json:"alert,omitempty"`
  1355  	Ref    *string `json:"ref,omitempty"`
  1356  	// CommitOID is the commit SHA of the code scanning alert
  1357  	CommitOID *string       `json:"commit_oid,omitempty"`
  1358  	Repo      *Repository   `json:"repository,omitempty"`
  1359  	Org       *Organization `json:"organization,omitempty"`
  1360  	Sender    *User         `json:"sender,omitempty"`
  1361  }
  1362  

View as plain text