10BC0 add events api docs, start on event type docs · bguthrie/developer.github.com@39b8fce · GitHub
[go: up one dir, main page]

Skip to content

Commit 39b8fce

Browse files
committed
add events api docs, start on event type docs
1 parent a5cf0e1 commit 39b8fce

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

content/v3/events.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Events | GitHub API
3+
---
4+
5+
# Events
6+
7+
This is a read-only API to the GitHub events. These events power the
8+
various activity streams on the site.
9+
10+
All Events have the same response format:
11+
12+
<%= headers 200, :pagination => true %>
13+
<%= json(:event) { |h| [h] } %>
14+
15+
## List public events
16+
17+
GET /events
18+
19+
## List repository events
20+
21+
GET /repos/:user/:repo/events
22+
23+
## List issue events for a repository
24+
25+
GET /repos/:user/:repo/issues/events
26+
27+
## List public events for a network of repositories
28+
29+
GET /networks/:user/:repo/events
30+
31+
## List public events for an organization
32+
33+
GET /orgs/:org/events
34+
35+
## List events that a user has received
36+
37+
These are events that you've received by watching repos and following
38+
users. If you are authenticated as the given user, you will see private
39+
events. Otherwise, you'll only see public events.
40+
41+
GET /users/:user/received_events
42+
43+
## List public events that a user has received
44+
45+
GET /users/:user/received_events/public
46+
47+
## List events performed by a user
48+
49+
If you are authenticated as the given user, you will see your private
50+
events. Otherwise, you'll only see public events.
51+
52+
GET /users/:user/events
53+
54+
## List public events performed by a user
55+
56+
GET /users/:user/events/public
57+
58+
## List events for an organization
59+
60+
This is the user's organization dashboard. You must be authenticated as
61+
the user to view this.
62+
63+
GET /users/:user/events/orgs/:org
64+

content/v3/events/types.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Event types | GitHub API
3+
---
4+
5+
# Event Types
6+
7+
Each event has a similar JSON schema, but a unique `payload` object that is
8+
determined by its event type. [Repository hook](http://developer.github.com/v3/repos/hooks/) names relate to event types, and will have the exact same payload. The only exception to this is the `push` hook, which has a larger, more detailed payload.
9+
10+
## PushEvent
11+
12+
Hook name: push
13+
14+
head
15+
: **string** - The SHA of the HEAD commit on the repository.
16+
17+
ref
18+
: **string** - The full Git ref that was pushed. Example:
19+
"refs/heads/master"
20+
21+
size
22+
: **integer** - The number of commits in the push.
23+
24+
commits
25+
: **array** - The list of pushed commits.
26+
27+
commits[][sha]
28+
: **string** - The SHA of the commit.
29+
30+
commits[][message]
31+
: **message** - The commit message.
32+
33+
commits[][author]
34+
: **object** - The git author of the commit.
35+
36+
commits[][author][name]
37+
: **string** - The git author's name.
38+
39+
commits[][author][email]
40+
: **string** - The git author's email address.
41+
42+
commits[][url]
43+
: **url** - Points to the commit API resource.
44+

layouts/default.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ <h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v3/users/">U
104104
<li><a href="/v3/users/keys/">Keys</a></li>
105105
</ul>
106106
</li>
107+
<li class="js-topic">
108+
<h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v3/events/">Events</a></h3>
109+
<ul class="js-guides">
110+
<li><a href="/v3/events/types/">Types</a></li>
111+
</ul>
112+
</li>
107113
</ul>
108114
</div> <!-- /sidebar-module -->
109115
<div class="sidebar-module">

lib/resources.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,19 @@ def json(key)
674674
"created_at" => "2011-09-06T17:26:27Z"
675675
}
676676

677+
EVENT = {
678+
:type => "Event",
679+
:public => true,
680+
:payload => {},
681+
:repo => {
682+
:id => 3,
683+
:name => "octocat/Hello-World",
684+
:url => "https://api.github.com/repos/octocat/Hello-World"
685+
},
686+
:actor => USER,
687+
:org => USER,
688+
:created_at => "2011-09-06T17:26:27Z",
689+
}
677690
end
678691
end
679692

0 commit comments

Comments
 (0)
0