You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

event_types.go 36KB

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