github.com/google/go-github/v42@v42.0.0/github/event_types.go (about)

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