event_types.go 32 KB

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