Skip to content

Commit

Permalink
add events api docs, start on event type docs
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Oct 28, 2011
1 parent a5cf0e1 commit 39b8fce
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 0 deletions.
64 changes: 64 additions & 0 deletions content/v3/events.md
@@ -0,0 +1,64 @@
---
title: Events | GitHub API
---

# Events

This is a read-only API to the GitHub events. These events power the
various activity streams on the site.

All Events have the same response format:

<%= headers 200, :pagination => true %>
<%= json(:event) { |h| [h] } %>

## List public events

GET /events

## List repository events

GET /repos/:user/:repo/events

## List issue events for a repository

GET /repos/:user/:repo/issues/events

## List public events for a network of repositories

GET /networks/:user/:repo/events

## List public events for an organization

GET /orgs/:org/events

## List events that a user has received

These are events that you've received by watching repos and following
users. If you are authenticated as the given user, you will see private
events. Otherwise, you'll only see public events.

GET /users/:user/received_events

## List public events that a user has received

GET /users/:user/received_events/public

## List events performed by a user

If you are authenticated as the given user, you will see your private
events. Otherwise, you'll only see public events.

GET /users/:user/events

## List public events performed by a user

GET /users/:user/events/public

## List events for an organization

This is the user's organization dashboard. You must be authenticated as
the user to view this.

GET /users/:user/events/orgs/:org

44 changes: 44 additions & 0 deletions content/v3/events/types.md
@@ -0,0 +1,44 @@
---
title: Event types | GitHub API
---

# Event Types

Each event has a similar JSON schema, but a unique `payload` object that is
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.

## PushEvent

Hook name: push

head
: **string** - The SHA of the HEAD commit on the repository.

ref
: **string** - The full Git ref that was pushed. Example:
"refs/heads/master"

size
: **integer** - The number of commits in the push.

commits
: **array** - The list of pushed commits.

commits[][sha]
: **string** - The SHA of the commit.

commits[][message]
: **message** - The commit message.

commits[][author]
: **object** - The git author of the commit.

commits[][author][name]
: **string** - The git author's name.

commits[][author][email]
: **string** - The git author's email address.

commits[][url]
: **url** - Points to the commit API resource.

6 changes: 6 additions & 0 deletions layouts/default.html
Expand Up @@ -104,6 +104,12 @@ <h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v3/users/">U
<li><a href="/v3/users/keys/">Keys</a></li>
</ul>
</li>
<li class="js-topic">
<h3><a href="#" class="js-expand-btn collapsed">&nbsp;</a><a href="/v3/events/">Events</a></h3>
<ul class="js-guides">
<li><a href="/v3/events/types/">Types</a></li>
</ul>
</li>
</ul>
</div> <!-- /sidebar-module -->
<div class="sidebar-module">
Expand Down
13 changes: 13 additions & 0 deletions lib/resources.rb
Expand Up @@ -674,6 +674,19 @@ def json(key)
"created_at" => "2011-09-06T17:26:27Z"
}

EVENT = {
:type => "Event",
:public => true,
:payload => {},
:repo => {
:id => 3,
:name => "octocat/Hello-World",
:url => "https://api.github.com/repos/octocat/Hello-World"
},
:actor => USER,
:org => USER,
:created_at => "2011-09-06T17:26:27Z",
}
end
end

Expand Down

0 comments on commit 39b8fce

Please sign in to comment.