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 8package github 9 10// RequestedAction is included in a CheckRunEvent when a user has invoked an action, 11// i.e. when the CheckRunEvent's Action field is "requested_action". 12type RequestedAction struct { 13 Identifier string `json:"identifier"` // The integrator reference of the action requested by the user. 14} 15 16// CheckRunEvent is triggered when a check run is "created", "updated", or "rerequested". 17// The Webhook event name is "check_run". 18// 19// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checkrunevent 20type CheckRunEvent struct { 21 CheckRun *CheckRun `json:"check_run,omitempty"` 22 // The action performed. Possible values are: "created", "updated", "rerequested" or "requested_action". 23 Action *string `json:"action,omitempty"` 24 25 // The following fields are only populated by Webhook events. 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 // The action requested by the user. Populated when the Action is "requested_action". 32 RequestedAction *RequestedAction `json:"requested_action,omitempty"` // 33} 34 35// CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested". 36// The Webhook event name is "check_suite". 37// 38// GitHub API docs: https://developer.github.com/v3/activity/events/types/#checksuiteevent 39type CheckSuiteEvent struct { 40 CheckSuite *CheckSuite `json:"check_suite,omitempty"` 41 // The action performed. Possible values are: "completed", "requested" or "rerequested". 42 Action *string `json:"action,omitempty"` 43 44 // The following fields are only populated by Webhook events. 45 Repo *Repository `json:"repository,omitempty"` 46 Org *Organization `json:"organization,omitempty"` 47 Sender *User `json:"sender,omitempty"` 48 Installation *Installation `json:"installation,omitempty"` 49} 50 51// CommitCommentEvent is triggered when a commit comment is created. 52// The Webhook event name is "commit_comment". 53// 54// GitHub API docs: https://developer.github.com/v3/activity/events/types/#commitcommentevent 55type CommitCommentEvent struct { 56 Comment *RepositoryComment `json:"comment,omitempty"` 57 58 // The following fields are only populated by Webhook events. 59 Action *string `json:"action,omitempty"` 60 Repo *Repository `json:"repository,omitempty"` 61 Sender *User `json:"sender,omitempty"` 62 Installation *Installation `json:"installation,omitempty"` 63} 64 65// CreateEvent represents a created repository, branch, or tag. 66// The Webhook event name is "create". 67// 68// Note: webhooks will not receive this event for created repositories. 69// Additionally, webhooks will not receive this event for tags if more 70// than three tags are pushed at once. 71// 72// GitHub API docs: https://developer.github.com/v3/activity/events/types/#createevent 73type CreateEvent struct { 74 Ref *string `json:"ref,omitempty"` 75 // RefType is the object that was created. Possible values are: "repository", "branch", "tag". 76 RefType *string `json:"ref_type,omitempty"` 77 MasterBranch *string `json:"master_branch,omitempty"` 78 Description *string `json:"description,omitempty"` 79 80 // The following fields are only populated by Webhook events. 81 PusherType *string `json:"pusher_type,omitempty"` 82 Repo *Repository `json:"repository,omitempty"` 83 Sender *User `json:"sender,omitempty"` 84 Installation *Installation `json:"installation,omitempty"` 85} 86 87// DeleteEvent represents a deleted branch or tag. 88// The Webhook event name is "delete". 89// 90// Note: webhooks will not receive this event for tags if more than three tags 91// are deleted at once. 92// 93// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deleteevent 94type DeleteEvent struct { 95 Ref *string `json:"ref,omitempty"` 96 // RefType is the object that was deleted. Possible values are: "branch", "tag". 97 RefType *string `json:"ref_type,omitempty"` 98 99 // The following fields are only populated by Webhook events. 100 PusherType *string `json:"pusher_type,omitempty"` 101 Repo *Repository `json:"repository,omitempty"` 102 Sender *User `json:"sender,omitempty"` 103 Installation *Installation `json:"installation,omitempty"` 104} 105 106// DeployKeyEvent is triggered when a deploy key is added or removed from a repository. 107// The Webhook event name is "deploy_key". 108// 109// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploykeyevent 110type DeployKeyEvent struct { 111 // Action is the action that was performed. Possible values are: 112 // "created" or "deleted". 113 Action *string `json:"action,omitempty"` 114 115 // The deploy key resource. 116 Key *Key `json:"key,omitempty"` 117} 118 119// DeploymentEvent represents a deployment. 120// The Webhook event name is "deployment". 121// 122// Events of this type are not visible in timelines, they are only used to trigger hooks. 123// 124// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentevent 125type DeploymentEvent struct { 126 Deployment *Deployment `json:"deployment,omitempty"` 127 Repo *Repository `json:"repository,omitempty"` 128 129 // The following fields are only populated by Webhook events. 130 Sender *User `json:"sender,omitempty"` 131 Installation *Installation `json:"installation,omitempty"` 132} 133 134// DeploymentStatusEvent represents a deployment status. 135// The Webhook event name is "deployment_status". 136// 137// Events of this type are not visible in timelines, they are only used to trigger hooks. 138// 139// GitHub API docs: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent 140type DeploymentStatusEvent struct { 141 Deployment *Deployment `json:"deployment,omitempty"` 142 DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"` 143 Repo *Repository `json:"repository,omitempty"` 144 145 // The following fields are only populated by Webhook events. 146 Sender *User `json:"sender,omitempty"` 147 Installation *Installation `json:"installation,omitempty"` 148} 149 150// ForkEvent is triggered when a user forks a repository. 151// The Webhook event name is "fork". 152// 153// GitHub API docs: https://developer.github.com/v3/activity/events/types/#forkevent 154type ForkEvent struct { 155 // Forkee is the created repository. 156 Forkee *Repository `json:"forkee,omitempty"` 157 158 // The following fields are only populated by Webhook events. 159 Repo *Repository `json:"repository,omitempty"` 160 Sender *User `json:"sender,omitempty"` 161 Installation *Installation `json:"installation,omitempty"` 162} 163 164// GitHubAppAuthorizationEvent is triggered when a user's authorization for a 165// GitHub Application is revoked. 166// 167// GitHub API docs: https://developer.github.com/v3/activity/events/types/#githubappauthorizationevent 168type GitHubAppAuthorizationEvent struct { 169 // The action performed. Possible value is: "revoked". 170 Action *string `json:"action,omitempty"` 171 172 // The following fields are only populated by Webhook events. 173 Sender *User `json:"sender,omitempty"` 174} 175 176// Page represents a single Wiki page. 177type Page struct { 178 PageName *string `json:"page_name,omitempty"` 179 Title *string `json:"title,omitempty"` 180 Summary *string `json:"summary,omitempty"` 181 Action *string `json:"action,omitempty"` 182 SHA *string `json:"sha,omitempty"` 183 HTMLURL *string `json:"html_url,omitempty"` 184} 185 186// GollumEvent is triggered when a Wiki page is created or updated. 187// The Webhook event name is "gollum". 188// 189// GitHub API docs: https://developer.github.com/v3/activity/events/types/#gollumevent 190type GollumEvent struct { 191 Pages []*Page `json:"pages,omitempty"` 192 193 // The following fields are only populated by Webhook events. 194 Repo *Repository `json:"repository,omitempty"` 195 Sender *User `json:"sender,omitempty"` 196 Installation *Installation `json:"installation,omitempty"` 197} 198 199// EditChange represents the changes when an issue, pull request, or comment has 200// been edited. 201type EditChange struct { 202 Title *struct { 203 From *string `json:"from,omitempty"` 204 } `json:"title,omitempty"` 205 Body *struct { 206 From *string `json:"from,omitempty"` 207 } `json:"body,omitempty"` 208} 209 210// ProjectChange represents the changes when a project has been edited. 211type ProjectChange struct { 212 Name *struct { 213 From *string `json:"from,omitempty"` 214 } `json:"name,omitempty"` 215 Body *struct { 216 From *string `json:"from,omitempty"` 217 } `json:"body,omitempty"` 218} 219 220// ProjectCardChange represents the changes when a project card has been edited. 221type ProjectCardChange struct { 222 Note *struct { 223 From *string `json:"from,omitempty"` 224 } `json:"note,omitempty"` 225} 226 227// ProjectColumnChange represents the changes when a project column has been edited. 228type ProjectColumnChange struct { 229 Name *struct { 230 From *string `json:"from,omitempty"` 231 } `json:"name,omitempty"` 232} 233 234// TeamChange represents the changes when a team has been edited. 235type TeamChange struct { 236 Description *struct { 237 From *string `json:"from,omitempty"` 238 } `json:"description,omitempty"` 239 Name *struct { 240 From *string `json:"from,omitempty"` 241 } `json:"name,omitempty"` 242 Privacy *struct { 243 From *string `json:"from,omitempty"` 244 } `json:"privacy,omitempty"` 245 Repository *struct { 246 Permissions *struct { 247 From *struct { 248 Admin *bool `json:"admin,omitempty"` 249 Pull *bool `json:"pull,omitempty"` 250 Push *bool `json:"push,omitempty"` 251 } `json:"from,omitempty"` 252 } `json:"permissions,omitempty"` 253 } `json:"repository,omitempty"` 254} 255 256// InstallationEvent is triggered when a GitHub App has been installed or uninstalled. 257// The Webhook event name is "installation". 258// 259// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent 260type InstallationEvent struct { 261 // The action that was performed. Can be either "created" or "deleted". 262 Action *string `json:"action,omitempty"` 263 Repositories []*Repository `json:"repositories,omitempty"` 264 Sender *User `json:"sender,omitempty"` 265 Installation *Installation `json:"installation,omitempty"` 266} 267 268// InstallationRepositoriesEvent is triggered when a repository is added or 269// removed from an installation. The Webhook event name is "installation_repositories". 270// 271// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent 272type InstallationRepositoriesEvent struct { 273 // The action that was performed. Can be either "added" or "removed". 274 Action *string `json:"action,omitempty"` 275 RepositoriesAdded []*Repository `json:"repositories_added,omitempty"` 276 RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"` 277 RepositorySelection *string `json:"repository_selection,omitempty"` 278 Sender *User `json:"sender,omitempty"` 279 Installation *Installation `json:"installation,omitempty"` 280} 281 282// IssueCommentEvent is triggered when an issue comment is created on an issue 283// or pull request. 284// The Webhook event name is "issue_comment". 285// 286// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuecommentevent 287type IssueCommentEvent struct { 288 // Action is the action that was performed on the comment. 289 // Possible values are: "created", "edited", "deleted". 290 Action *string `json:"action,omitempty"` 291 Issue *Issue `json:"issue,omitempty"` 292 Comment *IssueComment `json:"comment,omitempty"` 293 294 // The following fields are only populated by Webhook events. 295 Changes *EditChange `json:"changes,omitempty"` 296 Repo *Repository `json:"repository,omitempty"` 297 Sender *User `json:"sender,omitempty"` 298 Installation *Installation `json:"installation,omitempty"` 299} 300 301// IssuesEvent is triggered when an issue is opened, edited, deleted, transferred, 302// pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, 303// locked, unlocked, milestoned, or demilestoned. 304// The Webhook event name is "issues". 305// 306// GitHub API docs: https://developer.github.com/v3/activity/events/types/#issuesevent 307type IssuesEvent struct { 308 // Action is the action that was performed. Possible values are: "opened", 309 // "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", 310 // "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked", 311 // "milestoned", or "demilestoned". 312 Action *string `json:"action,omitempty"` 313 Issue *Issue `json:"issue,omitempty"` 314 Assignee *User `json:"assignee,omitempty"` 315 Label *Label `json:"label,omitempty"` 316 317 // The following fields are only populated by Webhook events. 318 Changes *EditChange `json:"changes,omitempty"` 319 Repo *Repository `json:"repository,omitempty"` 320 Sender *User `json:"sender,omitempty"` 321 Installation *Installation `json:"installation,omitempty"` 322} 323 324// LabelEvent is triggered when a repository's label is created, edited, or deleted. 325// The Webhook event name is "label" 326// 327// GitHub API docs: https://developer.github.com/v3/activity/events/types/#labelevent 328type LabelEvent struct { 329 // Action is the action that was performed. Possible values are: 330 // "created", "edited", "deleted" 331 Action *string `json:"action,omitempty"` 332 Label *Label `json:"label,omitempty"` 333 334 // The following fields are only populated by Webhook events. 335 Changes *EditChange `json:"changes,omitempty"` 336 Repo *Repository `json:"repository,omitempty"` 337 Org *Organization `json:"organization,omitempty"` 338 Installation *Installation `json:"installation,omitempty"` 339} 340 341// MarketplacePurchaseEvent is triggered when a user purchases, cancels, or changes 342// their GitHub Marketplace plan. 343// Webhook event name "marketplace_purchase". 344// 345// Github API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent 346type MarketplacePurchaseEvent struct { 347 // Action is the action that was performed. Possible values are: 348 // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". 349 Action *string `json:"action,omitempty"` 350 351 // The following fields are only populated by Webhook events. 352 EffectiveDate *Timestamp `json:"effective_date,omitempty"` 353 MarketplacePurchase *MarketplacePurchase `json:"marketplace_purchase,omitempty"` 354 PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"` 355 Sender *User `json:"sender,omitempty"` 356 Installation *Installation `json:"installation,omitempty"` 357} 358 359// MemberEvent is triggered when a user is added as a collaborator to a repository. 360// The Webhook event name is "member". 361// 362// GitHub API docs: https://developer.github.com/v3/activity/events/types/#memberevent 363type MemberEvent struct { 364 // Action is the action that was performed. Possible value is: "added". 365 Action *string `json:"action,omitempty"` 366 Member *User `json:"member,omitempty"` 367 368 // The following fields are only populated by Webhook events. 369 Repo *Repository `json:"repository,omitempty"` 370 Sender *User `json:"sender,omitempty"` 371 Installation *Installation `json:"installation,omitempty"` 372} 373 374// MembershipEvent is triggered when a user is added or removed from a team. 375// The Webhook event name is "membership". 376// 377// Events of this type are not visible in timelines, they are only used to 378// trigger organization webhooks. 379// 380// GitHub API docs: https://developer.github.com/v3/activity/events/types/#membershipevent 381type MembershipEvent struct { 382 // Action is the action that was performed. Possible values are: "added", "removed". 383 Action *string `json:"action,omitempty"` 384 // Scope is the scope of the membership. Possible value is: "team". 385 Scope *string `json:"scope,omitempty"` 386 Member *User `json:"member,omitempty"` 387 Team *Team `json:"team,omitempty"` 388 389 // The following fields are only populated by Webhook events. 390 Org *Organization `json:"organization,omitempty"` 391 Sender *User `json:"sender,omitempty"` 392 Installation *Installation `json:"installation,omitempty"` 393} 394 395// MetaEvent is triggered when the webhook that this event is configured on is deleted. 396// This event will only listen for changes to the particular hook the event is installed on. 397// Therefore, it must be selected for each hook that you'd like to receive meta events for. 398// The Webhook event name is "meta". 399// 400// GitHub API docs: https://developer.github.com/v3/activity/events/types/#metaevent 401type MetaEvent struct { 402 // Action is the action that was performed. Possible value is: "deleted". 403 Action *string `json:"action,omitempty"` 404 // The ID of the modified webhook. 405 HookID *int64 `json:"hook_id,omitempty"` 406 // The modified webhook. 407 // This will contain different keys based on the type of webhook it is: repository, 408 // organization, business, app, or GitHub Marketplace. 409 Hook *Hook `json:"hook,omitempty"` 410} 411 412// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. 413// The Webhook event name is "milestone". 414// 415// GitHub API docs: https://developer.github.com/v3/activity/events/types/#milestoneevent 416type MilestoneEvent struct { 417 // Action is the action that was performed. Possible values are: 418 // "created", "closed", "opened", "edited", "deleted" 419 Action *string `json:"action,omitempty"` 420 Milestone *Milestone `json:"milestone,omitempty"` 421 422 // The following fields are only populated by Webhook events. 423 Changes *EditChange `json:"changes,omitempty"` 424 Repo *Repository `json:"repository,omitempty"` 425 Sender *User `json:"sender,omitempty"` 426 Org *Organization `json:"organization,omitempty"` 427 Installation *Installation `json:"installation,omitempty"` 428} 429 430// OrganizationEvent is triggered when an organization is deleted and renamed, and when a user is added, 431// removed, or invited to an organization. 432// Events of this type are not visible in timelines. These events are only used to trigger organization hooks. 433// Webhook event name is "organization". 434// 435// GitHub API docs: https://developer.github.com/v3/activity/events/types/#organizationevent 436type OrganizationEvent struct { 437 // Action is the action that was performed. 438 // Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited". 439 Action *string `json:"action,omitempty"` 440 441 // Invitation is the invitation for the user or email if the action is "member_invited". 442 Invitation *Invitation `json:"invitation,omitempty"` 443 444 // Membership is the membership between the user and the organization. 445 // Not present when the action is "member_invited". 446 Membership *Membership `json:"membership,omitempty"` 447 448 Organization *Organization `json:"organization,omitempty"` 449 Sender *User `json:"sender,omitempty"` 450 Installation *Installation `json:"installation,omitempty"` 451} 452 453// OrgBlockEvent is triggered when an organization blocks or unblocks a user. 454// The Webhook event name is "org_block". 455// 456// GitHub API docs: https://developer.github.com/v3/activity/events/types/#orgblockevent 457type OrgBlockEvent struct { 458 // Action is the action that was performed. 459 // Can be "blocked" or "unblocked". 460 Action *string `json:"action,omitempty"` 461 BlockedUser *User `json:"blocked_user,omitempty"` 462 Organization *Organization `json:"organization,omitempty"` 463 Sender *User `json:"sender,omitempty"` 464 465 // The following fields are only populated by Webhook events. 466 Installation *Installation `json:"installation,omitempty"` 467} 468 469// PageBuildEvent represents an attempted build of a GitHub Pages site, whether 470// successful or not. 471// The Webhook event name is "page_build". 472// 473// This event is triggered on push to a GitHub Pages enabled branch (gh-pages 474// for project pages, master for user and organization pages). 475// 476// Events of this type are not visible in timelines, they are only used to trigger hooks. 477// 478// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pagebuildevent 479type PageBuildEvent struct { 480 Build *PagesBuild `json:"build,omitempty"` 481 482 // The following fields are only populated by Webhook events. 483 ID *int64 `json:"id,omitempty"` 484 Repo *Repository `json:"repository,omitempty"` 485 Sender *User `json:"sender,omitempty"` 486 Installation *Installation `json:"installation,omitempty"` 487} 488 489// PingEvent is triggered when a Webhook is added to GitHub. 490// 491// GitHub API docs: https://developer.github.com/webhooks/#ping-event 492type PingEvent struct { 493 // Random string of GitHub zen. 494 Zen *string `json:"zen,omitempty"` 495 // The ID of the webhook that triggered the ping. 496 HookID *int64 `json:"hook_id,omitempty"` 497 // The webhook configuration. 498 Hook *Hook `json:"hook,omitempty"` 499 Installation *Installation `json:"installation,omitempty"` 500} 501 502// ProjectEvent is triggered when project is created, modified or deleted. 503// The webhook event name is "project". 504// 505// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectevent 506type ProjectEvent struct { 507 Action *string `json:"action,omitempty"` 508 Changes *ProjectChange `json:"changes,omitempty"` 509 Project *Project `json:"project,omitempty"` 510 511 // The following fields are only populated by Webhook events. 512 Repo *Repository `json:"repository,omitempty"` 513 Org *Organization `json:"organization,omitempty"` 514 Sender *User `json:"sender,omitempty"` 515 Installation *Installation `json:"installation,omitempty"` 516} 517 518// ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. 519// The webhook event name is "project_card". 520// 521// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcardevent 522type ProjectCardEvent struct { 523 Action *string `json:"action,omitempty"` 524 Changes *ProjectCardChange `json:"changes,omitempty"` 525 AfterID *int64 `json:"after_id,omitempty"` 526 ProjectCard *ProjectCard `json:"project_card,omitempty"` 527 528 // The following fields are only populated by Webhook events. 529 Repo *Repository `json:"repository,omitempty"` 530 Org *Organization `json:"organization,omitempty"` 531 Sender *User `json:"sender,omitempty"` 532 Installation *Installation `json:"installation,omitempty"` 533} 534 535// ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. 536// The webhook event name is "project_column". 537// 538// GitHub API docs: https://developer.github.com/v3/activity/events/types/#projectcolumnevent 539type ProjectColumnEvent struct { 540 Action *string `json:"action,omitempty"` 541 Changes *ProjectColumnChange `json:"changes,omitempty"` 542 AfterID *int64 `json:"after_id,omitempty"` 543 ProjectColumn *ProjectColumn `json:"project_column,omitempty"` 544 545 // The following fields are only populated by Webhook events. 546 Repo *Repository `json:"repository,omitempty"` 547 Org *Organization `json:"organization,omitempty"` 548 Sender *User `json:"sender,omitempty"` 549 Installation *Installation `json:"installation,omitempty"` 550} 551 552// PublicEvent is triggered when a private repository is open sourced. 553// According to GitHub: "Without a doubt: the best GitHub event." 554// The Webhook event name is "public". 555// 556// GitHub API docs: https://developer.github.com/v3/activity/events/types/#publicevent 557type PublicEvent struct { 558 // The following fields are only populated by Webhook events. 559 Repo *Repository `json:"repository,omitempty"` 560 Sender *User `json:"sender,omitempty"` 561 Installation *Installation `json:"installation,omitempty"` 562} 563 564// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled, 565// unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, 566// locked, unlocked, a pull request review is requested, or a review request is removed. 567// The Webhook event name is "pull_request". 568// 569// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestevent 570type PullRequestEvent struct { 571 // Action is the action that was performed. Possible values are: 572 // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled", 573 // "opened", "edited", "closed", "ready_for_review", "locked", "unlocked", or "reopened". 574 // If the action is "closed" and the "merged" key is "false", the pull request was closed with unmerged commits. 575 // If the action is "closed" and the "merged" key is "true", the pull request was merged. 576 // While webhooks are also triggered when a pull request is synchronized, Events API timelines 577 // don't include pull request events with the "synchronize" action. 578 Action *string `json:"action,omitempty"` 579 Assignee *User `json:"assignee,omitempty"` 580 Number *int `json:"number,omitempty"` 581 PullRequest *PullRequest `json:"pull_request,omitempty"` 582 583 // The following fields are only populated by Webhook events. 584 Changes *EditChange `json:"changes,omitempty"` 585 // RequestedReviewer is populated in "review_requested", "review_request_removed" event deliveries. 586 // A request affecting multiple reviewers at once is split into multiple 587 // such event deliveries, each with a single, different RequestedReviewer. 588 RequestedReviewer *User `json:"requested_reviewer,omitempty"` 589 // In the event that a team is requested instead of a user, "requested_team" gets sent in place of 590 // "requested_user" with the same delivery behavior. 591 RequestedTeam *Team `json:"requested_team,omitempty"` 592 Repo *Repository `json:"repository,omitempty"` 593 Sender *User `json:"sender,omitempty"` 594 Installation *Installation `json:"installation,omitempty"` 595 Label *Label `json:"label,omitempty"` // Populated in "labeled" event deliveries. 596 597 // The following field is only present when the webhook is triggered on 598 // a repository belonging to an organization. 599 Organization *Organization `json:"organization,omitempty"` 600} 601 602// PullRequestReviewEvent is triggered when a review is submitted on a pull 603// request. 604// The Webhook event name is "pull_request_review". 605// 606// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewevent 607type PullRequestReviewEvent struct { 608 // Action is always "submitted". 609 Action *string `json:"action,omitempty"` 610 Review *PullRequestReview `json:"review,omitempty"` 611 PullRequest *PullRequest `json:"pull_request,omitempty"` 612 613 // The following fields are only populated by Webhook events. 614 Repo *Repository `json:"repository,omitempty"` 615 Sender *User `json:"sender,omitempty"` 616 Installation *Installation `json:"installation,omitempty"` 617 618 // The following field is only present when the webhook is triggered on 619 // a repository belonging to an organization. 620 Organization *Organization `json:"organization,omitempty"` 621} 622 623// PullRequestReviewCommentEvent is triggered when a comment is created on a 624// portion of the unified diff of a pull request. 625// The Webhook event name is "pull_request_review_comment". 626// 627// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent 628type PullRequestReviewCommentEvent struct { 629 // Action is the action that was performed on the comment. 630 // Possible values are: "created", "edited", "deleted". 631 Action *string `json:"action,omitempty"` 632 PullRequest *PullRequest `json:"pull_request,omitempty"` 633 Comment *PullRequestComment `json:"comment,omitempty"` 634 635 // The following fields are only populated by Webhook events. 636 Changes *EditChange `json:"changes,omitempty"` 637 Repo *Repository `json:"repository,omitempty"` 638 Sender *User `json:"sender,omitempty"` 639 Installation *Installation `json:"installation,omitempty"` 640} 641 642// PushEvent represents a git push to a GitHub repository. 643// 644// GitHub API docs: https://developer.github.com/v3/activity/events/types/#pushevent 645type PushEvent struct { 646 PushID *int64 `json:"push_id,omitempty"` 647 Head *string `json:"head,omitempty"` 648 Ref *string `json:"ref,omitempty"` 649 Size *int `json:"size,omitempty"` 650 Commits []PushEventCommit `json:"commits,omitempty"` 651 Before *string `json:"before,omitempty"` 652 DistinctSize *int `json:"distinct_size,omitempty"` 653 654 // The following fields are only populated by Webhook events. 655 After *string `json:"after,omitempty"` 656 Created *bool `json:"created,omitempty"` 657 Deleted *bool `json:"deleted,omitempty"` 658 Forced *bool `json:"forced,omitempty"` 659 BaseRef *string `json:"base_ref,omitempty"` 660 Compare *string `json:"compare,omitempty"` 661 Repo *PushEventRepository `json:"repository,omitempty"` 662 HeadCommit *PushEventCommit `json:"head_commit,omitempty"` 663 Pusher *User `json:"pusher,omitempty"` 664 Sender *User `json:"sender,omitempty"` 665 Installation *Installation `json:"installation,omitempty"` 666} 667 668func (p PushEvent) String() string { 669 return Stringify(p) 670} 671 672// PushEventCommit represents a git commit in a GitHub PushEvent. 673type PushEventCommit struct { 674 Message *string `json:"message,omitempty"` 675 Author *CommitAuthor `json:"author,omitempty"` 676 URL *string `json:"url,omitempty"` 677 Distinct *bool `json:"distinct,omitempty"` 678 679 // The following fields are only populated by Events API. 680 SHA *string `json:"sha,omitempty"` 681 682 // The following fields are only populated by Webhook events. 683 ID *string `json:"id,omitempty"` 684 TreeID *string `json:"tree_id,omitempty"` 685 Timestamp *Timestamp `json:"timestamp,omitempty"` 686 Committer *CommitAuthor `json:"committer,omitempty"` 687 Added []string `json:"added,omitempty"` 688 Removed []string `json:"removed,omitempty"` 689 Modified []string `json:"modified,omitempty"` 690} 691 692func (p PushEventCommit) String() string { 693 return Stringify(p) 694} 695 696// PushEventRepository represents the repo object in a PushEvent payload. 697type PushEventRepository struct { 698 ID *int64 `json:"id,omitempty"` 699 NodeID *string `json:"node_id,omitempty"` 700 Name *string `json:"name,omitempty"` 701 FullName *string `json:"full_name,omitempty"` 702 Owner *User `json:"owner,omitempty"` 703 Private *bool `json:"private,omitempty"` 704 Description *string `json:"description,omitempty"` 705 Fork *bool `json:"fork,omitempty"` 706 CreatedAt *Timestamp `json:"created_at,omitempty"` 707 PushedAt *Timestamp `json:"pushed_at,omitempty"` 708 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 709 Homepage *string `json:"homepage,omitempty"` 710 PullsURL *string `json:"pulls_url,omitempty"` 711 Size *int `json:"size,omitempty"` 712 StargazersCount *int `json:"stargazers_count,omitempty"` 713 WatchersCount *int `json:"watchers_count,omitempty"` 714 Language *string `json:"language,omitempty"` 715 HasIssues *bool `json:"has_issues,omitempty"` 716 HasDownloads *bool `json:"has_downloads,omitempty"` 717 HasWiki *bool `json:"has_wiki,omitempty"` 718 HasPages *bool `json:"has_pages,omitempty"` 719 ForksCount *int `json:"forks_count,omitempty"` 720 OpenIssuesCount *int `json:"open_issues_count,omitempty"` 721 DefaultBranch *string `json:"default_branch,omitempty"` 722 MasterBranch *string `json:"master_branch,omitempty"` 723 Organization *string `json:"organization,omitempty"` 724 URL *string `json:"url,omitempty"` 725 ArchiveURL *string `json:"archive_url,omitempty"` 726 HTMLURL *string `json:"html_url,omitempty"` 727 StatusesURL *string `json:"statuses_url,omitempty"` 728 GitURL *string `json:"git_url,omitempty"` 729 SSHURL *string `json:"ssh_url,omitempty"` 730 CloneURL *string `json:"clone_url,omitempty"` 731 SVNURL *string `json:"svn_url,omitempty"` 732} 733 734// PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. 735type PushEventRepoOwner struct { 736 Name *string `json:"name,omitempty"` 737 Email *string `json:"email,omitempty"` 738} 739 740// ReleaseEvent is triggered when a release is published, unpublished, created, 741// edited, deleted, or prerelased. 742// The Webhook event name is "release". 743// 744// GitHub API docs: https://developer.github.com/v3/activity/events/types/#releaseevent 745type ReleaseEvent struct { 746 // Action is the action that was performed. Possible values are: "published", "unpublished", 747 // "created", "edited", "deleted", or "prereleased". 748 Action *string `json:"action,omitempty"` 749 Release *RepositoryRelease `json:"release,omitempty"` 750 751 // The following fields are only populated by Webhook events. 752 Repo *Repository `json:"repository,omitempty"` 753 Sender *User `json:"sender,omitempty"` 754 Installation *Installation `json:"installation,omitempty"` 755} 756 757// RepositoryEvent is triggered when a repository is created, archived, unarchived, 758// renamed, edited, transferred, made public, or made private. Organization hooks are 759// also trigerred when a repository is deleted. 760// The Webhook event name is "repository". 761// 762// Events of this type are not visible in timelines, they are only used to 763// trigger organization webhooks. 764// 765// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryevent 766type RepositoryEvent struct { 767 // Action is the action that was performed. Possible values are: "created", 768 // "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed", 769 // "transferred", "publicized", or "privatized". 770 Action *string `json:"action,omitempty"` 771 Repo *Repository `json:"repository,omitempty"` 772 773 // The following fields are only populated by Webhook events. 774 Org *Organization `json:"organization,omitempty"` 775 Sender *User `json:"sender,omitempty"` 776 Installation *Installation `json:"installation,omitempty"` 777} 778 779// RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. 780// 781// GitHub API docs: https://developer.github.com/v3/activity/events/types/#repositoryvulnerabilityalertevent 782type RepositoryVulnerabilityAlertEvent struct { 783 // Action is the action that was performed. Possible values are: "create", "dismiss", "resolve". 784 Action *string `json:"action,omitempty"` 785 786 //The security alert of the vulnerable dependency. 787 Alert *struct { 788 ID *int64 `json:"id,omitempty"` 789 AffectedRange *string `json:"affected_range,omitempty"` 790 AffectedPackageName *string `json:"affected_package_name,omitempty"` 791 ExternalReference *string `json:"external_reference,omitempty"` 792 ExternalIdentifier *string `json:"external_identifier,omitempty"` 793 FixedIn *string `json:"fixed_in,omitempty"` 794 Dismisser *User `json:"dismisser,omitempty"` 795 DismissReason *string `json:"dismiss_reason,omitempty"` 796 DismissedAt *Timestamp `json:"dismissed_at,omitempty"` 797 } `json:"alert,omitempty"` 798} 799 800// StarEvent is triggered when a star is added or removed from a repository. 801// The Webhook event name is "star". 802// 803// GitHub API docs: https://developer.github.com/v3/activity/events/types/#starevent 804type StarEvent struct { 805 // Action is the action that was performed. Possible values are: "created" or "deleted". 806 Action *string `json:"action,omitempty"` 807 808 // StarredAt is the time the star was created. It will be null for the "deleted" action. 809 StarredAt *Timestamp `json:"starred_at,omitempty"` 810} 811 812// StatusEvent is triggered when the status of a Git commit changes. 813// The Webhook event name is "status". 814// 815// Events of this type are not visible in timelines, they are only used to 816// trigger hooks. 817// 818// GitHub API docs: https://developer.github.com/v3/activity/events/types/#statusevent 819type StatusEvent struct { 820 SHA *string `json:"sha,omitempty"` 821 // State is the new state. Possible values are: "pending", "success", "failure", "error". 822 State *string `json:"state,omitempty"` 823 Description *string `json:"description,omitempty"` 824 TargetURL *string `json:"target_url,omitempty"` 825 Branches []*Branch `json:"branches,omitempty"` 826 827 // The following fields are only populated by Webhook events. 828 ID *int64 `json:"id,omitempty"` 829 Name *string `json:"name,omitempty"` 830 Context *string `json:"context,omitempty"` 831 Commit *RepositoryCommit `json:"commit,omitempty"` 832 CreatedAt *Timestamp `json:"created_at,omitempty"` 833 UpdatedAt *Timestamp `json:"updated_at,omitempty"` 834 Repo *Repository `json:"repository,omitempty"` 835 Sender *User `json:"sender,omitempty"` 836 Installation *Installation `json:"installation,omitempty"` 837} 838 839// TeamEvent is triggered when an organization's team is created, modified or deleted. 840// The Webhook event name is "team". 841// 842// Events of this type are not visible in timelines. These events are only used 843// to trigger hooks. 844// 845// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamevent 846type TeamEvent struct { 847 Action *string `json:"action,omitempty"` 848 Team *Team `json:"team,omitempty"` 849 Changes *TeamChange `json:"changes,omitempty"` 850 Repo *Repository `json:"repository,omitempty"` 851 852 // The following fields are only populated by Webhook events. 853 Org *Organization `json:"organization,omitempty"` 854 Sender *User `json:"sender,omitempty"` 855 Installation *Installation `json:"installation,omitempty"` 856} 857 858// TeamAddEvent is triggered when a repository is added to a team. 859// The Webhook event name is "team_add". 860// 861// Events of this type are not visible in timelines. These events are only used 862// to trigger hooks. 863// 864// GitHub API docs: https://developer.github.com/v3/activity/events/types/#teamaddevent 865type TeamAddEvent struct { 866 Team *Team `json:"team,omitempty"` 867 Repo *Repository `json:"repository,omitempty"` 868 869 // The following fields are only populated by Webhook events. 870 Org *Organization `json:"organization,omitempty"` 871 Sender *User `json:"sender,omitempty"` 872 Installation *Installation `json:"installation,omitempty"` 873} 874 875// WatchEvent is related to starring a repository, not watching. See this API 876// blog post for an explanation: https://developer.github.com/changes/2012-09-05-watcher-api/ 877// 878// The event’s actor is the user who starred a repository, and the event’s 879// repository is the repository that was starred. 880// 881// GitHub API docs: https://developer.github.com/v3/activity/events/types/#watchevent 882type WatchEvent struct { 883 // Action is the action that was performed. Possible value is: "started". 884 Action *string `json:"action,omitempty"` 885 886 // The following fields are only populated by Webhook events. 887 Repo *Repository `json:"repository,omitempty"` 888 Sender *User `json:"sender,omitempty"` 889 Installation *Installation `json:"installation,omitempty"` 890} 891