diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..2504c66a83 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.svg eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..05f3372066 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +output +tmp +.DS_Store +.bundle +bin +crash.log +/vendor/gems/ +/bin/ +/.bundle/ +static/search-index.json diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000000..77fee73a8c --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +1.9.3 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..11a115a276 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: ruby +rvm: + - 1.9.3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..63fd16f7f0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,7 @@ +Found a typo? Have an idea for improving the docs? Feel free to open a pull request and we'll get it merged as soon as we can! + +If you have a specific question or issues with the API, please [let us know](https://github.com/contact). + +## Do you work at GitHub? + +If you're a GitHub employee, please take a look at [our GitHubber article](https://githubber.com/article/crafts/writing/everything-you-need-to-know-about-the-Developer-blog) for more specific information on contributing. diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..e42a27991f --- /dev/null +++ b/Gemfile @@ -0,0 +1,24 @@ +source "http://rubygems.org" + +ruby '1.9.3' + +gem 'builder' +gem 'coderay' +gem 'kramdown', '~> 0.13.2' +gem 'mime-types', '~> 1.16' +gem 'nanoc', '~> 3.7' +gem 'nokogiri', '~> 1.6.0' +gem 'rouge', '~> 1.4' +gem 'rake', '~> 0.9.2' +gem 'thin' +gem 'yajl-ruby', '~> 0.8.2' + +group :development do + gem 'adsf' + gem 'fssm' + gem 'guard-nanoc' +end + +group :test do + gem 'html-proofer' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..84019f4e22 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,88 @@ +GEM + remote: http://rubygems.org/ + specs: + adsf (1.2.0) + rack (>= 1.0.0) + builder (3.2.2) + celluloid (0.15.2) + timers (~> 1.1.0) + coderay (1.1.0) + colored (1.2) + cri (2.6.1) + colored (~> 1.2) + daemons (1.1.9) + ethon (0.7.0) + ffi (>= 1.3.0) + eventmachine (1.0.3) + ffi (1.9.3) + formatador (0.2.5) + fssm (0.2.10) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + guard-nanoc (1.0.2) + guard (>= 1.8.0) + nanoc (>= 3.6.3) + html-proofer (0.7.1) + colored (~> 1.2) + mercenary (~> 0.3.2) + nokogiri (~> 1.6.0) + typhoeus (~> 0.6.7) + yell (~> 2.0) + kramdown (0.13.8) + listen (2.7.9) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) + mercenary (0.3.3) + method_source (0.8.2) + mime-types (1.25.1) + mini_portile (0.6.0) + nanoc (3.7.1) + cri (~> 2.3) + nokogiri (1.6.2.1) + mini_portile (= 0.6.0) + pry (0.10.0) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + rack (1.5.2) + rake (0.9.6) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rouge (1.4.0) + slop (3.6.0) + thin (1.6.2) + daemons (>= 1.0.9) + eventmachine (>= 1.0.0) + rack (>= 1.0.0) + thor (0.19.1) + timers (1.1.0) + typhoeus (0.6.8) + ethon (>= 0.7.0) + yajl-ruby (0.8.3) + yell (2.0.4) + +PLATFORMS + ruby + +DEPENDENCIES + adsf + builder + coderay + fssm + guard-nanoc + html-proofer + kramdown (~> 0.13.2) + mime-types (~> 1.16) + nanoc (~> 3.7) + nokogiri (~> 1.6.0) + rake (~> 0.9.2) + rouge (~> 1.4) + thin + yajl-ruby (~> 0.8.2) diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000000..b5a2d160f1 --- /dev/null +++ b/Guardfile @@ -0,0 +1,8 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard 'nanoc' do + watch('nanoc.yaml') # Change this to config.yaml if you use the old config file name + watch('Rules') + watch(%r{^(content|layouts|lib|static)/.*$}) +end diff --git a/README.md b/README.md new file mode 100644 index 0000000000..6cde9f2150 --- /dev/null +++ b/README.md @@ -0,0 +1,140 @@ +# developer.github.com + +This is a GitHub API resource built with [nanoc][nanoc]. + +All submissions are welcome. To submit a change, fork this repo, commit your changes, and send us a [pull request](http://help.github.com/send-pull-requests/). + +## Setup + +Ruby 1.9 is required to build the site. + +Get the nanoc gem, plus kramdown for Markdown parsing: + +```sh +$ bundle install +``` + +You can see the available commands with nanoc: + +```sh +$ bundle exec nanoc -h +``` + +Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you started. Though if you're mainly concerned with editing or adding content, you won't need to know much about nanoc. + +[nanoc]: http://nanoc.ws/ + +## Styleguide + +Not sure how to structure the docs? Here's what the structure of the +API docs should look like: + + # API title + + * TOC + {:toc} + + ## API endpoint title + + [VERB] /path/to/endpoint + + ### Parameters + + Name | Type | Description + -----|------|-------------- + `name`|`type` | Description. + + ### Input (request JSON body) + + Name | Type | Description + -----|------|-------------- + `name`|`type` | Description. + + ### Response + + <%= headers 200, :pagination => default_pagination_rels, 'X-Custom-Header' => "value" %> + <%= json :resource_name %> + +**Note**: We're using [Kramdown Markdown extensions](http://kramdown.gettalong.org/syntax.html), such as definition lists. + +### JSON Responses + +We specify the JSON responses in Ruby so that we don't have to write +them by hand all over the docs. You can render the JSON for a resource +like this: + +```erb +<%= json :issue %> +``` + +This looks up `GitHub::Resources::ISSUE` in `lib/resources.rb`. + +Some actions return arrays. You can modify the JSON by passing a block: + +```erb +<%= json(:issue) { |hash| [hash] } %> +``` + +### Terminal blocks + +You can specify terminal blocks with `pre.terminal` elements. (It'd be nice if +Markdown could do this more cleanly.) + +```html +
+$ curl foobar
+....
+
+``` + +This is not a `curl` tutorial though. Not every API call needs +to show how to access it with `curl`. + +## Development + +Nanoc compiles the site into static files living in `./output`. It's +smart enough not to try to compile unchanged files: + +```sh +$ bundle exec nanoc compile +Loading site data... +Compiling site... + identical [0.00s] output/css/960.css + identical [0.00s] output/css/pygments.css + identical [0.00s] output/css/reset.css + identical [0.00s] output/css/styles.css + identical [0.00s] output/css/uv_active4d.css + update [0.28s] output/index.html + update [1.31s] output/v3/gists/comments/index.html + update [1.92s] output/v3/gists/index.html + update [0.25s] output/v3/issues/comments/index.html + update [0.99s] output/v3/issues/labels/index.html + update [0.49s] output/v3/issues/milestones/index.html + update [0.50s] output/v3/issues/index.html + update [0.05s] output/v3/index.html + +Site compiled in 5.81s. +``` + +You can setup whatever you want to view the files. If using the adsf +gem (as listed in the Gemfile), you can start Webrick: + +```sh +$ bundle exec nanoc view +$ open http://localhost:3000 +``` + +Compilation times got you down? Use `autocompile`! + +```sh +$ bundle exec nanoc autocompile +``` + +This starts a web server too, so there's no need to run `nanoc view`. +One thing: remember to add trailing slashes to all nanoc links! + +## Deploy + +```sh +$ bundle exec rake publish +``` diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000000..1d8a74b77f --- /dev/null +++ b/Rakefile @@ -0,0 +1,83 @@ +require 'nanoc3/tasks' +require 'tmpdir' + +task :default => [:test] + +desc "Compile the site" +task :compile do + `nanoc compile` +end + +desc "Test the output" +task :test => [:clean, :remove_output_dir, :compile] do + require 'html/proofer' + HTML::Proofer.new("./output").run +end + +desc "Remove the output dir" +task :remove_output_dir do + FileUtils.rm_r('output') if File.exist?('output') +end + +# Prompt user for a commit message; default: P U B L I S H :emoji: +def commit_message(no_commit_msg = false) + publish_emojis = [':boom:', ':rocket:', ':metal:', ':bulb:', ':zap:', + ':sailboat:', ':gift:', ':ship:', ':shipit:', ':sparkles:', ':rainbow:'] + default_message = "P U B L I S H #{publish_emojis.sample}" + + unless no_commit_msg + print "Enter a commit message (default: '#{default_message}'): " + STDOUT.flush + mesg = STDIN.gets.chomp.strip + end + + mesg = default_message if mesg.nil? || mesg == '' + mesg.gsub(/'/, '') # Allow this to be handed off via -m '#{message}' +end + +desc "Publish to http://developer.github.com" +task :publish, [:no_commit_msg] => [:clean, :remove_output_dir] do |t, args| + mesg = commit_message(args[:no_commit_msg]) + sh "nanoc compile" + + # save precious files + if ENV['IS_HEROKU'] + `git checkout origin/gh-pages` + else + `git checkout gh-pages` + end + tmpdir = Dir.mktmpdir + FileUtils.cp_r("enterprise", tmpdir) + FileUtils.cp("robots.txt", tmpdir) + `git checkout master` + + ENV['GIT_DIR'] = File.expand_path(`git rev-parse --git-dir`.chomp) + ENV['RUBYOPT'] = nil + old_sha = `git rev-parse refs/remotes/origin/gh-pages`.chomp + Dir.chdir('output') do + ENV['GIT_INDEX_FILE'] = gif = '/tmp/dev.gh.i' + ENV['GIT_WORK_TREE'] = Dir.pwd + File.unlink(gif) if File.file?(gif) + # restore precious files + FileUtils.cp_r("#{tmpdir}/enterprise", ".") + FileUtils.cp("#{tmpdir}/robots.txt", ".") + FileUtils.rm_rf(tmpdir) if File.exists?(tmpdir) + `git add -A` + tsha = `git write-tree`.strip + puts "Created tree #{tsha}" + # Heroku runs git@1.7, we don't have the luxury of -m + if ENV['IS_HEROKU'] + `echo #{mesg} > changelog` + csha = `git commit-tree #{tsha} -p #{old_sha} < changelog`.strip + elsif old_sha.size == 40 + csha = `git commit-tree #{tsha} -p #{old_sha} -m '#{mesg}'`.strip + else + csha = `git commit-tree #{tsha} -m '#{mesg}'`.strip + end + puts "Created commit #{csha}" + puts `git show #{csha} --stat` + puts "Updating gh-pages from #{old_sha}" + `git update-ref refs/heads/gh-pages #{csha}` + `git push origin gh-pages` + end +end diff --git a/Rules b/Rules new file mode 100755 index 0000000000..0cc0bba096 --- /dev/null +++ b/Rules @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby + +# A few helpful tips about the Rules file: +# +# * The order of rules is important: for each item, only the first matching +# rule is applied. +# +# * Item identifiers start and end with a slash (e.g. “/about/” for the file +# “content/about.html”). To select all children, grandchildren, … of an +# item, use the pattern “/about/*/”; “/about/*” will also select the parent, +# because “*” matches zero or more characters. + +# Reset search-index by deleting it every time +preprocess do + File.delete("output/search-index.json") if File.exists?("output/search-index.json") +end + +compile '/static/*' do +end + +compile '/CNAME/' do +end + +compile '/feed/' do + filter :erb + filter :kramdown, :toc_levels => [2] +end + +compile '/v3/*' do + filter :search + filter :erb + filter :kramdown, :toc_levels => [2] + filter :enterprise_purge_filter + filter :tip_filter + filter :colorize_syntax, + :colorizers => {:javascript => :rouge} + layout item[:layout] || 'api' +end + +%w(v3 */).each do |version| + compile "/changes/#{version}" do + filter :erb + filter :kramdown, :toc_levels => [2] + filter :colorize_syntax, + :colorizers => {:javascript => :rouge} + layout 'changes' if version[0] == '*' + layout item[:layout] || 'blog' + end +end + +compile '/guides/*' do + filter :kramdown, :toc_levels => [2] + filter :tip_filter + filter :erb + filter :colorize_syntax, :default_colorizer => :rouge + layout item[:layout] || 'guides' +end + +compile '/webhooks/*' do + filter :kramdown, :toc_levels => [2] + filter :tip_filter + filter :erb + filter :colorize_syntax, :default_colorizer => :rouge + layout item[:layout] || 'webhooks' +end + +compile '*' do + filter :erb + filter :kramdown, :toc_levels => [2] + filter :colorize_syntax, + :colorizers => {:javascript => :rouge} + layout item[:layout] || 'default' +end + +route '/static/*' do + item.identifier[7..-2] +end + +route '/CNAME/' do + '/CNAME' +end + +route '/feed' do + '/changes.atom' +end + +route '*' do + item.identifier + 'index.html' +end + +layout '*', :erb diff --git a/changes/2012-10-14-rate-limit-changes/index.html b/changes/2012-10-14-rate-limit-changes/index.html deleted file mode 100644 index 2a60d2e593..0000000000 --- a/changes/2012-10-14-rate-limit-changes/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - Rate limit changes for unauthenticated requests - - - - - - - - - - - -
- -
- -
-
-
-

- Rate limit changes for unauthenticated requests -

- -
-
    -
  • - - October 14, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

To ensure a high quality of service for all API consumers, we’ve reduced the -default rate limit for unauthenticated requests. To enjoy the default rate -limit of 5,000 requests per hour, you’ll need to -authenticate via Basic Auth -or OAuth. Unauthenticated requests will be limited to 60 per hour unless you -include your OAuth client and -secret.

- -

We’ll soon require all requests to include a valid User Agent -header. Setting a -unique value for this header helps us identify requests and get in touch with -developers who are abusing the API. Most HTTP libraries, wrapper libraries, and -even cURL provide a valid header for you already and allow you to change it to -something unique to your application.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-10-17-org-members-redirection/index.html b/changes/2012-10-17-org-members-redirection/index.html deleted file mode 100644 index bec50d1432..0000000000 --- a/changes/2012-10-17-org-members-redirection/index.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - Organization Members Resource Changes - - - - - - - - - - - -
- -
- -
-
-
-

- Organization Members Resource Changes -

- -
-
    -
  • - - October 17, 2012 - -
  • -
  • - - pezra -
  • -
-
- - -

Requesting the member list of an -organization of which you are not a member now redirects to the public members -list. Similarly, requests to -membership check resources of -an organization of which you are not a member are redirected to the equivalent -public membership check. -One exception to the latter case is that if you are checking about your own -membership the request is not redirected. You are always allowed to know what -organizations you belong to.

- -

The changes where made to clarify the purpose of these various resources. The -/orgs/:org/members resources are intended for use by members of the -organization in question. The /orgs/:org/public_members resources are for -acquiring information about the public membership of organizations. If you are -not a member you are not allowed to see private membership information so you -should be using the public membership resources.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-10-24-set-default-branch/index.html b/changes/2012-10-24-set-default-branch/index.html deleted file mode 100644 index 9b7bfbb588..0000000000 --- a/changes/2012-10-24-set-default-branch/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - Set the default branch for a repository - - - - - - - - - - - -
- -
- -
-
-
-

- Set the default branch for a repository -

- -
-
    -
  • - - October 24, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

You can set the default branch for a repository to something other than ‘master’ from the GitHub repository admin screen:

- -

repo admin

- -

Now, you can update this setting via the API. We’ve added a default_branch parameter to the Edit Repository method:

- -
-curl -u pengwynn \
-     -d '{"name": "octokit", "default_branch":"development"}' \
-     https://api.github.com/repos/pengwynn/octokit
-
- -

If you provide a branch name that hasn’t been pushed to GitHub, we’ll gracefully fall back to 'master' or the first branch.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-10-26-notifications-api/index.html b/changes/2012-10-26-notifications-api/index.html deleted file mode 100644 index 985ed0dd34..0000000000 --- a/changes/2012-10-26-notifications-api/index.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - Notifications API - - - - - - - - - - - -
- -
- -
-
-
-

- Notifications API -

- -
- -
- - -

Now that the dust has settled around Notifications and Stars, -we’ve unleashed all that :sparkles: in a brand new API. You can now -view and mark notifications as read.

- -

Endpoint

- -

The core notifications functionality is under the /notifications endpoint. -You can look for unread notifications:

- -
-$ curl https://api.github.com/notifications
-
- -

You can filter these notifications to a single Repository:

- -
-$ curl https://api.github.com/repos/technoweenie/faraday/notifications
-
- -

You can mark them as read:

- -
-# all notifications
-$ curl https://api.github.com/notifications \
-    -X PUT -d '{"read": true}'
-
-# notifications for a single repository
-$ curl https://api.github.com/repos/technoweenie/faraday/notifications \
-    -X PUT -d '{"read": true}'
-
- -

You can also modify subscriptions for a Repository or a single thread.

- -
-# subscription details for the thread (either an Issue or Commit)
-$ curl https://api.github.com/notifications/threads/1/subscription
-
-# subscription details for a whole Repository.
-$ curl https://api.github.com/repos/technoweenie/faraday/subscription
-
- -

Polling

- -

The Notifications API is optimized for polling by the last modified time:

- -
-# Add authentication to your requests
-$ curl -I https://api.github.com/notifications
-HTTP/1.1 200 OK
-Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
-X-Poll-Interval: 60
-
-# Pass the Last-Modified header exactly
-$ curl -I https://api.github.com/notifications
-    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
-HTTP/1.1 304 Not Modified
-X-Poll-Interval: 60
-
- -

You can read about the API details in depth in the Notifications documentation.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-10-31-gist-comment-uris/index.html b/changes/2012-10-31-gist-comment-uris/index.html deleted file mode 100644 index 6307df7af6..0000000000 --- a/changes/2012-10-31-gist-comment-uris/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - Gist comment URIs - - - - - - - - - - - -
- -
- -
-
-
-

- Gist comment URIs -

- -
-
    -
  • - - October 31, 2012 - -
  • -
  • - - pezra -
  • -
-
- - -

The URIs of all gist comments are changing immediately. The new URI pattern for gist comments is /gists/{gist-id}/comments/{id}. (See gist comments section of the docs for more details.) This change is necessary because the auto-incremented ids of gist comments are easy to guess. This predictability allows anyone to view comments on private Gists with relative ease. Obviously, comments on private gists should be just as private as the gist itself.

- -

Adding the gist id to the URI of comments makes it impossible, in practical terms, to guess that URI because the id of private gists are very large random numbers. This is, unfortunately, a breaking change but one that cannot be avoided because of the security implications of the current URIs. We apologize for the inconvenience.

- -

We have also added a comments_url member to the Gist documents. The comments_url link provides access to the comments of a Gist in a way that will insulate clients from changes in the URI patterns used by the GitHub API. We are increasing our use of links in order to make changes such as this one less damaging to clients. We strongly encourage using url and *_url properties, where possible, rather than constructing URIs using the patterns published on this site. Doing so will result in clients that break less often.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-11-27-forking-to-organizations/index.html b/changes/2012-11-27-forking-to-organizations/index.html deleted file mode 100644 index ec21998306..0000000000 --- a/changes/2012-11-27-forking-to-organizations/index.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - Forking to Organizations - - - - - - - - - - - -
- -
- -
-
-
-

- Forking to Organizations -

- -
- -
- - -

We made a slight change to the way you fork a repository. By default, you -can fork my repository through an HTTP POST to the repository’s fork resource.

- -
$ curl -X POST https://api.github.com/repos/technoweenie/faraday/forks
-
- -

This repository forks to your personal account. However, there are cases when -you want to fork to one of your organizations instead. The previous method -required a ?org query parameter:

- -
$ curl -X POST /repos/technoweenie/faraday/forks?org=mycompany
-
- -

Query parameters on POST requests are unusual in APIs, and definitely -inconsistent with the rest of the GitHub API. You should be able to post a -JSON body like every other POST endpoint. Now, you can! Only, now we’re -calling the field organization.

- -
$ curl /repos/technoweenie/faraday/forks?org=mycompany \
-  -d '{"organization": "mycompany"}'
-
- -

Don’t worry, we are committed to maintaining the legacy behavior until the next -major change of the GitHub API.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-11-29-gitignore-templates/index.html b/changes/2012-11-29-gitignore-templates/index.html deleted file mode 100644 index 50dba86ab9..0000000000 --- a/changes/2012-11-29-gitignore-templates/index.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - Gitignore Templates API - - - - - - - - - - - -
- -
- -
-
-
-

- Gitignore Templates API -

- -
-
    -
  • - - November 29, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

We recently made it easy to initialize a repository when you create -it via the API. One of the options you can pass when creating a -repository is gitignore_template. This value is the name of one of the -templates from the the public GitHub .gitignore repository.

- -

The Gitignore Templates API makes it easy to list those templates:

- -
curl https://api.github.com/gitignore/templates
-
-HTTP/1.1 200 OK
-
-[
-  "Actionscript",
-  "Android",
-  "AppceleratorTitanium",
-  "Autotools",
-  "Bancha",
-  "C",
-  "C++",
-  ...
-
- -

If you’d like to view the source, you can also fetch a single template.

- -
curl -H 'Accept: application/vnd.github.raw' \
-     https://api.github.com/gitignore/templates/Objective-C
-
-HTTP/1.1 200 OK
-
-# Xcode
-.DS_Store
-build/
-*.pbxuser
-!default.pbxuser
-*.mode1v3
-!default.mode1v3
-*.mode2v3
-!default.mode2v3
-*.perspectivev3
-!default.perspectivev3
-*.xcworkspace
-!default.xcworkspace
-xcuserdata
-profile
-*.moved-aside
-DerivedData
-.idea/
-
- - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-12-04-List-comments-for-repo/index.html b/changes/2012-12-04-List-comments-for-repo/index.html deleted file mode 100644 index 75c4884d64..0000000000 --- a/changes/2012-12-04-List-comments-for-repo/index.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - Per-repository Review and Issue Comment listing - - - - - - - - - - - -
- -
- -
-
-
-

- Per-repository Review and Issue Comment listing -

- -
-
    -
  • - - December 4, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

You’ve always been able to grab all the commit comments for an entire -repository via the API, but to get Issue comments and Pull Request Review -Comments, you could only fetch the comments for a single Issue or Pull Request.

- -

Today, we’re introducing two new methods to grab all Issue Comments and Review -Comments for a repository.

- -
# Grab all Issue Comments
-curl https://api.github.com/repos/mathiasbynens/dotfiles/issues/comments
-
-# Grab all Review Comments
-curl https://api.github.com/repos/mathiasbynens/dotfiles/pulls/comments
-
- -

Check out the docs for sorting and filtering options:

- - - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-12-06-create-authorization-for-app/index.html b/changes/2012-12-06-create-authorization-for-app/index.html deleted file mode 100644 index f03d3375a9..0000000000 --- a/changes/2012-12-06-create-authorization-for-app/index.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - Create an OAuth authorization for an app - - - - - - - - - - - -
- -
- -
-
-
-

- Create an OAuth authorization for an app -

- -
-
    -
  • - - December 6, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

The Authorizations API is an easy way to create an OAuth -authorization using Basic Auth. Just POST your desired scopes and optional -note and you get a token back:

- -
-    curl -u pengwynn -d '{"scopes": ["user", "gist"]}' \
-         https://api.github.com/authorizations
-
- -

This call creates a token for the authenticating user tied to a special “API” -OAuth application.

- -

We now support creating tokens for your own OAuth application by passing your -twenty character client_id and forty character client_secret as found in -the settings page for your OAuth application.

- -
-    curl -u pengwynn -d '{ \
-                          "scopes": ["user", "gist"], \
-                          "client_id": "abcdeabcdeabcdeabcdeabcde" \
-                          "client_secret": "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde" \
-                         }' \ '
-            https://api.github.com/authorizations
-
- -

No more implementing the web flow just to get a token tied to your -app’s rate limit.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-12-08-finding-source-and-fork-repos-for-organizations/index.html b/changes/2012-12-08-finding-source-and-fork-repos-for-organizations/index.html deleted file mode 100644 index 754ee08dad..0000000000 --- a/changes/2012-12-08-finding-source-and-fork-repos-for-organizations/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - Finding sources and fork repositories for organizations - - - - - - - - - - - -
- -
- -
-
-
-

- Finding sources and fork repositories for organizations -

- -
-
    -
  • - - December 8, 2012 - -
  • -
  • - - rick -
  • -
-
- - -

We’ve made a couple of changes today to the Organization repositories -listing to bring it a bit closer to the functionality of the GitHub.com -Organization repositories tab. We now let you retrieve repositories -which are forks of another repository, as well as those repositories which -are sources (not forks).

- -
# Grab all fork Repositories for an Organization
-curl "https://api.github.com/orgs/:org/repos?type=forks"
-
-# Grab all source Repositories for an Organization
-curl "https://api.github.com/orgs/:org/repos?type=sources"
-
- -

Check out the docs for sorting and filtering options:

- - - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-12-09-organization-repositories-results-now-paginate/index.html b/changes/2012-12-09-organization-repositories-results-now-paginate/index.html deleted file mode 100644 index 999426d2b2..0000000000 --- a/changes/2012-12-09-organization-repositories-results-now-paginate/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - Pagination for Organization Repository lists now paginates properly - - - - - - - - - - - -
- -
- -
-
-
-

- Pagination for Organization Repository lists now paginates properly -

- -
-
    -
  • - - December 9, 2012 - -
  • -
  • - - rick -
  • -
-
- - -

- -

Improvements continue to the Organizations Repository listing endpoint. -Today we’re improving pagination so that it works as documented. Now -you can expect Link headers to navigate through the results space, -regardless of what you send in the type parameter.

- -

The docs for Organization Repositories queries are still here:

- - - -

EDIT: Link headers are our preferred navigation technique.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2012-12-10-Diff-and-patch-media-types/index.html b/changes/2012-12-10-Diff-and-patch-media-types/index.html deleted file mode 100644 index 794f64f54a..0000000000 --- a/changes/2012-12-10-Diff-and-patch-media-types/index.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - Diff and patch media types - - - - - - - - - - - -
- -
- -
-
-
-

- Diff and patch media types -

- -
-
    -
  • - - December 10, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

Starting today, you can get .diff and .patch content directly from the API for the following resources:

- - - -

Simply use the same resource URL and send either application/vnd.github.diff or application/vnd.github.patch in the Accept header:

- -
curl -H "Accept: application/vnd.github.diff" https://api.github.com/repos/pengwynn/dotfiles/commits/aee60a4cd56fb4c6a50e60f17096fc40c0d4d72c
-
-diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink
-index 1f599cb..abaf625 100755
---- a/tmux/tmux.conf.symlink
-+++ b/tmux/tmux.conf.symlink
-@@ -111,6 +111,7 @@ set-option -g base-index 1
- ## enable mouse
- set-option -g mouse-select-pane on
- set-option -g mouse-select-window on
-+set-option -g mouse-resize-pane on
- set-window-option -g mode-keys vi
- set-window-option -g mode-mouse on
- # set-window-option -g monitor-activity off
-
- - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-9-28-auto-init-for-repositories/index.html b/changes/2012-9-28-auto-init-for-repositories/index.html deleted file mode 100644 index c12604fd76..0000000000 --- a/changes/2012-9-28-auto-init-for-repositories/index.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - Initialize a repository when creating - - - - - - - - - - - -
- -
- -
-
-
-

- Initialize a repository when creating -

- -
-
    -
  • - - September 28, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- - -

Today we’ve made it easier to add commits to a repository via the GitHub API. -Until now, you could create a repository, but you would -need to initialize it locally via your Git client before adding any commits via -the API.

- -

Now you can optionally init a repository when it’s created by sending true -for the auto_init parameter:

- -
-curl -i -u pengwynn \
-     -d '{"name": "create-repo-test", "auto_init": true}' \
-     https://api.github.com/user/repos
-
- -

The resulting repository will have a README stub and an initial commit.

- -

create repo screenshot

- -

.gitignore templates

- -

Along with this change, you can set up your .gitignore template by passing -the basename of any template in the GitHub gitignore templates -project.

- -
-curl -i -u pengwynn \
-     -d '{"name": "create-repo-test", "auto_init": true, \
-          "gitignore_template": "Haskell"}' \
-     https://api.github.com/user/repos
-
- -

As the docs point out, the gitignore_template parameter -is ignored if auto_init is not present and true.

- -

If you have any questions or feedback, drop us a line at -https://github.com/contact, support@github.com, or -@GitHubAPI.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2012-9-5-watcher-api/index.html b/changes/2012-9-5-watcher-api/index.html deleted file mode 100644 index 496d603d58..0000000000 --- a/changes/2012-9-5-watcher-api/index.html +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - Upcoming Changes to Watcher and Star APIs - - - - - - - - - - - -
- -
- -
-
-
-

- Upcoming Changes to Watcher and Star APIs -

- -
- -
- - -

We recently changed the Watcher behavior on GitHub. What -used to be known as “Watching” is now “Starring”. Starring is basically a way -to bookmark interesting repositories. Watching is a way to indicate that you -want to receive email or web notifications on a Repository.

- -

This works well on GitHub.com, but poses a problem for the GitHub API. How do -we change this in a way that developers can gracefully upgrade their -applications? We’re currently looking at rolling out the changes in three -phases over an extended period of time.

- -

Current Status

- -

The current Repository Starring methods look like this:

- -
    -
  • -/repos/:owner/:repo/watchers - A list of users starring the repository.
  • -
  • -/users/:user/watched - A list of repositories that a user has starred.
  • -
  • -/user/watched - A list of repositories the current user has starred.
  • -
- -

Phase 1: Add Watchers as Subscriptions

- -

This phase exposes Watchers as “Subscriptions”. This is to -keep from clashing with the legacy endpoints. This phase will happen -automatically and will not break your application until Phase 3 starts. -(UPDATE: API v3 will continue to support this functionality indefinitely.)

- -
    -
  • -/repos/:owner/:repo/subscribers - A list of users watching the repository.
  • -
  • -/users/:user/subscriptions - A list of repositories that a user is watching.
  • -
  • -/user/subscriptions - A list of repositories the current user is watching.
  • -
- -

We’ll also add a copy of the legacy Watchers API in the new endpoint:

- -
    -
  • -/repos/:owner/:repo/stargazers - A list of users starring the repository.
  • -
  • -/users/:user/starred - A list of repositories that a user has starred.
  • -
  • -/user/starred - A list of repositories the current user has starred.
  • -
- -

This is in place now with the current media type for the API:

- -
application/vnd.github.beta+json
-
- -

If you care about your application not breaking, make sure all outgoing API -requests pass that value for the “Accept” header. You should do this now. This -can be verified by checking the X-GitHub-Media-Type header on all API -responses.

- -
# Accesses a user's starred repositories.
-curl https://api.github.com/user/watched \
-  -H "Accept: application/vnd.github.beta+json"
-
- -

-This Phase will be broken once Phase 3 starts. Phase 3 removes all support for -the "beta" media type, and makes the "v3" media type the implicit default -for API requests.

- -

UPDATE - November 6, 2013

- -
-

- API v3 will continue to officially support the functionality described in - Phase 1 above. This functionality will remain intact for the lifetime of - API v3. -

-

- API v3 will not include Phases 2 and 3 (below). Those phases will - likely be part of the next major version of the API. (We have not announced - a timeline for the next major version of the API.) -

-
- -

Phase 2: Switch /watchers API Endpoint

- -The "watch" endpoints will now be a copy of the "subscription" endpoints. You -will have to use /user/starred to get a user's starred repositories, not -/user/watched. - -This requires a new media type value: - -
application/vnd.github.v3+json
- -This is a breaking change from Phase 1. We will release this change in an -experimental mode first, letting developers gracefully upgrade their -applications by specifying the new media value for the Accept header. - - -
-# Accesses a user's watched repositories.
-curl https://api.github.com/user/watched \
-  -H "Accept: application/vnd.github.v3+json"
-
-
- -

Phase 3: Remove /subscribers API Endpoint.

- -This phase involves disabling the subscription endpoints completely. At this -point, you should be using the starring endpoints for starred repositories, and -the watch endpoints for watched repositories. No date has been set yet, but we -expect this to be 3-6 months after Phase 2 is in place. This should give -developers enough time for a smooth upgrade path. If they use popular API -wrappers, the work will likely mostly be done for them. - -Keep on passing the "v3" media type in your application, until the API has -another breaking change to make. If you can't make the deadline for Phase 3, -just set the "beta" media type until we shut that down completely. It's likely -that we will keep the old "beta" media type active for another month, like -the last time we terminated -old API functionality. - -

We look forward to assisting you through this transition. Hit us up at -https://github.com/contact, support@github.com, or -@GitHubAPI.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-01-08-new-user-scopes/index.html b/changes/2013-01-08-new-user-scopes/index.html deleted file mode 100644 index 50b10509bb..0000000000 --- a/changes/2013-01-08-new-user-scopes/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - New User scopes - - - - - - - - - - - -
- -
- -
-
-
-

- New User scopes -

- -
- -
- - -

We’ve added a few new user scopes for 3rd party applications that want very -specific user functionality. The user:email scope gives apps read-only access -to a user’s private email addresses. The user:follow scope lets a user -follow and unfollow other users.

- -

This should help keep applications from requiring the user scope, which -can be potentially dangerous.

- -

We also added a read-only endpoint to get a user’s public SSH keys.

- -
GET https://api.github.com/users/technoweenie/keys
-
- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-01-31-user-agent-will-soon-be-mandatory/index.html b/changes/2013-01-31-user-agent-will-soon-be-mandatory/index.html deleted file mode 100644 index 79455778be..0000000000 --- a/changes/2013-01-31-user-agent-will-soon-be-mandatory/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - User Agent mandatory from March 4th 2013 - - - - - - - - - - - -
- -
- -
-
-
-

- User Agent mandatory from March 4th 2013 -

- -
-
    -
  • - - January 31, 2013 - -
  • -
  • - - agh -
  • -
-
- - -

Following on from our previous post -about requiring requests to include a valid User Agent header -we will soon be changing our API servers to return HTTP 403 -to any clients not providing a valid User Agent header.

- -

We will be making this change on Monday, March 4th 2013.

- -

Setting this helps us identify requests from you, and get in touch with people who are using -the API in a way which causes disruption to GitHub. Most HTTP libraries and tools like cURL -already provide a valid header for you, and allow you to customize it, so this will not require -many of our users to make any changes whatsoever.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-04-24-user-agent-required/index.html b/changes/2013-04-24-user-agent-required/index.html deleted file mode 100644 index b4ebb6e9b5..0000000000 --- a/changes/2013-04-24-user-agent-required/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - User Agent now mandatory - - - - - - - - - - - -
- -
- -
-
-
-

- User Agent now mandatory -

- -
-
    -
  • - - April 24, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- - -

After an almost six week grace period, we’re now enforcing the User Agent -header for all API requests. Most HTTP libraries (including cURL) -set this header by default. If you’re experiencing an increase in 403 -responses, be sure and check your code.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-04-25-deprecating-merge-commit-sha/index.html b/changes/2013-04-25-deprecating-merge-commit-sha/index.html deleted file mode 100644 index ad8fe71b12..0000000000 --- a/changes/2013-04-25-deprecating-merge-commit-sha/index.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - Deprecating a Confusing Attribute in the Pull Request API - - - - - - - - - - - -
- -
- -
-
-
-

- Deprecating a Confusing Attribute in the Pull Request API -

- -
- -
- - -

When you get the details for a Pull Request from the API, the -response provides everything there is to -know about that Pull Request. In addition to the useful information provided in -the API response, the JSON also includes the merge_commit_sha attribute. This -attribute is a frequent source of misunderstanding, and we aim to remove the -confusion.

- -

To help current API consumers, we’ve documented the -attribute for improved understanding.

- -

To protect future API consumers from this confusion, we have -deprecated the merge_commit_sha attribute, and we will -remove it in the next major version of the API.

- -

As always, if you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-04-30-improved-submodule-support-in-repository-contents-api/index.html b/changes/2013-04-30-improved-submodule-support-in-repository-contents-api/index.html deleted file mode 100644 index 4f191fc91a..0000000000 --- a/changes/2013-04-30-improved-submodule-support-in-repository-contents-api/index.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - Improved Support for Submodules in the Repository Contents API - - - - - - - - - - - -
- -
- -
-
-
-

- Improved Support for Submodules in the Repository Contents API -

- -
- -
- - -

When you view a repository with a submodule on github.com, you get useful links and information for the submodule.

- -

Repository Contents with Submodule

- -

Today we’re making that data available in the Repository Contents API.

- -
-curl https://api.github.com/repos/jquery/jquery/contents/test/qunit
-
-{
-  "name": "qunit",
-  "path": "test/qunit",
-  "type": "submodule",
-  "submodule_git_url": "git://github.com/jquery/qunit.git",
-  "sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "size": 0,
-  "url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
-  "git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "_links": {
-    "self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
-    "git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-    "html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
-  }
-}
-
- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-04-30-statuses-for-branches-and-tags/index.html b/changes/2013-04-30-statuses-for-branches-and-tags/index.html deleted file mode 100644 index cbcd2a9152..0000000000 --- a/changes/2013-04-30-statuses-for-branches-and-tags/index.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - Commit Statuses Now Available for Branches and Tags - - - - - - - - - - - -
- -
- -
-
-
-

- Commit Statuses Now Available for Branches and Tags -

- -
-
    -
  • - - April 30, 2013 - -
  • -
  • - - foca -
  • -
-
- - -

Last week we announced support for build statuses in the branches page. -Now we are extending this to the API. The API endpoint for commit statuses -has been extended to allow branch and tag names, as well as commit SHAs.

- -
-curl https://api.github.com/repos/rails/rails/statuses/3-2-stable
-
- -

Enjoy.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-05-06-create-update-delete-individual-files/index.html b/changes/2013-05-06-create-update-delete-individual-files/index.html deleted file mode 100644 index b4e60b0259..0000000000 --- a/changes/2013-05-06-create-update-delete-individual-files/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - Create, update, and delete individual files - - - - - - - - - - - -
- -
- -
-
-
-

- Create, update, and delete individual files -

- -
-
    -
  • - - May 6, 2013 - -
  • -
  • - - ymendel -
  • -
-
- - -

We’re following in the footsteps of GitHub.com’s ability to edit and -create files in your web browser. Starting today, the -Repository Contents API will let you easily create, update, and even -delete individual files.

- -

Happy editing!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-05-06-repository-stats/index.html b/changes/2013-05-06-repository-stats/index.html deleted file mode 100644 index 52f99c58c6..0000000000 --- a/changes/2013-05-06-repository-stats/index.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - Repository Statistics - - - - - - - - - - - -
- -
- -
-
-
-

- Repository Statistics -

- -
-
    -
  • - - May 6, 2013 - -
  • -
  • - - Caged -
  • -
-
- - -

Today we’re happy to open our Repository Statistics API to everyone. We’re using -repository statistics to power our graphs, -but we can’t wait to see what others can do with this information.

- -

Starting today, these resources are available to you:

- - - -

Enjoy!

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-07-01-feeds-api/index.html b/changes/2013-07-01-feeds-api/index.html deleted file mode 100644 index fe23e21e1e..0000000000 --- a/changes/2013-07-01-feeds-api/index.html +++ /dev/null @@ -1,194 +0,0 @@ - - - - - - - - Feeds API - - - - - - - - - - - -
- -
- -
-
-
-

- Feeds API -

- -
-
    -
  • - - July 1, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- - -

Today we’re releasing a new Feeds API, an easy way to list all the Atom -resources available to the authenticated user.

- -
-
-curl -u defunkt https://api.github.com/feeds
-
-{
-  "timeline_url": "https://github.com/timeline",
-  "user_url": "https://github.com/{user}",
-  "current_user_public_url": "https://github.com/defunkt",
-  "current_user_url": "https://github.com/defunkt.private?token=abc123",
-  "current_user_actor_url": "https://github.com/defunkt.private.actor?token=abc123",
-  "current_user_organization_url": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
-  "_links": {
-    "timeline": {
-      "href": "https://github.com/timeline",
-      "type": "application/atom+xml"
-    },
-    "user": {
-      "href": "https://github.com/{user}",
-      "type": "application/atom+xml"
-    },
-    "current_user_public": {
-      "href": "https://github.com/defunkt",
-      "type": "application/atom+xml"
-    },
-    "current_user": {
-      "href": "https://github.com/defunkt.private?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_actor": {
-      "href": "https://github.com/defunkt.private.actor?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_organization": {
-      "href": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
-      "type": "application/atom+xml"
-    }
-  }
-}
-
-
- -

If you have any questions or feedback, please drop us a line.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-07-02-rate-limit-reset/index.html b/changes/2013-07-02-rate-limit-reset/index.html deleted file mode 100644 index fd732a61c0..0000000000 --- a/changes/2013-07-02-rate-limit-reset/index.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - When Does My Rate Limit Reset? - - - - - - - - - - - -
- -
- -
-
-
-

- When Does My Rate Limit Reset? -

- -
- -
- - -

Have you ever wondered when your rate limit will reset back to its maximum value? -That information is now available in the new X-RateLimit-Reset response header.

- -
-$ curl -I https://api.github.com/orgs/octokit
-
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 60
-X-RateLimit-Remaining: 42
-X-RateLimit-Reset: 1372700873
-...
-
- -

The X-RateLimit-Reset header provides a Unix UTC timestamp, letting you know the exact time that your fresh new rate limit kicks in.

- -

The reset timestamp is also available as part of the /rate_limit resource.

- -
-$ curl https://api.github.com/rate_limit
-
-{
-  "rate": {
-    "limit": 60,
-    "remaining": 42,
-    "reset": 1372700873
-  }
-}
-
- -

For more information on rate limits, be sure to check out the docs.

- -

If you have any questions or feedback, please drop us a line.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-07-19-preview-the-new-search-api/index.html b/changes/2013-07-19-preview-the-new-search-api/index.html deleted file mode 100644 index a00398be70..0000000000 --- a/changes/2013-07-19-preview-the-new-search-api/index.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - Preview the New Search API - - - - - - - - - - - -
- -
- -
-
-
-

- Preview the New Search API -

- -
- -
- - -

Today we’re excited to announce a brand new Search API. Whether you’re -searching for code, repositories, -issues, or users, all the query abilities of -github.com are now available via the API as well.

- -

Maybe you want to find popular Tetris implementations written in Assembly. -We’ve got you covered. -Or perhaps you’re looking for new gems that are using Octokit.rb. -No problem. -The possibilities are endless.

- -

Highlights

- -

On github.com, we enjoy the context provided by code snippets and highlights in -search results.

- -

code-snippet-highlighting

- -

We want API consumers to have access to that information as well. So, API -requests can opt to receive those -text fragments in the response. Each fragment is accompanied by -numeric offsets identifying the exact location of each matching search term.

- -

Preview period

- -

We’re making this new API available today for developers to -preview. We think developers are going to love it, but we want -to get your feedback before we declare the Search API “final” and -“unchangeable.” We expect the preview period to last for roughly 60 days.

- -

As we discover opportunities to improve this new API during the preview period, -we may ship changes that break clients using the preview version of the API. We -want to iterate quickly. To do so, we will announce any changes here (on the -developer blog), but we will not provide any advance notice.

- -

At the end of preview period, the Search API will become an official component -of GitHub API v3. At that point, the new Search API will be stable and suitable -for production use.

- -

What about the old search API?

- -

The legacy search API is still available. Many existing clients -depend on it, and it is not changing in any way. While the new API offers much -more functionality, the legacy search endpoints remain an official part of -GitHub API v3.

- -

Take it for a spin

- -

We hope you’ll kick the tires and send us your feedback. Happy -searching finding!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-08-20-search-api-improvements/index.html b/changes/2013-08-20-search-api-improvements/index.html deleted file mode 100644 index 7849770514..0000000000 --- a/changes/2013-08-20-search-api-improvements/index.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - Improvements to the Search API - - - - - - - - - - - -
- -
- -
-
-
-

- Improvements to the Search API -

- -
- -
- - -

Today we’re shipping two improvements to the new Search API.

- -

More Text Match Metadata

- -

When searching for code, the API previously provided text match metadata (i.e., “highlights”) for file content. -Now, you can also get this metadata for matches that occur within the file path.

- -

For example, when searching for files that have “client” in their path, the results include this match for lib/octokit/client/commits.rb:

- -
-{
-  "name": "commits.rb",
-  "path": "lib/octokit/client/commits.rb",
-  "text_matches": [
-    {
-      "object_url": "https://api.github.com/repositories/417862/contents/lib/octokit/client/commits.rb?ref=8d487ab06ccef463aa9f5412a56f1a2f1fa4dc88",
-      "object_type": "FileContent",
-      "property": "path",
-      "fragment": "lib/octokit/client/commits.rb",
-      "matches": [
-        {
-          "text": "client",
-          "indices": [ 12, 18 ]
-        }
-      ]
-    }
-  ]
-  // ...
-}
-
- -

Better Text Match Metadata

- -

Before today, the API applied HTML entity encoding to all fragment data. -For example, imagine your search returns an issue like rails/rails#11889:

- -

Example Issue Title

- -

The response would include a text_matches array with the following object:

- -
-{
-  "fragment": "undefined method `except' for #&lt;Array:XXX&gt;",
-  // ...
-}
-
- -

Inside the fragment value, we see HTML-encoded entities (e.g., &lt;). -Since we’re returning JSON (not HTML), API clients might not expect any HTML-encoded text. -As of today, the API returns these fragments without this extraneous encoding.

- -
-{
-  "fragment": "undefined method `except' for #<Array:XXX>",
-  // ...
-}
-
- -

Preview Period

- -

We’re about halfway through the preview period for the new Search API. -We appreciate everyone that has provided feedback so far. Please keep it coming!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-09-03-two-factor-authentication/index.html b/changes/2013-09-03-two-factor-authentication/index.html deleted file mode 100644 index b7f4c8e2b6..0000000000 --- a/changes/2013-09-03-two-factor-authentication/index.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - Two-Factor Authentication and the API - - - - - - - - - - - -
- -
- -
-
-
-

- Two-Factor Authentication and the API -

- -
- -
- - -

As announced earlier today, GitHub.com now supports two-factor -authentication (2FA) for increased security. For users with this feature -enabled, GitHub.com will prompt for a 2FA code in addition to a username and -password during authentication. We’ve also rolled out some improvements to the -API to ensure that 2FA requirements in the API are consistent with GitHub.com.

- -

Authenticating with the API

- -

For users without 2FA enabled, and for applications using the OAuth web -flow for authentication, everything is -business as usual. You’ll continue to authenticate with the API just as you -always have. (That was easy.)

- -

If you enable 2FA and use Basic Authentication to access the API, we’re -providing multiple options to make the flow simple and easy.

- -

Basic Authentication and 2FA

- -

Personal Access Tokens

- -

Personal access tokens provide the simplest option for using 2FA with Basic -Authentication. You can create these tokens via the application settings page -on GitHub.com, and you can revoke -them at any time. For more information about authenticating to the API with -personal access tokens, be sure to check out our help article on the -topic.

- -

Tightly-integrated 2FA

- -

For developers wishing to integrate GitHub 2FA directly into their application, -the API’s Basic Authentication now supports the ability to send the user’s 2FA -code, in addition to the username and password.

- -

We’re here to help

- -

We think GitHub users are going to love the additional security provided by -two-factor authentication. As always, if you have any questions or feedback, -let us know. We’re here to help!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-09-25-releases-api/index.html b/changes/2013-09-25-releases-api/index.html deleted file mode 100644 index b9ab3fd1c8..0000000000 --- a/changes/2013-09-25-releases-api/index.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - Releases API - - - - - - - - - - - -
- -
- -
-
-
-

- Releases API -

- -
- -
- - -

This summer we made it easier to release your software. Today, you can fully automate those releases via the -Releases API Preview.

- -

This API is a little different due to the binary assets. We use the Accept header for content negotiation when requesting -a release asset. Pass a standard API media type to get the API representation:

- -
-$ curl -i -H "Authorization: token TOKEN" \
-     -H "Accept: application/vnd.github.manifold-preview" \
-     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
-
-HTTP/1.1 200 OK
-
-{
-  "id": 123,
-  ...
-}
-
- -

Pass “application/octet-stream” to download the binary content.

- -
-$ curl -i -H "Authorization: token TOKEN" \
-     -H "Accept: application/octet-stream" \
-     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
-
-HTTP/1.1 302 Found
-
- -

Uploads are handled by a single request to a companion “uploads.github.com” service.

- -
-$ curl -H "Authorization: token TOKEN" \
-     -H "Accept: application/vnd.github.manifold-preview" \
-     -H "Content-Type: application/zip" \
-     --data-binary @build/mac/package.zip \
-     "https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=1.0.0-mac.zip"
-
- -

Preview mode

- -

The new API is available as a preview. This gives developers a chance to provide feedback on the direction of -the API before we freeze changes. We expect to lift the preview status in 30 days.

- -

As with the Search API, we’ll take this opportunity to iterate quickly. Breaking changes will be announced -on this developer blog without any advance warning. Once the preview period is over, we’ll consider the Releases API unchangeable. -At that point, it will be stable and suitable for production use.

- -

The preview media type is “application/vnd.github.manifold-preview”. Manifold is -a member of the Avengers, with the ability to teleport through time and space. He’s the one in the middle holding the spear.

- -

Manifold teleporting the Avengers to a terraformed Mars surface

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-09-28-an-update-on-the-new-search-api/index.html b/changes/2013-09-28-an-update-on-the-new-search-api/index.html deleted file mode 100644 index 80edc978be..0000000000 --- a/changes/2013-09-28-an-update-on-the-new-search-api/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - An Update on the New Search API - - - - - - - - - - - -
- -
- -
-
-
-

- An Update on the New Search API -

- -
- -
- - -

We owe a big “Thank You!” to everyone that has taken the time to try out the new Search API. -We :heart: every one of you. -Just as we hoped, -the preview period has allowed us to see how you want to use the new API, -and it has given us a chance to improve the API before finalizing it.

- -

In order to incorporate everything that we’ve learned, -we’re going to keep the Search API in preview mode for a little while longer. -We have a few bugs to squash and a couple performance kinks to iron out. -We’re hard at work on those improvements now, -and we expect to have more news in the coming weeks.

- -

In the mean time, keep the suggestions coming!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-10-04-oauth-changes-coming/index.html b/changes/2013-10-04-oauth-changes-coming/index.html deleted file mode 100644 index ded9071bed..0000000000 --- a/changes/2013-10-04-oauth-changes-coming/index.html +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - OAuth changes coming - - - - - - - - - - - -
- -
- -
-
-
-

- OAuth changes coming -

- -
-
    -
  • - - October 4, 2013 - -
  • -
  • - - tclem -
  • -
-
- - -

Starting today, we are returning granted scopes as part of the -access_token response. -For example, if you are making a POST with the application/json -mime-type you’ll see an additional field for the granted scopes.

- -
{
-  "access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a",
-  "scope":"repo,gist",
-  "token_type":"bearer"
-}
- -

Right now, these scopes will be identical to what you requested, but we -are moving towards a feature set that will allow GitHub users to edit -their scopes, effectively granting your application less access than you -originally requested. You should be aware of this possibility and adjust -your application behavior accordingly.

- -

Some things to watch out for and keep in mind:

- -
    -
  • -

    Most third party applications using GitHub OAuth to identify users have -the best success in adoption by starting out with a request for the -minimum access that the application can possibly get away with. -Something like no scopes or just user:email is very sane.

    -
  • -
  • -

    It is important to handle the error cases where a user chooses to -grant you less access than you originally requested. Now that we are -surfacing the granted scopes on the access_token response, applications -can warn or otherwise communicate with their users that they will see -reduced functionality or be unable to perform some actions.

    -
  • -
  • -

    Applications can always send users back through the flow again to get -additional permission, but don’t forget that users can always say no.

    -
  • -
- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-10-08-list-all-user-teams/index.html b/changes/2013-10-08-list-all-user-teams/index.html deleted file mode 100644 index bb18e41ded..0000000000 --- a/changes/2013-10-08-list-all-user-teams/index.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - List all teams for the authenticated user - - - - - - - - - - - -
- -
- -
-
-
-

- List all teams for the authenticated user -

- -
-
    -
  • - - October 8, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- - -

We just added a new API method to list all -the teams for the authenticated user across all organizations:

- -
-$ curl -H "Authorization: token [yours]" https://api.github.com/user/teams
-
-[
-  {
-    "name": "Testing",
-    "id": 396018,
-    "slug": "testing",
-    "permission": "pull",
-    "url": "https://api.github.com/teams/396018",
-    "members_url": "https://api.github.com/teams/396018/members{/member}",
-    "repositories_url": "https://api.github.com/teams/396018/repos",
-    "members_count": 1,
-    "repos_count": 0,
-    "organization": {
-      "login": "dotfiles",
-      "id": 1593590,
-      "url": "https://api.github.com/orgs/dotfiles",
-      "repos_url": "https://api.github.com/orgs/dotfiles/repos",
-      "events_url": "https://api.github.com/orgs/dotfiles/events",
-      "members_url": "https://api.github.com/orgs/dotfiles/members{/member}",
-      "public_members_url": "https://api.github.com/orgs/dotfiles/public_members{/member}",
-      "avatar_url": "https://0.gravatar.com/avatar/67d30facf213f62853c119fc2a05e246?d=https%3A%2F%2Fidenticons.github.com%2Fc90a68e6ab739e81c642f0e93f88c722.png"
-    }
-  },
-  ...
-]
-
- -

As always, if you have any questions or feedback, please drop us a line.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-10-18-new-code-search-requirements/index.html b/changes/2013-10-18-new-code-search-requirements/index.html deleted file mode 100644 index bb185d89fb..0000000000 --- a/changes/2013-10-18-new-code-search-requirements/index.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - New Validation Rule for Beta Code Search API - - - - - - - - - - - -
- -
- -
-
-
-

- New Validation Rule for Beta Code Search API -

- -
- -
- - -

As we prepare to end the preview period for the new search API, -we’re making sure that it’s ready to handle the traffic from all the apps you’ll build on top of it.

- -

New Validation Rule

- -

In order to support the expected volume of requests, we’re applying a new validation rule to the Code Search API. -Starting today, you will need to scope your code queries to a specific set of users, organizations, or repositories.

- -

As usual, you specify the query via the q parameter. -The value must include at least one user, organization, or repository.

- -

For example, with this query, we’re searching for code from @twitter or @facebook that uses an MIT License:

- -
MIT License user:twitter user:facebook
-
- -

And here, we’re looking for uses of the underscore library in @mozilla’s BrowserQuest repository:

- -
underscore language:js repo:mozilla/BrowserQuest
-
- -

To perform these queries via the API, we would use the following URLs (respectively):

- -
https://api.github.com/search/code?q=MIT+License+user%3Atwitter+user%3Afacebook
-
-https://api.github.com/search/code?q=underscore+language%3Ajs+repo%3Amozilla%2FBrowserQuest
-
- -

All the various code search qualifiers are still available to you. -A user, organization, or repository qualifier is now required. -The other search qualifiers are still optional.

- -

Other Search Types Not Affected

- -

This new validation only applies to the Code Search API. -It does not apply to the Search API for issues, users, or repositories.

- -

This validation does not affect searches performed on github.com/search.

- -

By ensuring that code queries are more targeted in nature, the API will be ready to meet the expected demand from all your apps. -As we continue to tune the Search API, we hope to relax this validation in the future. -There’s no ETA, but we’d like to relax it as soon as it’s feasible.

- -

As always, if you have any questions or feedback, please get in touch.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3/index.html b/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3/index.html deleted file mode 100644 index ec85449496..0000000000 --- a/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3/index.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - Search API Becomes an Official Part of API v3 - - - - - - - - - - - -
- -
- -
-
-
-

- Search API Becomes an Official Part of API v3 -

- -
- -
- - -

We’re excited to announce that the new Search API has graduated from preview mode. -As of today, the Search API is an official part of GitHub API v3. -As such, the Search API is now stable and suitable for production use.

- -

Preview Media Type No Longer Needed

- -

If you used the Search API during the preview period, you needed to provide a custom media type in the Accept header:

- -
application/vnd.github.preview+json
-
- -

Now that the preview period has ended, you no longer need to pass this custom media type.

- -

Instead, we recommend that you specify v3 as the version in the Accept header:

- -
application/vnd.github.v3+json
-
- -

Onward!

- -

Thanks again to everyone that tried out the Search API during the preview period.

- -

We can’t wait to see what you build!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-11-04-releases-api-is-official/index.html b/changes/2013-11-04-releases-api-is-official/index.html deleted file mode 100644 index 441acc2798..0000000000 --- a/changes/2013-11-04-releases-api-is-official/index.html +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - Releases API is Official - - - - - - - - - - - -
- -
- -
-
-
-

- Releases API is Official -

- -
- -
- - -

Hot on the heels of the Search API, the Releases API -is now officially part of GitHub API v3. We now consider it stable for -production use.

- -

Preview Media Type No Longer Needed

- -

If you used the Releases API during the preview period, you needed to provide a custom media type in the Accept header:

- -
application/vnd.github.manifold-preview+json
-
- -

Now that the preview period has ended, you no longer need to pass this custom media type.

- -

Instead, we recommend that you specify v3 as the version in the Accept header:

- -
application/vnd.github.v3+json
-
- -

Onward!

- -

Thanks again to everyone that tried out the Releases API during the preview period. -We got some great feedback, and we are already discussing additions to the API.

- -

We can’t wait to see what you ship!

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-12-13-paginating-org-members/index.html b/changes/2013-12-13-paginating-org-members/index.html deleted file mode 100644 index 09bd0fc691..0000000000 --- a/changes/2013-12-13-paginating-org-members/index.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - Paginated results for organization members - - - - - - - - - - - -
- -
- -
-
-
-

- Paginated results for organization members -

- -
-
    -
  • - - December 13, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- - -

The organization members and organization public members methods will soon return paginated results by default. Beginning -today, these methods will paginate if you include page or per_page query -parameters. Starting January 15th, 2014, these methods will always return paginated -results.

- -

As always, be sure and follow those Link headers to get -subsequent results. If you have any questions or run into trouble, feel free to -get in touch.

- -

Happy paginating.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-2-13-hookshot-issues/index.html b/changes/2013-2-13-hookshot-issues/index.html deleted file mode 100644 index c405cdc91d..0000000000 --- a/changes/2013-2-13-hookshot-issues/index.html +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - Some Hookshot Issues - - - - - - - - - - - -
- -
- -
-
-
-

- Some Hookshot Issues -

- -
- -
- - -

We turned Hookshot (our new GitHub Services backend) on yesterday. Things have -been pretty smooth, with one issue: Hooks going to other EC2 nodes come from -the private IP addresses of our nodes in the 10...* range.

- -

If your web hook servers are on EC2 and are missing hooks from GitHub due to -an IP restriction, we recommend the following:

- -
    -
  1. Remove the IP white list.
  2. -
  3. Fall back to HTTPS and Basic Auth to restrict pushes to authorized senders only.
  4. -
- -

We’re currently working on solving this problem. Hit up support@github.com -if you have any questions.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-2-13-hookshot-load-balancer/index.html b/changes/2013-2-13-hookshot-load-balancer/index.html deleted file mode 100644 index b493ba5226..0000000000 --- a/changes/2013-2-13-hookshot-load-balancer/index.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - Hookshot Load balancer - - - - - - - - - - - -
- -
- -
-
-
-

- Hookshot Load balancer -

- -
- -
- - -

We had an issue with the Hookshot load balancer this morning, causing the -majority of hooks to flow to a single node only. This lead to massive queue -times. While fixing this, we’re putting the old Services backend in use.

- -

This means the old IPs are back in use. Use this Help guide -if you already removed them from your firewall.

- -
- -
- - -
- - - - - - - - diff --git a/changes/2013-2-13-sortable-stars/index.html b/changes/2013-2-13-sortable-stars/index.html deleted file mode 100644 index 0a21d748e9..0000000000 --- a/changes/2013-2-13-sortable-stars/index.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - Sortable Stars in Repository Starring API - - - - - - - - - - - -
- -
- -
-
-
-

- Sortable Stars in Repository Starring API -

- -
-
    -
  • - - February 14, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- - -

As we announced on the GitHub blog, Stars now support sorting. The -Repository Starring API now supports two new parameters when listing -Stars: sort and direction.

- -
-curl https://api.github.com/users/defunkt/starred?sort=created&direction=asc
-
- -

Enjoy.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-2-5-changes-to-services/index.html b/changes/2013-2-5-changes-to-services/index.html deleted file mode 100644 index 50b4567095..0000000000 --- a/changes/2013-2-5-changes-to-services/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - Upcoming Changes to GitHub Services - - - - - - - - - - - -
- -
- -
-
-
-

- Upcoming Changes to GitHub Services -

- -
- -
- - -

We are finishing up a new GitHub Services backend, dubbed “Hookshot”, to -increase the speed and reliability of our delivered payloads. We are doing -what we can to make this a seamless transition for everyone. However, there -are a few notable changes.

- -
    -
  • -

    There is a new Meta API endpoint -listing the current public IPs that hooks originate from.

    -
  • -
  • -

    We’re removing the AMQP service from GitHub. It hasn’t worked in quite some -time, and the code it uses doesn’t work in our background workers.

    -
  • -
  • -

    We’re also instituting a new guideline to improve the reliability and -maintainability of services in the future. As of today, all new services must -accept an unmodified payload over HTTP. Any service that does not will be -rejected. To see an example of an acceptable service, check out Code Climate. -Notice their service simply accepts HTTP POST from GitHub unmodified. For an -example of a service that won’t be accepted after today, check out Campfire. It -uses other Ruby gems and contains custom logic to transform the GitHub payload -to Campfire messages. Existing hooks will keep working (don’t worry 37signals, we -:heart: Campfire).

    -
  • -
- -

We’re making these changes because we want to focus on the reliability of the -core Services backend for everyone. Maintaining custom logic and libraries for -over 100 services is taking too much of this focus away.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2013-3-1-new-hookshot-coming/index.html b/changes/2013-3-1-new-hookshot-coming/index.html deleted file mode 100644 index 09f053dbc3..0000000000 --- a/changes/2013-3-1-new-hookshot-coming/index.html +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - New Hookshot Changes - - - - - - - - - - - -
- -
- -
-
-
-

- New Hookshot Changes -

- -
- -
- - -

We are experimenting with changes to the “Hookshot” backend that powers service -hooks. There were some significant networking changes with the new cluster, -so there are some new IP whitelist rules for hooks:

- -
    -
  • 204.232.175.64/27
  • -
  • 192.30.252.0/22
  • -
- -

These are in CIDR notation. They represent a significant range of GitHub -addresses, meaning this should be the last IP change for a while. Once this -cluster is activated and we shut the other cluster down, we will be removing -the other entries.

- -

We are currently testing the new backend with all repositories in the GitHub -organization only, and expect to start testing it with user data next week.

- -

This also means we should be able to start accepting GitHub Services pull -requests very soon :)

- -
- -
- - -
- - - - - - - - diff --git a/changes/2014-01-07-upcoming-change-to-default-media-type/index.html b/changes/2014-01-07-upcoming-change-to-default-media-type/index.html deleted file mode 100644 index feb71ebbd8..0000000000 --- a/changes/2014-01-07-upcoming-change-to-default-media-type/index.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - Upcoming Change to Default Media Type - - - - - - - - - - - -
- -
- -
-
-
-

- Upcoming Change to Default Media Type -

- -
- -
- - -

On April 15, 2014*, the GitHub API will start serving the v3 media type by default. The information below will help you determine whether your applications will be affected by this change. For affected applications, you’ll find tips below to help you smoothly navigate this change.

- -

What’s changing?

- -

A new default version

- -

There are two versions of the GitHub API: beta and v3. Today, requests receive the beta version by default. On April 15*, requests will begin receiving the v3 version by default.

- -

For the most part, beta and v3 are remarkably similar. There are just a few differences to keep in mind.

- -

A new default media type

- -

The version is one part of the media type. By default, the API provides the beta media type:

- -
application/vnd.github.beta+json
-
- -

On April 15*, requests will begin responding with the v3 media type by default:

- -
application/vnd.github.v3+json
-
- -

Who is affected?

- -

Since 2012, we have encouraged developers to explicitly request a specific media type via the Accept header. If you are requesting either beta or v3 via the Accept header, then you are not affected by this change. The API will continue to respond with the requested media type.

- -

If you are not requesting beta or v3 via the Accept header, then the API is currently responding with the beta media type. On April 15*, the API will begin responding with the v3 media type. If your application relies on functionality that differs between beta and v3, then you are affected by this change. You will need to take steps to prepare for the change.

- -

What should you do?

- -

If you are affected by this change, we recommend that you:

- -
    -
  1. Update your applications to depend on the v3 functionality instead of the beta functionality. (If you use one of the popular client libraries, there’s a good chance that they’ve already done the work for you. In that case, you can just update to the latest version of that library.)
  2. -
  3. Request the v3 media type via the Accept header.
  4. -
- -

If you cannot update your application to depend on the v3 functionality by April 15*, you can just request the beta media type via the Accept header. Doing so will insulate you from this change.

- -

Cutover test on March 12, 2014

- -

To help you understand the impact of this change before it becomes permanent, we will temporarily implement this change for a single day on March 12. From approximately 12:01am UTC to 11:59pm UTC on March 12, the API will respond with the v3 media type by default.

- -

Follow @GitHubAPI to receive updates before and after the test.

- -

Stay informed

- -

Depending on the results of the cutover test, we may schedule additional tests before the final cutover on April 15. If so, we’ll to announce them in advance. Be sure to stay tuned to the blog or follow @GitHubAPI for updates.

- -

If you have any questions, please get in touch. We’ll be happy to help.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2014-01-09-preview-the-new-deployments-api/index.html b/changes/2014-01-09-preview-the-new-deployments-api/index.html deleted file mode 100644 index 63ad2c1b2b..0000000000 --- a/changes/2014-01-09-preview-the-new-deployments-api/index.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - Preview the New Deployments API - - - - - - - - - - - -
- -
- -
-
-
-

- Preview the New Deployments API -

- -
-
    -
  • - - January 9, 2014 - -
  • -
  • - - atmos -
  • -
-
- - -

Today we’re excited to announce a Deployments API. We ship a lot of -software at GitHub: web, mobile, and native. For the last few years, we’ve been -driving our deployments from our ChatOps tooling and we’ve learned a -lot. The Deployments API is a generalization of the approach that we’ve been -taking, and we’re really excited to see what our users and integrations start -building around it.

- -

Deployments are a new model in the GitHub ecosystem. We don’t have any UI -components currently, and deployments are intended to be used exclusively by -tooling. If you’re familiar with the Status API, you know that it allows -various tools to report on the status of a commit (e.g., the progress of an -attempt to perform a build at a particular commit). The Status API doesn’t -perform the build; it just reports the results. Much like the Status API, we -won’t be doing actual deployments for you. Instead, the API provides a way for -you to track the status of your deployments. We’re hoping to provide -consistency across the various type of release processes, regardless of the -underlying steps involved with getting your code built or shipped to your -servers.

- -

Highlights

- -

Automatic Merging

- -

The system can auto-merge the default branch for the repository if the -requested deployment ref is behind the default branch. On active projects it’s -easy to fall behind, so let automation watch your back.

- -

Commit Status Integration

- -

By default, the system rejects deployment requests for repositories that have -commit statuses but don’t have a green build for the deployment ref. This can -be bypassed, but is useful in cases where continuous integration is being used.

- -

Force Deployments

- -

Sometimes the world crashes down on you, and you need to just get the code out -the door. Forced deployments bypass any commit status checks or ahead/behind -checks in the repository.

- -

Deployment Statuses

- -

Different deployment systems can update the status of a deployment to be -pending, success, failure, or error. There’s also a field for linking -to deployment output.

- -

Events

- -

Both Deployments and Deployment Statuses trigger events on GitHub. 3rd party -integrations can listen for these events via webhooks and choose -whether or not to actually deploy the repository that the event was created for.

- -

Preview Period

- -

We’re making this new API available today for developers to -preview. We think developers and existing integrations are -going to love it, but we want to get your feedback before we declare -the Deployments API “final” and “unchangeable.” We expect the preview period to -last for roughly 60-90 days.

- -

As we discover opportunities to improve the API during the preview period, we -may ship changes that break clients using the preview version of the API. We -want to iterate quickly. To do so, we will announce any changes here (on the -developer blog), but we will not provide any advance notice.

- -

At the end of preview period, the Deployments API will become an official -component of GitHub API v3. At that point, the new Deployments API will be -stable and suitable for production use.

- -

We hope you’ll take it for a spin and send us your feedback.

- -

- - -
- -
- - -
- - - - - - - - diff --git a/changes/2014-01-29-audit-org-members-for-2fa/index.html b/changes/2014-01-29-audit-org-members-for-2fa/index.html deleted file mode 100644 index 4f9c3a17bc..0000000000 --- a/changes/2014-01-29-audit-org-members-for-2fa/index.html +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - Audit organization members for two-factor authentication - - - - - - - - - - - -
- -
- -
-
-
-

- Audit organization members for two-factor authentication -

- -
-
    -
  • - - January 29, 2014 - -
  • -
  • - - pengwynn -
  • -
-
- - -

We’ve added a new filter for listing members of an organization without -two-factor authentication enabled:

- -
-$ curl -H "Authorization: token [yours]" \
-       https://api.github.com/orgs/octokit/members\?filter\=2fa_disabled
-
- -

The new filter is available for owners of organizations with private -repositories. Happy auditing and send us your feedback or questions.

- - -
- -
- - -
- - - - - - - - diff --git a/changes/index.html b/changes/index.html deleted file mode 100644 index 1845228423..0000000000 --- a/changes/index.html +++ /dev/null @@ -1,2334 +0,0 @@ - - - - - - - - GitHub API Changes - - - - - - - - - - - -
- -
- -
-
- -
-

- Audit organization members for two-factor authentication -

- -
-
    -
  • - - January 29, 2014 - -
  • -
  • - - pengwynn -
  • -
-
- -

We’ve added a new filter for listing members of an organization without -two-factor authentication enabled:

- -
-$ curl -H "Authorization: token [yours]" \
-       https://api.github.com/orgs/octokit/members\?filter\=2fa_disabled
-
- -

The new filter is available for owners of organizations with private -repositories. Happy auditing and send us your feedback or questions.

- - -
- -
-

- Preview the New Deployments API -

- -
-
    -
  • - - January 9, 2014 - -
  • -
  • - - atmos -
  • -
-
- -

Today we’re excited to announce a Deployments API. We ship a lot of -software at GitHub: web, mobile, and native. For the last few years, we’ve been -driving our deployments from our ChatOps tooling and we’ve learned a -lot. The Deployments API is a generalization of the approach that we’ve been -taking, and we’re really excited to see what our users and integrations start -building around it.

- -

Deployments are a new model in the GitHub ecosystem. We don’t have any UI -components currently, and deployments are intended to be used exclusively by -tooling. If you’re familiar with the Status API, you know that it allows -various tools to report on the status of a commit (e.g., the progress of an -attempt to perform a build at a particular commit). The Status API doesn’t -perform the build; it just reports the results. Much like the Status API, we -won’t be doing actual deployments for you. Instead, the API provides a way for -you to track the status of your deployments. We’re hoping to provide -consistency across the various type of release processes, regardless of the -underlying steps involved with getting your code built or shipped to your -servers.

- -

Highlights

- -

Automatic Merging

- -

The system can auto-merge the default branch for the repository if the -requested deployment ref is behind the default branch. On active projects it’s -easy to fall behind, so let automation watch your back.

- -

Commit Status Integration

- -

By default, the system rejects deployment requests for repositories that have -commit statuses but don’t have a green build for the deployment ref. This can -be bypassed, but is useful in cases where continuous integration is being used.

- -

Force Deployments

- -

Sometimes the world crashes down on you, and you need to just get the code out -the door. Forced deployments bypass any commit status checks or ahead/behind -checks in the repository.

- -

Deployment Statuses

- -

Different deployment systems can update the status of a deployment to be -pending, success, failure, or error. There’s also a field for linking -to deployment output.

- -

Events

- -

Both Deployments and Deployment Statuses trigger events on GitHub. 3rd party -integrations can listen for these events via webhooks and choose -whether or not to actually deploy the repository that the event was created for.

- -

Preview Period

- -

We’re making this new API available today for developers to -preview. We think developers and existing integrations are -going to love it, but we want to get your feedback before we declare -the Deployments API “final” and “unchangeable.” We expect the preview period to -last for roughly 60-90 days.

- -

As we discover opportunities to improve the API during the preview period, we -may ship changes that break clients using the preview version of the API. We -want to iterate quickly. To do so, we will announce any changes here (on the -developer blog), but we will not provide any advance notice.

- -

At the end of preview period, the Deployments API will become an official -component of GitHub API v3. At that point, the new Deployments API will be -stable and suitable for production use.

- -

We hope you’ll take it for a spin and send us your feedback.

- -

- - -
- -
-

- Upcoming Change to Default Media Type -

- -
- -
- -

On April 15, 2014*, the GitHub API will start serving the v3 media type by default. The information below will help you determine whether your applications will be affected by this change. For affected applications, you’ll find tips below to help you smoothly navigate this change.

- -

What’s changing?

- -

A new default version

- -

There are two versions of the GitHub API: beta and v3. Today, requests receive the beta version by default. On April 15*, requests will begin receiving the v3 version by default.

- -

For the most part, beta and v3 are remarkably similar. There are just a few differences to keep in mind.

- -

A new default media type

- -

The version is one part of the media type. By default, the API provides the beta media type:

- -
application/vnd.github.beta+json
-
- -

On April 15*, requests will begin responding with the v3 media type by default:

- -
application/vnd.github.v3+json
-
- -

Who is affected?

- -

Since 2012, we have encouraged developers to explicitly request a specific media type via the Accept header. If you are requesting either beta or v3 via the Accept header, then you are not affected by this change. The API will continue to respond with the requested media type.

- -

If you are not requesting beta or v3 via the Accept header, then the API is currently responding with the beta media type. On April 15*, the API will begin responding with the v3 media type. If your application relies on functionality that differs between beta and v3, then you are affected by this change. You will need to take steps to prepare for the change.

- -

What should you do?

- -

If you are affected by this change, we recommend that you:

- -
    -
  1. Update your applications to depend on the v3 functionality instead of the beta functionality. (If you use one of the popular client libraries, there’s a good chance that they’ve already done the work for you. In that case, you can just update to the latest version of that library.)
  2. -
  3. Request the v3 media type via the Accept header.
  4. -
- -

If you cannot update your application to depend on the v3 functionality by April 15*, you can just request the beta media type via the Accept header. Doing so will insulate you from this change.

- -

Cutover test on March 12, 2014

- -

To help you understand the impact of this change before it becomes permanent, we will temporarily implement this change for a single day on March 12. From approximately 12:01am UTC to 11:59pm UTC on March 12, the API will respond with the v3 media type by default.

- -

Follow @GitHubAPI to receive updates before and after the test.

- -

Stay informed

- -

Depending on the results of the cutover test, we may schedule additional tests before the final cutover on April 15. If so, we’ll to announce them in advance. Be sure to stay tuned to the blog or follow @GitHubAPI for updates.

- -

If you have any questions, please get in touch. We’ll be happy to help.

- - -
- -
-

- Paginated results for organization members -

- -
-
    -
  • - - December 13, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- -

The organization members and organization public members methods will soon return paginated results by default. Beginning -today, these methods will paginate if you include page or per_page query -parameters. Starting January 15th, 2014, these methods will always return paginated -results.

- -

As always, be sure and follow those Link headers to get -subsequent results. If you have any questions or run into trouble, feel free to -get in touch.

- -

Happy paginating.

- - -
- -
-

- Releases API is Official -

- -
- -
- -

Hot on the heels of the Search API, the Releases API -is now officially part of GitHub API v3. We now consider it stable for -production use.

- -

Preview Media Type No Longer Needed

- -

If you used the Releases API during the preview period, you needed to provide a custom media type in the Accept header:

- -
application/vnd.github.manifold-preview+json
-
- -

Now that the preview period has ended, you no longer need to pass this custom media type.

- -

Instead, we recommend that you specify v3 as the version in the Accept header:

- -
application/vnd.github.v3+json
-
- -

Onward!

- -

Thanks again to everyone that tried out the Releases API during the preview period. -We got some great feedback, and we are already discussing additions to the API.

- -

We can’t wait to see what you ship!

- - -
- -
-

- Search API Becomes an Official Part of API v3 -

- -
- -
- -

We’re excited to announce that the new Search API has graduated from preview mode. -As of today, the Search API is an official part of GitHub API v3. -As such, the Search API is now stable and suitable for production use.

- -

Preview Media Type No Longer Needed

- -

If you used the Search API during the preview period, you needed to provide a custom media type in the Accept header:

- -
application/vnd.github.preview+json
-
- -

Now that the preview period has ended, you no longer need to pass this custom media type.

- -

Instead, we recommend that you specify v3 as the version in the Accept header:

- -
application/vnd.github.v3+json
-
- -

Onward!

- -

Thanks again to everyone that tried out the Search API during the preview period.

- -

We can’t wait to see what you build!

- - -
- -
-

- New Validation Rule for Beta Code Search API -

- -
- -
- -

As we prepare to end the preview period for the new search API, -we’re making sure that it’s ready to handle the traffic from all the apps you’ll build on top of it.

- -

New Validation Rule

- -

In order to support the expected volume of requests, we’re applying a new validation rule to the Code Search API. -Starting today, you will need to scope your code queries to a specific set of users, organizations, or repositories.

- -

As usual, you specify the query via the q parameter. -The value must include at least one user, organization, or repository.

- -

For example, with this query, we’re searching for code from @twitter or @facebook that uses an MIT License:

- -
MIT License user:twitter user:facebook
-
- -

And here, we’re looking for uses of the underscore library in @mozilla’s BrowserQuest repository:

- -
underscore language:js repo:mozilla/BrowserQuest
-
- -

To perform these queries via the API, we would use the following URLs (respectively):

- -
https://api.github.com/search/code?q=MIT+License+user%3Atwitter+user%3Afacebook
-
-https://api.github.com/search/code?q=underscore+language%3Ajs+repo%3Amozilla%2FBrowserQuest
-
- -

All the various code search qualifiers are still available to you. -A user, organization, or repository qualifier is now required. -The other search qualifiers are still optional.

- -

Other Search Types Not Affected

- -

This new validation only applies to the Code Search API. -It does not apply to the Search API for issues, users, or repositories.

- -

This validation does not affect searches performed on github.com/search.

- -

By ensuring that code queries are more targeted in nature, the API will be ready to meet the expected demand from all your apps. -As we continue to tune the Search API, we hope to relax this validation in the future. -There’s no ETA, but we’d like to relax it as soon as it’s feasible.

- -

As always, if you have any questions or feedback, please get in touch.

- - -
- -
-

- List all teams for the authenticated user -

- -
-
    -
  • - - October 8, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- -

We just added a new API method to list all -the teams for the authenticated user across all organizations:

- -
-$ curl -H "Authorization: token [yours]" https://api.github.com/user/teams
-
-[
-  {
-    "name": "Testing",
-    "id": 396018,
-    "slug": "testing",
-    "permission": "pull",
-    "url": "https://api.github.com/teams/396018",
-    "members_url": "https://api.github.com/teams/396018/members{/member}",
-    "repositories_url": "https://api.github.com/teams/396018/repos",
-    "members_count": 1,
-    "repos_count": 0,
-    "organization": {
-      "login": "dotfiles",
-      "id": 1593590,
-      "url": "https://api.github.com/orgs/dotfiles",
-      "repos_url": "https://api.github.com/orgs/dotfiles/repos",
-      "events_url": "https://api.github.com/orgs/dotfiles/events",
-      "members_url": "https://api.github.com/orgs/dotfiles/members{/member}",
-      "public_members_url": "https://api.github.com/orgs/dotfiles/public_members{/member}",
-      "avatar_url": "https://0.gravatar.com/avatar/67d30facf213f62853c119fc2a05e246?d=https%3A%2F%2Fidenticons.github.com%2Fc90a68e6ab739e81c642f0e93f88c722.png"
-    }
-  },
-  ...
-]
-
- -

As always, if you have any questions or feedback, please drop us a line.

- - -
- -
-

- OAuth changes coming -

- -
-
    -
  • - - October 4, 2013 - -
  • -
  • - - tclem -
  • -
-
- -

Starting today, we are returning granted scopes as part of the -access_token response. -For example, if you are making a POST with the application/json -mime-type you’ll see an additional field for the granted scopes.

- -
{
-  "access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a",
-  "scope":"repo,gist",
-  "token_type":"bearer"
-}
- -

Right now, these scopes will be identical to what you requested, but we -are moving towards a feature set that will allow GitHub users to edit -their scopes, effectively granting your application less access than you -originally requested. You should be aware of this possibility and adjust -your application behavior accordingly.

- -

Some things to watch out for and keep in mind:

- -
    -
  • -

    Most third party applications using GitHub OAuth to identify users have -the best success in adoption by starting out with a request for the -minimum access that the application can possibly get away with. -Something like no scopes or just user:email is very sane.

    -
  • -
  • -

    It is important to handle the error cases where a user chooses to -grant you less access than you originally requested. Now that we are -surfacing the granted scopes on the access_token response, applications -can warn or otherwise communicate with their users that they will see -reduced functionality or be unable to perform some actions.

    -
  • -
  • -

    Applications can always send users back through the flow again to get -additional permission, but don’t forget that users can always say no.

    -
  • -
- -
- -
-

- An Update on the New Search API -

- -
- -
- -

We owe a big “Thank You!” to everyone that has taken the time to try out the new Search API. -We :heart: every one of you. -Just as we hoped, -the preview period has allowed us to see how you want to use the new API, -and it has given us a chance to improve the API before finalizing it.

- -

In order to incorporate everything that we’ve learned, -we’re going to keep the Search API in preview mode for a little while longer. -We have a few bugs to squash and a couple performance kinks to iron out. -We’re hard at work on those improvements now, -and we expect to have more news in the coming weeks.

- -

In the mean time, keep the suggestions coming!

- - -
- -
-

- Releases API -

- -
- -
- -

This summer we made it easier to release your software. Today, you can fully automate those releases via the -Releases API Preview.

- -

This API is a little different due to the binary assets. We use the Accept header for content negotiation when requesting -a release asset. Pass a standard API media type to get the API representation:

- -
-$ curl -i -H "Authorization: token TOKEN" \
-     -H "Accept: application/vnd.github.manifold-preview" \
-     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
-
-HTTP/1.1 200 OK
-
-{
-  "id": 123,
-  ...
-}
-
- -

Pass “application/octet-stream” to download the binary content.

- -
-$ curl -i -H "Authorization: token TOKEN" \
-     -H "Accept: application/octet-stream" \
-     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
-
-HTTP/1.1 302 Found
-
- -

Uploads are handled by a single request to a companion “uploads.github.com” service.

- -
-$ curl -H "Authorization: token TOKEN" \
-     -H "Accept: application/vnd.github.manifold-preview" \
-     -H "Content-Type: application/zip" \
-     --data-binary @build/mac/package.zip \
-     "https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=1.0.0-mac.zip"
-
- -

Preview mode

- -

The new API is available as a preview. This gives developers a chance to provide feedback on the direction of -the API before we freeze changes. We expect to lift the preview status in 30 days.

- -

As with the Search API, we’ll take this opportunity to iterate quickly. Breaking changes will be announced -on this developer blog without any advance warning. Once the preview period is over, we’ll consider the Releases API unchangeable. -At that point, it will be stable and suitable for production use.

- -

The preview media type is “application/vnd.github.manifold-preview”. Manifold is -a member of the Avengers, with the ability to teleport through time and space. He’s the one in the middle holding the spear.

- -

Manifold teleporting the Avengers to a terraformed Mars surface

- - -
- -
-

- Two-Factor Authentication and the API -

- -
- -
- -

As announced earlier today, GitHub.com now supports two-factor -authentication (2FA) for increased security. For users with this feature -enabled, GitHub.com will prompt for a 2FA code in addition to a username and -password during authentication. We’ve also rolled out some improvements to the -API to ensure that 2FA requirements in the API are consistent with GitHub.com.

- -

Authenticating with the API

- -

For users without 2FA enabled, and for applications using the OAuth web -flow for authentication, everything is -business as usual. You’ll continue to authenticate with the API just as you -always have. (That was easy.)

- -

If you enable 2FA and use Basic Authentication to access the API, we’re -providing multiple options to make the flow simple and easy.

- -

Basic Authentication and 2FA

- -

Personal Access Tokens

- -

Personal access tokens provide the simplest option for using 2FA with Basic -Authentication. You can create these tokens via the application settings page -on GitHub.com, and you can revoke -them at any time. For more information about authenticating to the API with -personal access tokens, be sure to check out our help article on the -topic.

- -

Tightly-integrated 2FA

- -

For developers wishing to integrate GitHub 2FA directly into their application, -the API’s Basic Authentication now supports the ability to send the user’s 2FA -code, in addition to the username and password.

- -

We’re here to help

- -

We think GitHub users are going to love the additional security provided by -two-factor authentication. As always, if you have any questions or feedback, -let us know. We’re here to help!

- - -
- -
-

- Improvements to the Search API -

- -
- -
- -

Today we’re shipping two improvements to the new Search API.

- -

More Text Match Metadata

- -

When searching for code, the API previously provided text match metadata (i.e., “highlights”) for file content. -Now, you can also get this metadata for matches that occur within the file path.

- -

For example, when searching for files that have “client” in their path, the results include this match for lib/octokit/client/commits.rb:

- -
-{
-  "name": "commits.rb",
-  "path": "lib/octokit/client/commits.rb",
-  "text_matches": [
-    {
-      "object_url": "https://api.github.com/repositories/417862/contents/lib/octokit/client/commits.rb?ref=8d487ab06ccef463aa9f5412a56f1a2f1fa4dc88",
-      "object_type": "FileContent",
-      "property": "path",
-      "fragment": "lib/octokit/client/commits.rb",
-      "matches": [
-        {
-          "text": "client",
-          "indices": [ 12, 18 ]
-        }
-      ]
-    }
-  ]
-  // ...
-}
-
- -

Better Text Match Metadata

- -

Before today, the API applied HTML entity encoding to all fragment data. -For example, imagine your search returns an issue like rails/rails#11889:

- -

Example Issue Title

- -

The response would include a text_matches array with the following object:

- -
-{
-  "fragment": "undefined method `except' for #&lt;Array:XXX&gt;",
-  // ...
-}
-
- -

Inside the fragment value, we see HTML-encoded entities (e.g., &lt;). -Since we’re returning JSON (not HTML), API clients might not expect any HTML-encoded text. -As of today, the API returns these fragments without this extraneous encoding.

- -
-{
-  "fragment": "undefined method `except' for #<Array:XXX>",
-  // ...
-}
-
- -

Preview Period

- -

We’re about halfway through the preview period for the new Search API. -We appreciate everyone that has provided feedback so far. Please keep it coming!

- - -
- -
-

- Preview the New Search API -

- -
- -
- -

Today we’re excited to announce a brand new Search API. Whether you’re -searching for code, repositories, -issues, or users, all the query abilities of -github.com are now available via the API as well.

- -

Maybe you want to find popular Tetris implementations written in Assembly. -We’ve got you covered. -Or perhaps you’re looking for new gems that are using Octokit.rb. -No problem. -The possibilities are endless.

- -

Highlights

- -

On github.com, we enjoy the context provided by code snippets and highlights in -search results.

- -

code-snippet-highlighting

- -

We want API consumers to have access to that information as well. So, API -requests can opt to receive those -text fragments in the response. Each fragment is accompanied by -numeric offsets identifying the exact location of each matching search term.

- -

Preview period

- -

We’re making this new API available today for developers to -preview. We think developers are going to love it, but we want -to get your feedback before we declare the Search API “final” and -“unchangeable.” We expect the preview period to last for roughly 60 days.

- -

As we discover opportunities to improve this new API during the preview period, -we may ship changes that break clients using the preview version of the API. We -want to iterate quickly. To do so, we will announce any changes here (on the -developer blog), but we will not provide any advance notice.

- -

At the end of preview period, the Search API will become an official component -of GitHub API v3. At that point, the new Search API will be stable and suitable -for production use.

- -

What about the old search API?

- -

The legacy search API is still available. Many existing clients -depend on it, and it is not changing in any way. While the new API offers much -more functionality, the legacy search endpoints remain an official part of -GitHub API v3.

- -

Take it for a spin

- -

We hope you’ll kick the tires and send us your feedback. Happy -searching finding!

- - -
- -
-

- When Does My Rate Limit Reset? -

- -
- -
- -

Have you ever wondered when your rate limit will reset back to its maximum value? -That information is now available in the new X-RateLimit-Reset response header.

- -
-$ curl -I https://api.github.com/orgs/octokit
-
-HTTP/1.1 200 OK
-Status: 200 OK
-X-RateLimit-Limit: 60
-X-RateLimit-Remaining: 42
-X-RateLimit-Reset: 1372700873
-...
-
- -

The X-RateLimit-Reset header provides a Unix UTC timestamp, letting you know the exact time that your fresh new rate limit kicks in.

- -

The reset timestamp is also available as part of the /rate_limit resource.

- -
-$ curl https://api.github.com/rate_limit
-
-{
-  "rate": {
-    "limit": 60,
-    "remaining": 42,
-    "reset": 1372700873
-  }
-}
-
- -

For more information on rate limits, be sure to check out the docs.

- -

If you have any questions or feedback, please drop us a line.

- - -
- -
-

- Feeds API -

- -
-
    -
  • - - July 1, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- -

Today we’re releasing a new Feeds API, an easy way to list all the Atom -resources available to the authenticated user.

- -
-
-curl -u defunkt https://api.github.com/feeds
-
-{
-  "timeline_url": "https://github.com/timeline",
-  "user_url": "https://github.com/{user}",
-  "current_user_public_url": "https://github.com/defunkt",
-  "current_user_url": "https://github.com/defunkt.private?token=abc123",
-  "current_user_actor_url": "https://github.com/defunkt.private.actor?token=abc123",
-  "current_user_organization_url": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
-  "_links": {
-    "timeline": {
-      "href": "https://github.com/timeline",
-      "type": "application/atom+xml"
-    },
-    "user": {
-      "href": "https://github.com/{user}",
-      "type": "application/atom+xml"
-    },
-    "current_user_public": {
-      "href": "https://github.com/defunkt",
-      "type": "application/atom+xml"
-    },
-    "current_user": {
-      "href": "https://github.com/defunkt.private?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_actor": {
-      "href": "https://github.com/defunkt.private.actor?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_organization": {
-      "href": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
-      "type": "application/atom+xml"
-    }
-  }
-}
-
-
- -

If you have any questions or feedback, please drop us a line.

- - -
- -
-

- Create, update, and delete individual files -

- -
-
    -
  • - - May 6, 2013 - -
  • -
  • - - ymendel -
  • -
-
- -

We’re following in the footsteps of GitHub.com’s ability to edit and -create files in your web browser. Starting today, the -Repository Contents API will let you easily create, update, and even -delete individual files.

- -

Happy editing!

- - -
- -
-

- Repository Statistics -

- -
-
    -
  • - - May 6, 2013 - -
  • -
  • - - Caged -
  • -
-
- -

Today we’re happy to open our Repository Statistics API to everyone. We’re using -repository statistics to power our graphs, -but we can’t wait to see what others can do with this information.

- -

Starting today, these resources are available to you:

- - - -

Enjoy!

- -
- -
-

- Improved Support for Submodules in the Repository Contents API -

- -
- -
- -

When you view a repository with a submodule on github.com, you get useful links and information for the submodule.

- -

Repository Contents with Submodule

- -

Today we’re making that data available in the Repository Contents API.

- -
-curl https://api.github.com/repos/jquery/jquery/contents/test/qunit
-
-{
-  "name": "qunit",
-  "path": "test/qunit",
-  "type": "submodule",
-  "submodule_git_url": "git://github.com/jquery/qunit.git",
-  "sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "size": 0,
-  "url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
-  "git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-  "_links": {
-    "self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
-    "git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
-    "html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
-  }
-}
-
- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- - -
- -
-

- Commit Statuses Now Available for Branches and Tags -

- -
-
    -
  • - - April 30, 2013 - -
  • -
  • - - foca -
  • -
-
- -

Last week we announced support for build statuses in the branches page. -Now we are extending this to the API. The API endpoint for commit statuses -has been extended to allow branch and tag names, as well as commit SHAs.

- -
-curl https://api.github.com/repos/rails/rails/statuses/3-2-stable
-
- -

Enjoy.

- - -
- -
-

- Deprecating a Confusing Attribute in the Pull Request API -

- -
- -
- -

When you get the details for a Pull Request from the API, the -response provides everything there is to -know about that Pull Request. In addition to the useful information provided in -the API response, the JSON also includes the merge_commit_sha attribute. This -attribute is a frequent source of misunderstanding, and we aim to remove the -confusion.

- -

To help current API consumers, we’ve documented the -attribute for improved understanding.

- -

To protect future API consumers from this confusion, we have -deprecated the merge_commit_sha attribute, and we will -remove it in the next major version of the API.

- -

As always, if you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
-

- User Agent now mandatory -

- -
-
    -
  • - - April 24, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- -

After an almost six week grace period, we’re now enforcing the User Agent -header for all API requests. Most HTTP libraries (including cURL) -set this header by default. If you’re experiencing an increase in 403 -responses, be sure and check your code.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
-

- New Hookshot Changes -

- -
- -
- -

We are experimenting with changes to the “Hookshot” backend that powers service -hooks. There were some significant networking changes with the new cluster, -so there are some new IP whitelist rules for hooks:

- -
    -
  • 204.232.175.64/27
  • -
  • 192.30.252.0/22
  • -
- -

These are in CIDR notation. They represent a significant range of GitHub -addresses, meaning this should be the last IP change for a while. Once this -cluster is activated and we shut the other cluster down, we will be removing -the other entries.

- -

We are currently testing the new backend with all repositories in the GitHub -organization only, and expect to start testing it with user data next week.

- -

This also means we should be able to start accepting GitHub Services pull -requests very soon :)

- -
- -
-

- Sortable Stars in Repository Starring API -

- -
-
    -
  • - - February 14, 2013 - -
  • -
  • - - pengwynn -
  • -
-
- -

As we announced on the GitHub blog, Stars now support sorting. The -Repository Starring API now supports two new parameters when listing -Stars: sort and direction.

- -
-curl https://api.github.com/users/defunkt/starred?sort=created&direction=asc
-
- -

Enjoy.

- - -
- -
-

- Hookshot Load balancer -

- -
- -
- -

We had an issue with the Hookshot load balancer this morning, causing the -majority of hooks to flow to a single node only. This lead to massive queue -times. While fixing this, we’re putting the old Services backend in use.

- -

This means the old IPs are back in use. Use this Help guide -if you already removed them from your firewall.

- -
- -
-

- Some Hookshot Issues -

- -
- -
- -

We turned Hookshot (our new GitHub Services backend) on yesterday. Things have -been pretty smooth, with one issue: Hooks going to other EC2 nodes come from -the private IP addresses of our nodes in the 10...* range.

- -

If your web hook servers are on EC2 and are missing hooks from GitHub due to -an IP restriction, we recommend the following:

- -
    -
  1. Remove the IP white list.
  2. -
  3. Fall back to HTTPS and Basic Auth to restrict pushes to authorized senders only.
  4. -
- -

We’re currently working on solving this problem. Hit up support@github.com -if you have any questions.

- -
- -
-

- Upcoming Changes to GitHub Services -

- -
- -
- -

We are finishing up a new GitHub Services backend, dubbed “Hookshot”, to -increase the speed and reliability of our delivered payloads. We are doing -what we can to make this a seamless transition for everyone. However, there -are a few notable changes.

- -
    -
  • -

    There is a new Meta API endpoint -listing the current public IPs that hooks originate from.

    -
  • -
  • -

    We’re removing the AMQP service from GitHub. It hasn’t worked in quite some -time, and the code it uses doesn’t work in our background workers.

    -
  • -
  • -

    We’re also instituting a new guideline to improve the reliability and -maintainability of services in the future. As of today, all new services must -accept an unmodified payload over HTTP. Any service that does not will be -rejected. To see an example of an acceptable service, check out Code Climate. -Notice their service simply accepts HTTP POST from GitHub unmodified. For an -example of a service that won’t be accepted after today, check out Campfire. It -uses other Ruby gems and contains custom logic to transform the GitHub payload -to Campfire messages. Existing hooks will keep working (don’t worry 37signals, we -:heart: Campfire).

    -
  • -
- -

We’re making these changes because we want to focus on the reliability of the -core Services backend for everyone. Maintaining custom logic and libraries for -over 100 services is taking too much of this focus away.

- - -
- -
-

- User Agent mandatory from March 4th 2013 -

- -
-
    -
  • - - January 31, 2013 - -
  • -
  • - - agh -
  • -
-
- -

Following on from our previous post -about requiring requests to include a valid User Agent header -we will soon be changing our API servers to return HTTP 403 -to any clients not providing a valid User Agent header.

- -

We will be making this change on Monday, March 4th 2013.

- -

Setting this helps us identify requests from you, and get in touch with people who are using -the API in a way which causes disruption to GitHub. Most HTTP libraries and tools like cURL -already provide a valid header for you, and allow you to customize it, so this will not require -many of our users to make any changes whatsoever.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
-

- New User scopes -

- -
- -
- -

We’ve added a few new user scopes for 3rd party applications that want very -specific user functionality. The user:email scope gives apps read-only access -to a user’s private email addresses. The user:follow scope lets a user -follow and unfollow other users.

- -

This should help keep applications from requiring the user scope, which -can be potentially dangerous.

- -

We also added a read-only endpoint to get a user’s public SSH keys.

- -
GET https://api.github.com/users/technoweenie/keys
-
- - -
- -
-

- Diff and patch media types -

- -
-
    -
  • - - December 10, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

Starting today, you can get .diff and .patch content directly from the API for the following resources:

- - - -

Simply use the same resource URL and send either application/vnd.github.diff or application/vnd.github.patch in the Accept header:

- -
curl -H "Accept: application/vnd.github.diff" https://api.github.com/repos/pengwynn/dotfiles/commits/aee60a4cd56fb4c6a50e60f17096fc40c0d4d72c
-
-diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink
-index 1f599cb..abaf625 100755
---- a/tmux/tmux.conf.symlink
-+++ b/tmux/tmux.conf.symlink
-@@ -111,6 +111,7 @@ set-option -g base-index 1
- ## enable mouse
- set-option -g mouse-select-pane on
- set-option -g mouse-select-window on
-+set-option -g mouse-resize-pane on
- set-window-option -g mode-keys vi
- set-window-option -g mode-mouse on
- # set-window-option -g monitor-activity off
-
- - -
- -
-

- Pagination for Organization Repository lists now paginates properly -

- -
-
    -
  • - - December 9, 2012 - -
  • -
  • - - rick -
  • -
-
- -

- -

Improvements continue to the Organizations Repository listing endpoint. -Today we’re improving pagination so that it works as documented. Now -you can expect Link headers to navigate through the results space, -regardless of what you send in the type parameter.

- -

The docs for Organization Repositories queries are still here:

- - - -

EDIT: Link headers are our preferred navigation technique.

- -
- -
-

- Finding sources and fork repositories for organizations -

- -
-
    -
  • - - December 8, 2012 - -
  • -
  • - - rick -
  • -
-
- -

We’ve made a couple of changes today to the Organization repositories -listing to bring it a bit closer to the functionality of the GitHub.com -Organization repositories tab. We now let you retrieve repositories -which are forks of another repository, as well as those repositories which -are sources (not forks).

- -
# Grab all fork Repositories for an Organization
-curl "https://api.github.com/orgs/:org/repos?type=forks"
-
-# Grab all source Repositories for an Organization
-curl "https://api.github.com/orgs/:org/repos?type=sources"
-
- -

Check out the docs for sorting and filtering options:

- - - -
- -
-

- Create an OAuth authorization for an app -

- -
-
    -
  • - - December 6, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

The Authorizations API is an easy way to create an OAuth -authorization using Basic Auth. Just POST your desired scopes and optional -note and you get a token back:

- -
-    curl -u pengwynn -d '{"scopes": ["user", "gist"]}' \
-         https://api.github.com/authorizations
-
- -

This call creates a token for the authenticating user tied to a special “API” -OAuth application.

- -

We now support creating tokens for your own OAuth application by passing your -twenty character client_id and forty character client_secret as found in -the settings page for your OAuth application.

- -
-    curl -u pengwynn -d '{ \
-                          "scopes": ["user", "gist"], \
-                          "client_id": "abcdeabcdeabcdeabcdeabcde" \
-                          "client_secret": "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde" \
-                         }' \ '
-            https://api.github.com/authorizations
-
- -

No more implementing the web flow just to get a token tied to your -app’s rate limit.

- - -
- -
-

- Per-repository Review and Issue Comment listing -

- -
-
    -
  • - - December 4, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

You’ve always been able to grab all the commit comments for an entire -repository via the API, but to get Issue comments and Pull Request Review -Comments, you could only fetch the comments for a single Issue or Pull Request.

- -

Today, we’re introducing two new methods to grab all Issue Comments and Review -Comments for a repository.

- -
# Grab all Issue Comments
-curl https://api.github.com/repos/mathiasbynens/dotfiles/issues/comments
-
-# Grab all Review Comments
-curl https://api.github.com/repos/mathiasbynens/dotfiles/pulls/comments
-
- -

Check out the docs for sorting and filtering options:

- - - -
- -
-

- Gitignore Templates API -

- -
-
    -
  • - - November 29, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

We recently made it easy to initialize a repository when you create -it via the API. One of the options you can pass when creating a -repository is gitignore_template. This value is the name of one of the -templates from the the public GitHub .gitignore repository.

- -

The Gitignore Templates API makes it easy to list those templates:

- -
curl https://api.github.com/gitignore/templates
-
-HTTP/1.1 200 OK
-
-[
-  "Actionscript",
-  "Android",
-  "AppceleratorTitanium",
-  "Autotools",
-  "Bancha",
-  "C",
-  "C++",
-  ...
-
- -

If you’d like to view the source, you can also fetch a single template.

- -
curl -H 'Accept: application/vnd.github.raw' \
-     https://api.github.com/gitignore/templates/Objective-C
-
-HTTP/1.1 200 OK
-
-# Xcode
-.DS_Store
-build/
-*.pbxuser
-!default.pbxuser
-*.mode1v3
-!default.mode1v3
-*.mode2v3
-!default.mode2v3
-*.perspectivev3
-!default.perspectivev3
-*.xcworkspace
-!default.xcworkspace
-xcuserdata
-profile
-*.moved-aside
-DerivedData
-.idea/
-
- - -
- -
-

- Forking to Organizations -

- -
- -
- -

We made a slight change to the way you fork a repository. By default, you -can fork my repository through an HTTP POST to the repository’s fork resource.

- -
$ curl -X POST https://api.github.com/repos/technoweenie/faraday/forks
-
- -

This repository forks to your personal account. However, there are cases when -you want to fork to one of your organizations instead. The previous method -required a ?org query parameter:

- -
$ curl -X POST /repos/technoweenie/faraday/forks?org=mycompany
-
- -

Query parameters on POST requests are unusual in APIs, and definitely -inconsistent with the rest of the GitHub API. You should be able to post a -JSON body like every other POST endpoint. Now, you can! Only, now we’re -calling the field organization.

- -
$ curl /repos/technoweenie/faraday/forks?org=mycompany \
-  -d '{"organization": "mycompany"}'
-
- -

Don’t worry, we are committed to maintaining the legacy behavior until the next -major change of the GitHub API.

- -
- -
-

- Gist comment URIs -

- -
-
    -
  • - - October 31, 2012 - -
  • -
  • - - pezra -
  • -
-
- -

The URIs of all gist comments are changing immediately. The new URI pattern for gist comments is /gists/{gist-id}/comments/{id}. (See gist comments section of the docs for more details.) This change is necessary because the auto-incremented ids of gist comments are easy to guess. This predictability allows anyone to view comments on private Gists with relative ease. Obviously, comments on private gists should be just as private as the gist itself.

- -

Adding the gist id to the URI of comments makes it impossible, in practical terms, to guess that URI because the id of private gists are very large random numbers. This is, unfortunately, a breaking change but one that cannot be avoided because of the security implications of the current URIs. We apologize for the inconvenience.

- -

We have also added a comments_url member to the Gist documents. The comments_url link provides access to the comments of a Gist in a way that will insulate clients from changes in the URI patterns used by the GitHub API. We are increasing our use of links in order to make changes such as this one less damaging to clients. We strongly encourage using url and *_url properties, where possible, rather than constructing URIs using the patterns published on this site. Doing so will result in clients that break less often.

- -
- -
-

- Notifications API -

- -
- -
- -

Now that the dust has settled around Notifications and Stars, -we’ve unleashed all that :sparkles: in a brand new API. You can now -view and mark notifications as read.

- -

Endpoint

- -

The core notifications functionality is under the /notifications endpoint. -You can look for unread notifications:

- -
-$ curl https://api.github.com/notifications
-
- -

You can filter these notifications to a single Repository:

- -
-$ curl https://api.github.com/repos/technoweenie/faraday/notifications
-
- -

You can mark them as read:

- -
-# all notifications
-$ curl https://api.github.com/notifications \
-    -X PUT -d '{"read": true}'
-
-# notifications for a single repository
-$ curl https://api.github.com/repos/technoweenie/faraday/notifications \
-    -X PUT -d '{"read": true}'
-
- -

You can also modify subscriptions for a Repository or a single thread.

- -
-# subscription details for the thread (either an Issue or Commit)
-$ curl https://api.github.com/notifications/threads/1/subscription
-
-# subscription details for a whole Repository.
-$ curl https://api.github.com/repos/technoweenie/faraday/subscription
-
- -

Polling

- -

The Notifications API is optimized for polling by the last modified time:

- -
-# Add authentication to your requests
-$ curl -I https://api.github.com/notifications
-HTTP/1.1 200 OK
-Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
-X-Poll-Interval: 60
-
-# Pass the Last-Modified header exactly
-$ curl -I https://api.github.com/notifications
-    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
-HTTP/1.1 304 Not Modified
-X-Poll-Interval: 60
-
- -

You can read about the API details in depth in the Notifications documentation.

- -
- -
-

- Set the default branch for a repository -

- -
-
    -
  • - - October 24, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

You can set the default branch for a repository to something other than ‘master’ from the GitHub repository admin screen:

- -

repo admin

- -

Now, you can update this setting via the API. We’ve added a default_branch parameter to the Edit Repository method:

- -
-curl -u pengwynn \
-     -d '{"name": "octokit", "default_branch":"development"}' \
-     https://api.github.com/repos/pengwynn/octokit
-
- -

If you provide a branch name that hasn’t been pushed to GitHub, we’ll gracefully fall back to 'master' or the first branch.

- - -
- -
-

- Organization Members Resource Changes -

- -
-
    -
  • - - October 17, 2012 - -
  • -
  • - - pezra -
  • -
-
- -

Requesting the member list of an -organization of which you are not a member now redirects to the public members -list. Similarly, requests to -membership check resources of -an organization of which you are not a member are redirected to the equivalent -public membership check. -One exception to the latter case is that if you are checking about your own -membership the request is not redirected. You are always allowed to know what -organizations you belong to.

- -

The changes where made to clarify the purpose of these various resources. The -/orgs/:org/members resources are intended for use by members of the -organization in question. The /orgs/:org/public_members resources are for -acquiring information about the public membership of organizations. If you are -not a member you are not allowed to see private membership information so you -should be using the public membership resources.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
-

- Rate limit changes for unauthenticated requests -

- -
-
    -
  • - - October 14, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

To ensure a high quality of service for all API consumers, we’ve reduced the -default rate limit for unauthenticated requests. To enjoy the default rate -limit of 5,000 requests per hour, you’ll need to -authenticate via Basic Auth -or OAuth. Unauthenticated requests will be limited to 60 per hour unless you -include your OAuth client and -secret.

- -

We’ll soon require all requests to include a valid User Agent -header. Setting a -unique value for this header helps us identify requests and get in touch with -developers who are abusing the API. Most HTTP libraries, wrapper libraries, and -even cURL provide a valid header for you already and allow you to change it to -something unique to your application.

- -

If you have any questions or feedback, please drop us a line at -support@github.com.

- -
- -
-

- Initialize a repository when creating -

- -
-
    -
  • - - September 28, 2012 - -
  • -
  • - - pengwynn -
  • -
-
- -

Today we’ve made it easier to add commits to a repository via the GitHub API. -Until now, you could create a repository, but you would -need to initialize it locally via your Git client before adding any commits via -the API.

- -

Now you can optionally init a repository when it’s created by sending true -for the auto_init parameter:

- -
-curl -i -u pengwynn \
-     -d '{"name": "create-repo-test", "auto_init": true}' \
-     https://api.github.com/user/repos
-
- -

The resulting repository will have a README stub and an initial commit.

- -

create repo screenshot

- -

.gitignore templates

- -

Along with this change, you can set up your .gitignore template by passing -the basename of any template in the GitHub gitignore templates -project.

- -
-curl -i -u pengwynn \
-     -d '{"name": "create-repo-test", "auto_init": true, \
-          "gitignore_template": "Haskell"}' \
-     https://api.github.com/user/repos
-
- -

As the docs point out, the gitignore_template parameter -is ignored if auto_init is not present and true.

- -

If you have any questions or feedback, drop us a line at -https://github.com/contact, support@github.com, or -@GitHubAPI.

- - -
- -
-

- Upcoming Changes to Watcher and Star APIs -

- -
- -
- -

We recently changed the Watcher behavior on GitHub. What -used to be known as “Watching” is now “Starring”. Starring is basically a way -to bookmark interesting repositories. Watching is a way to indicate that you -want to receive email or web notifications on a Repository.

- -

This works well on GitHub.com, but poses a problem for the GitHub API. How do -we change this in a way that developers can gracefully upgrade their -applications? We’re currently looking at rolling out the changes in three -phases over an extended period of time.

- -

Current Status

- -

The current Repository Starring methods look like this:

- -
    -
  • -/repos/:owner/:repo/watchers - A list of users starring the repository.
  • -
  • -/users/:user/watched - A list of repositories that a user has starred.
  • -
  • -/user/watched - A list of repositories the current user has starred.
  • -
- -

Phase 1: Add Watchers as Subscriptions

- -

This phase exposes Watchers as “Subscriptions”. This is to -keep from clashing with the legacy endpoints. This phase will happen -automatically and will not break your application until Phase 3 starts. -(UPDATE: API v3 will continue to support this functionality indefinitely.)

- -
    -
  • -/repos/:owner/:repo/subscribers - A list of users watching the repository.
  • -
  • -/users/:user/subscriptions - A list of repositories that a user is watching.
  • -
  • -/user/subscriptions - A list of repositories the current user is watching.
  • -
- -

We’ll also add a copy of the legacy Watchers API in the new endpoint:

- -
    -
  • -/repos/:owner/:repo/stargazers - A list of users starring the repository.
  • -
  • -/users/:user/starred - A list of repositories that a user has starred.
  • -
  • -/user/starred - A list of repositories the current user has starred.
  • -
- -

This is in place now with the current media type for the API:

- -
application/vnd.github.beta+json
-
- -

If you care about your application not breaking, make sure all outgoing API -requests pass that value for the “Accept” header. You should do this now. This -can be verified by checking the X-GitHub-Media-Type header on all API -responses.

- -
# Accesses a user's starred repositories.
-curl https://api.github.com/user/watched \
-  -H "Accept: application/vnd.github.beta+json"
-
- -

-This Phase will be broken once Phase 3 starts. Phase 3 removes all support for -the "beta" media type, and makes the "v3" media type the implicit default -for API requests.

- -

UPDATE - November 6, 2013

- -
-

- API v3 will continue to officially support the functionality described in - Phase 1 above. This functionality will remain intact for the lifetime of - API v3. -

-

- API v3 will not include Phases 2 and 3 (below). Those phases will - likely be part of the next major version of the API. (We have not announced - a timeline for the next major version of the API.) -

-
- -

Phase 2: Switch /watchers API Endpoint

- -The "watch" endpoints will now be a copy of the "subscription" endpoints. You -will have to use /user/starred to get a user's starred repositories, not -/user/watched. - -This requires a new media type value: - -
application/vnd.github.v3+json
- -This is a breaking change from Phase 1. We will release this change in an -experimental mode first, letting developers gracefully upgrade their -applications by specifying the new media value for the Accept header. - - -
-# Accesses a user's watched repositories.
-curl https://api.github.com/user/watched \
-  -H "Accept: application/vnd.github.v3+json"
-
-
- -

Phase 3: Remove /subscribers API Endpoint.

- -This phase involves disabling the subscription endpoints completely. At this -point, you should be using the starring endpoints for starred repositories, and -the watch endpoints for watched repositories. No date has been set yet, but we -expect this to be 3-6 months after Phase 2 is in place. This should give -developers enough time for a smooth upgrade path. If they use popular API -wrappers, the work will likely mostly be done for them. - -Keep on passing the "v3" media type in your application, until the API has -another breaking change to make. If you can't make the deadline for Phase 3, -just set the "beta" media type until we shut that down completely. It's likely -that we will keep the old "beta" media type active for another month, like -the last time we terminated -old API functionality. - -

We look forward to assisting you through this transition. Hit us up at -https://github.com/contact, support@github.com, or -@GitHubAPI.

- - -
- - -
- - -
- - - - - - - - diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000000..b2a6c6213a --- /dev/null +++ b/config.yaml @@ -0,0 +1,56 @@ +# A list of file extensions that nanoc will consider to be textual rather than +# binary. If an item with an extension not in this list is found, the file +# will be considered as binary. +text_extensions: [ 'css', 'erb', 'haml', 'htm', 'html', 'js', 'less', 'markdown', 'md', 'php', 'rb', 'sass', 'scss', 'txt', 'xhtml', 'xml', 'atom' ] + +# The path to the directory where all generated files will be written to. This +# can be an absolute path starting with a slash, but it can also be path +# relative to the site directory. +output_dir: output + +# A list of index filenames, i.e. names of files that will be served by a web +# server when a directory is requested. Usually, index files are named +# “index.hml”, but depending on the web server, this may be something else, +# such as “default.htm”. This list is used by nanoc to generate pretty URLs. +index_filenames: [ 'index.html' ] + +# Whether or not to generate a diff of the compiled content when compiling a +# site. The diff will contain the differences between the compiled content +# before and after the last site compilation. +enable_output_diff: false + +# The data sources where nanoc loads its data from. This is an array of +# hashes; each array element represents a single data source. By default, +# there is only a single data source that reads data from the “content/” and +# “layout/” directories in the site directory. +data_sources: + - + # The type is the identifier of the data source. By default, this will be + # `filesystem_unified`. + type: filesystem_unified + + # The path where items should be mounted (comparable to mount points in + # Unix-like systems). This is “/” by default, meaning that items will have + # “/” prefixed to their identifiers. If the items root were “/en/” + # instead, an item at content/about.html would have an identifier of + # “/en/about/” instead of just “/about/”. + items_root: / + + # The path where layouts should be mounted. The layouts root behaves the + # same as the items root, but applies to layouts rather than items. + layouts_root: / + + - + type: static + items_root: /static + +# For the atom feed. +base_url: http://developer.github.com + +# Array of [version, released_at] Array tuples. +api_versions: + - + - beta + - 2011-4-27 + - + - v3 diff --git a/content/CNAME b/content/CNAME new file mode 100644 index 0000000000..82c2e93c12 --- /dev/null +++ b/content/CNAME @@ -0,0 +1 @@ +developer.github.com diff --git a/content/changes/2012-10-14-rate-limit-changes.html b/content/changes/2012-10-14-rate-limit-changes.html new file mode 100644 index 0000000000..5833343491 --- /dev/null +++ b/content/changes/2012-10-14-rate-limit-changes.html @@ -0,0 +1,24 @@ +--- +kind: change +title: Rate limit changes for unauthenticated requests +created_at: 2012-10-14 +author_name: pengwynn +--- + +To ensure a high quality of service for all API consumers, we've reduced the +default rate limit for unauthenticated requests. To enjoy the default rate +limit of 5,000 requests per hour, you'll need to +[authenticate](http://developer.github.com/v3/#authentication) via Basic Auth +or OAuth. Unauthenticated requests will be limited to 60 per hour unless you +[include your OAuth client and +secret](http://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications). + +We'll soon require all requests to include a valid [User Agent +header](http://en.wikipedia.org/wiki/User_agent). Setting a +unique value for this header helps us identify requests and get in touch with +developers who are abusing the API. Most HTTP libraries, wrapper libraries, and +even cURL provide a valid header for you already and allow you to change it to +something unique to your application. + +If you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=API Rate limit). diff --git a/content/changes/2012-10-17-org-members-redirection.md b/content/changes/2012-10-17-org-members-redirection.md new file mode 100644 index 0000000000..6b8a3f54da --- /dev/null +++ b/content/changes/2012-10-17-org-members-redirection.md @@ -0,0 +1,26 @@ +--- +kind: change +title: Organization Members Resource Changes +created_at: 2012-10-17 +author_name: pezra +--- + +Requesting the [member list](/v3/orgs/members/index.html#members-list) of an +organization of which you are not a member now redirects to the [public members +list](/v3/orgs/members/index.html#public-members-list). Similarly, requests to +[membership check](/v3/orgs/members/index.html#check-membership) resources of +an organization of which you are not a member are redirected to the equivalent +[public membership check](/v3/orgs/members/index.html#check-public-membership). +One exception to the latter case is that if you are checking about your own +membership the request is not redirected. You are always allowed to know what +organizations you belong to. + +The changes where made to clarify the purpose of these various resources. The +`/orgs/:org/members` resources are intended for use by members of the +organization in question. The `/orgs/:org/public_members` resources are for +acquiring information about the public membership of organizations. If you are +not a member you are not allowed to see private membership information so you +should be using the public membership resources. + +If you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=Org members API). diff --git a/content/changes/2012-10-24-set-default-branch.html b/content/changes/2012-10-24-set-default-branch.html new file mode 100644 index 0000000000..3e438e90f3 --- /dev/null +++ b/content/changes/2012-10-24-set-default-branch.html @@ -0,0 +1,22 @@ +--- +kind: change +title: Set the default branch for a repository +created_at: 2012-10-24 +author_name: pengwynn +--- + +You can set the default branch for a repository to something other than 'master' from the GitHub repository admin screen: + +![repo admin](/images/posts/default-branch.png) + +Now, you can update this setting via the API. We've added a `default_branch` parameter to the [Edit Repository method][edit-repo]: + +
+curl -u pengwynn \
+     -d '{"name": "octokit", "default_branch":"development"}' \
+     https://api.github.com/repos/octokit/octokit.rb
+
+ +If you provide a branch name that hasn't been pushed to GitHub, we'll gracefully fall back to `'master'` or the first branch. + +[edit-repo]: /v3/repos/#edit diff --git a/content/changes/2012-10-26-notifications-api.md b/content/changes/2012-10-26-notifications-api.md new file mode 100644 index 0000000000..6d1e6bd3e4 --- /dev/null +++ b/content/changes/2012-10-26-notifications-api.md @@ -0,0 +1,72 @@ +--- +kind: change +title: Notifications API +created_at: 2012-10-26 +author_name: technoweenie +--- + +Now that the dust has settled around [Notifications and Stars][newsies], +we've unleashed all that :sparkles: in a [brand new API][api]. You can now +view and mark notifications as read. + +[api]: http://developer.github.com/v3/activity/notifications/ +[newsies]: https://github.com/blog/1204-notifications-stars + +## Endpoint + +The core notifications functionality is under the `/notifications` endpoint. +You can look for unread notifications: + +
+$ curl https://api.github.com/notifications
+
+ +You can filter these notifications to a single Repository: + +
+$ curl https://api.github.com/repos/technoweenie/faraday/notifications
+
+ +You can mark them as read: + +
+# all notifications
+$ curl https://api.github.com/notifications \
+    -X PUT -d '{"read": true}'
+
+# notifications for a single repository
+$ curl https://api.github.com/repos/technoweenie/faraday/notifications \
+    -X PUT -d '{"read": true}'
+
+ +You can also modify subscriptions for a Repository or a single thread. + +
+# subscription details for the thread (either an Issue or Commit)
+$ curl https://api.github.com/notifications/threads/1/subscription
+
+# subscription details for a whole Repository.
+$ curl https://api.github.com/repos/technoweenie/faraday/subscription
+
+ +## Polling + +The Notifications API is optimized for polling by the last modified time: + +
+# Add authentication to your requests
+$ curl -I https://api.github.com/notifications
+HTTP/1.1 200 OK
+Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
+X-Poll-Interval: 60
+
+# Pass the Last-Modified header exactly
+$ curl -I https://api.github.com/notifications
+    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
+HTTP/1.1 304 Not Modified
+X-Poll-Interval: 60
+
+ +You can read about the API details in depth in the [Notifications documentation][api]. + + diff --git a/content/changes/2012-10-31-gist-comment-uris.md b/content/changes/2012-10-31-gist-comment-uris.md new file mode 100644 index 0000000000..09c112586c --- /dev/null +++ b/content/changes/2012-10-31-gist-comment-uris.md @@ -0,0 +1,12 @@ +--- +kind: change +title: Gist comment URIs +created_at: 2012-10-31 +author_name: pezra +--- + +The URIs of all gist comments are changing immediately. The new URI pattern for gist comments is `/gists/{gist-id}/comments/{id}`. (See [gist comments section of the docs](/v3/gists/comments/) for more details.) This change is necessary because the auto-incremented ids of gist comments are easy to guess. This predictability allows anyone to view comments on private Gists with relative ease. Obviously, comments on private gists should be just as private as the gist itself. + +Adding the gist id to the URI of comments makes it impossible, in practical terms, to guess that URI because the id of private gists are very large random numbers. This is, unfortunately, a breaking change but one that cannot be avoided because of the security implications of the current URIs. We apologize for the inconvenience. + +We have also added a `comments_url` member to the Gist documents. The `comments_url` link provides access to the comments of a Gist in a way that will insulate clients from changes in the URI patterns used by the GitHub API. We are increasing our use of links in order to make changes such as this one less damaging to clients. We strongly encourage using `url` and `*_url` properties, where possible, rather than constructing URIs using the patterns published on this site. Doing so will result in clients that break less often. diff --git a/content/changes/2012-11-27-forking-to-organizations.html b/content/changes/2012-11-27-forking-to-organizations.html new file mode 100644 index 0000000000..7e4530985a --- /dev/null +++ b/content/changes/2012-11-27-forking-to-organizations.html @@ -0,0 +1,29 @@ +--- +kind: change +title: Forking to Organizations +created_at: 2012-11-27 +author_name: technoweenie +--- + +We made a slight change to the way you fork a repository. By default, you +can fork my repository through an HTTP POST to the repository's fork resource. + + $ curl -X POST https://api.github.com/repos/technoweenie/faraday/forks + +This repository forks to your personal account. However, there are cases when +you want to fork to one of your organizations instead. The previous method +required a `?org` query parameter: + + $ curl -X POST /repos/technoweenie/faraday/forks?org=mycompany + +Query parameters on POST requests are unusual in APIs, and definitely +inconsistent with the rest of the GitHub API. You should be able to post a +JSON body like every other POST endpoint. Now, you can! Only, now we're +calling the field `organization`. + + $ curl /repos/technoweenie/faraday/forks?org=mycompany \ + -d '{"organization": "mycompany"}' + +Don't worry, we are committed to maintaining the legacy behavior until the next +major change of the GitHub API. + diff --git a/content/changes/2012-11-29-gitignore-templates.html b/content/changes/2012-11-29-gitignore-templates.html new file mode 100644 index 0000000000..931e12b060 --- /dev/null +++ b/content/changes/2012-11-29-gitignore-templates.html @@ -0,0 +1,58 @@ +--- +kind: change +title: Gitignore Templates API +created_at: 2012-11-29 +author_name: pengwynn +--- + +We recently [made it easy][init-post] to initialize a repository when you create +it [via the API][repo-create]. One of the options you can pass when creating a +repository is `gitignore_template`. This value is the name of one of the +templates from the the public [GitHub .gitignore repository][templates-repo]. + +The [Gitignore Templates API][new-api] makes it easy to list those templates: + + curl https://api.github.com/gitignore/templates + + HTTP/1.1 200 OK + + [ + "Actionscript", + "Android", + "AppceleratorTitanium", + "Autotools", + "Bancha", + "C", + "C++", + ... + +If you'd like to view the source, you can also fetch a single template. + + curl -H 'Accept: application/vnd.github.raw' \ + https://api.github.com/gitignore/templates/Objective-C + + HTTP/1.1 200 OK + + # Xcode + .DS_Store + build/ + *.pbxuser + !default.pbxuser + *.mode1v3 + !default.mode1v3 + *.mode2v3 + !default.mode2v3 + *.perspectivev3 + !default.perspectivev3 + *.xcworkspace + !default.xcworkspace + xcuserdata + profile + *.moved-aside + DerivedData + .idea/ + +[init-post]: /changes/2012-9-28-auto-init-for-repositories/ +[repo-create]: /v3/repos/#create +[templates-repo]: https://github.com/github/gitignore +[new-api]: /v3/gitignore/ diff --git a/content/changes/2012-12-04-List-comments-for-repo.html b/content/changes/2012-12-04-List-comments-for-repo.html new file mode 100644 index 0000000000..228bdc849b --- /dev/null +++ b/content/changes/2012-12-04-List-comments-for-repo.html @@ -0,0 +1,26 @@ +--- +kind: change +title: Per-repository Review and Issue Comment listing +created_at: 2012-12-04 +author_name: pengwynn +--- + +You've always been able to grab all the commit comments for an entire +repository via the API, but to get Issue comments and Pull Request Review +Comments, you could only fetch the comments for a single Issue or Pull Request. + +Today, we're introducing two new methods to grab all Issue Comments and Review +Comments for a repository. + + # Grab all Issue Comments + curl https://api.github.com/repos/mathiasbynens/dotfiles/issues/comments + + # Grab all Review Comments + curl https://api.github.com/repos/mathiasbynens/dotfiles/pulls/comments + +Check out the docs for sorting and filtering options: + +* [Issue comments](/v3/issues/comments/#list-comments-in-a-repository) +* [Review comments](/v3/pulls/comments/#list-comments-in-a-repository) + + diff --git a/content/changes/2012-12-06-create-authorization-for-app.html b/content/changes/2012-12-06-create-authorization-for-app.html new file mode 100644 index 0000000000..d03a97a817 --- /dev/null +++ b/content/changes/2012-12-06-create-authorization-for-app.html @@ -0,0 +1,38 @@ +--- +kind: change +title: Create an OAuth authorization for an app +created_at: 2012-12-06 +author_name: pengwynn +--- + +The [Authorizations API][oauth-api] is an easy way to create an OAuth +authorization using Basic Auth. Just POST your desired scopes and optional +note and you get a token back: + +
+    curl -u pengwynn -d '{"scopes": ["user", "gist"]}' \
+         https://api.github.com/authorizations
+
+ +This call creates a token for the authenticating user tied to a special "API" +OAuth application. + +We now support creating tokens for _your own OAuth application_ by passing your +twenty character `client_id` and forty character `client_secret` as found in +the settings page for your OAuth application. + + +
+    curl -u pengwynn -d '{ \
+                          "scopes": ["user", "gist"], \
+                          "client_id": "abcdeabcdeabcdeabcdeabcde" \
+                          "client_secret": "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde" \
+                         }' \ '
+            https://api.github.com/authorizations
+
+ +No more implementing the [web flow][web-flow] just to get a token tied to your +app's rate limit. + +[oauth-api]: /v3/oauth_authorizations/#oauth-authorizations-api +[web-flow]: /v3/oauth/#web-application-flow diff --git a/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html b/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html new file mode 100644 index 0000000000..d7bf6aec6c --- /dev/null +++ b/content/changes/2012-12-08-finding-source-and-fork-repos-for-organizations.html @@ -0,0 +1,23 @@ +--- +kind: change +title: Finding sources and fork repositories for organizations +created_at: 2012-12-08 +author_name: rick +--- + +We've made a couple of changes today to the Organization repositories +listing to bring it a bit closer to the functionality of the GitHub.com +Organization repositories tab. We now let you retrieve repositories +which are forks of another repository, as well as those repositories which +are sources (not forks). + + # Grab all fork Repositories for an Organization + curl "https://api.github.com/orgs/:org/repos?type=forks" + + # Grab all source Repositories for an Organization + curl "https://api.github.com/orgs/:org/repos?type=sources" + +Check out the docs for sorting and filtering options: + +* [Organization Repositories](/v3/repos/#list-organization-repositories) + diff --git a/content/changes/2012-12-09-organization-repositories-results-now-paginate.html b/content/changes/2012-12-09-organization-repositories-results-now-paginate.html new file mode 100644 index 0000000000..d58a557520 --- /dev/null +++ b/content/changes/2012-12-09-organization-repositories-results-now-paginate.html @@ -0,0 +1,19 @@ +--- +kind: change +title: Pagination for Organization Repository lists now paginates properly +created_at: 2012-12-09 +author_name: rick +--- + +![seger-is-so-dreamy](https://github-images.s3.amazonaws.com/skitch/seger-turn-the-page-20121209-154956.png) + +Improvements continue to the Organizations Repository listing endpoint. +Today we're improving pagination so that it works as documented. Now +you can expect `Link` headers to navigate through the results space, +regardless of what you send in the `type` parameter. + +The docs for Organization Repositories queries are still here: + +* [Organization Repositories](/v3/repos/#list-organization-repositories) + +**EDIT:** `Link` headers are our preferred navigation technique. \ No newline at end of file diff --git a/content/changes/2012-12-10-Diff-and-patch-media-types.html b/content/changes/2012-12-10-Diff-and-patch-media-types.html new file mode 100644 index 0000000000..5345c9466f --- /dev/null +++ b/content/changes/2012-12-10-Diff-and-patch-media-types.html @@ -0,0 +1,34 @@ +--- +kind: change +title: Diff and patch media types +created_at: 2012-12-10 +author_name: pengwynn +--- + +Starting today, you can get `.diff` and `.patch` content directly from the API for the following resources: + +* [Commits][commits-get] +* [Commit comparisons][commits-compare] +* [Pull request][pulls] + +Simply use the same resource URL and send either `application/vnd.github.diff` or `application/vnd.github.patch` in the `Accept` header: + + curl -H "Accept: application/vnd.github.diff" https://api.github.com/repos/pengwynn/dotfiles/commits/aee60a4cd56fb4c6a50e60f17096fc40c0d4d72c + + diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink + index 1f599cb..abaf625 100755 + --- a/tmux/tmux.conf.symlink + +++ b/tmux/tmux.conf.symlink + @@ -111,6 +111,7 @@ set-option -g base-index 1 + ## enable mouse + set-option -g mouse-select-pane on + set-option -g mouse-select-window on + +set-option -g mouse-resize-pane on + set-window-option -g mode-keys vi + set-window-option -g mode-mouse on + # set-window-option -g monitor-activity off + +[commits-get]: /v3/repos/commits/#get-a-single-commit +[commits-compare]: /v3/repos/commits/#compare-two-commits +[pulls]: /v3/pulls/#get-a-single-pull-request + diff --git a/content/changes/2012-9-28-auto-init-for-repositories.html b/content/changes/2012-9-28-auto-init-for-repositories.html new file mode 100644 index 0000000000..bca3d142b6 --- /dev/null +++ b/content/changes/2012-9-28-auto-init-for-repositories.html @@ -0,0 +1,50 @@ +--- +kind: change +title: Initialize a repository when creating +created_at: 2012-9-28 +author_name: pengwynn +--- + +Today we've made it easier to add commits to a repository via the GitHub API. +Until now, you could [create a repository](/v3/repos/#create), but you would +need to initialize it locally via your Git client before adding any commits via +the API. + +Now you can optionally init a repository when it's created by sending `true` +for the `auto_init` parameter: + +
+curl -i -u pengwynn \
+     -d '{"name": "create-repo-test", "auto_init": true}' \
+     https://api.github.com/user/repos
+
+ +The resulting repository will have a README stub and an initial commit. + +![create repo screenshot](/images/posts/create-repo-init.png) + +### .gitignore templates + +Along with this change, you can set up your `.gitignore` template by passing +the basename of any template in the [GitHub gitignore templates +project](https://github.com/github/gitignore). + +
+curl -i -u pengwynn \
+     -d '{"name": "create-repo-test", "auto_init": true, \
+          "gitignore_template": "Haskell"}' \
+     https://api.github.com/user/repos
+
+ + +As the [docs point out](/v3/repos/#create), the `gitignore_template` parameter +is ignored if `auto_init` is not present and `true`. + +If you have any questions or feedback, drop us a line at +[https://github.com/contact][c], [support@github.com][email], or +[@GitHubAPI][twitter]. + +[twitter]: https://twitter.com/githubapi +[email]: mailto:support@github.com +[c]: https://github.com/c + diff --git a/content/changes/2012-9-5-watcher-api.html b/content/changes/2012-9-5-watcher-api.html new file mode 100644 index 0000000000..c64f114109 --- /dev/null +++ b/content/changes/2012-9-5-watcher-api.html @@ -0,0 +1,123 @@ +--- +kind: change +title: Upcoming Changes to Watcher and Star APIs +created_at: 2012-9-5 +author_name: technoweenie +--- + +We recently [changed the Watcher behavior][change-watching] on GitHub. What +used to be known as "Watching" is now "Starring". Starring is basically a way +to bookmark interesting repositories. Watching is a way to indicate that you +want to receive email or web notifications on a Repository. + +[change-watching]: https://github.com/blog/1204-notifications-stars + +This works well on GitHub.com, but poses a problem for the GitHub API. How do +we change this in a way that developers can gracefully upgrade their +applications? We're currently looking at rolling out the changes in three +phases over an extended period of time. + +## Current Status + +The current [Repository Starring][starring-api] methods look like this: + +* `/repos/:owner/:repo/watchers` - A list of users starring the repository. +* `/users/:user/watched` - A list of repositories that a user has starred. +* `/user/watched` - A list of repositories the current user has starred. + +[starring-api]: /v3/activity/starring/ + +## Phase 1: Add Watchers as Subscriptions + +This phase exposes Watchers as "Subscriptions". This is to +keep from clashing with the legacy endpoints. This phase will happen +automatically and will not break your application until Phase 3 starts. +(**UPDATE**: API v3 will continue to support this functionality indefinitely.) + +* `/repos/:owner/:repo/subscribers` - A list of users watching the repository. +* `/users/:user/subscriptions` - A list of repositories that a user is watching. +* `/user/subscriptions` - A list of repositories the current user is watching. + +We'll also add a copy of the legacy Watchers API in the new endpoint: + +* `/repos/:owner/:repo/stargazers` - A list of users starring the repository. +* `/users/:user/starred` - A list of repositories that a user has starred. +* `/user/starred` - A list of repositories the current user has starred. + +This is in place _now_ with the current media type for the API: + + application/vnd.github.beta+json + +If you care about your application not breaking, make sure all outgoing API +requests pass that value for the "Accept" header. You should do this now. This +can be verified by checking the `X-GitHub-Media-Type` header on all API +responses. + + # Accesses a user's starred repositories. + curl https://api.github.com/user/watched \ + -H "Accept: application/vnd.github.beta+json" + +-This Phase will be broken once Phase 3 starts. Phase 3 removes all support for +the "beta" media type, and makes the "v3" media type the implicit default +for API requests. + +## UPDATE - November 6, 2013 + +
+

+ API v3 will continue to officially support the functionality described in + Phase 1 above. This functionality will remain intact for the lifetime of + API v3. +

+

+ API v3 will not include Phases 2 and 3 (below). Those phases will + likely be part of the next major version of the API. (We have not announced + a timeline for the next major version of the API.) +

+
+ +## Phase 2: Switch /watchers API Endpoint + +The "watch" endpoints will now be a copy of the "subscription" endpoints. You +will have to use /user/starred to get a user's starred repositories, not +/user/watched. + +This requires a new media type value: + +
application/vnd.github.v3+json
+ +This is a breaking change from Phase 1. We will release this change in an +experimental mode first, letting developers gracefully upgrade their +applications by specifying the new media value for the Accept header. + + +
+# Accesses a user's watched repositories.
+curl https://api.github.com/user/watched \
+  -H "Accept: application/vnd.github.v3+json"
+
+
+ +## Phase 3: Remove /subscribers API Endpoint. + +This phase involves disabling the subscription endpoints completely. At this +point, you should be using the starring endpoints for starred repositories, and +the watch endpoints for watched repositories. No date has been set yet, but we +expect this to be 3-6 months after Phase 2 is in place. This should give +developers enough time for a smooth upgrade path. If they use popular API +wrappers, the work will likely mostly be done for them. + +Keep on passing the "v3" media type in your application, until the API has +another breaking change to make. If you can't make the deadline for Phase 3, +just set the "beta" media type until we shut that down completely. It's likely +that we will keep the old "beta" media type active for another month, like +the last time we terminated +old API functionality. + +We look forward to assisting you through this transition. Hit us up at +[https://github.com/contact][c], [support@github.com][email], or +[@GitHubAPI][twitter]. + +[twitter]: https://twitter.com/githubapi +[email]: mailto:support@github.com +[c]: https://github.com/c diff --git a/content/changes/2013-01-08-new-user-scopes.html b/content/changes/2013-01-08-new-user-scopes.html new file mode 100644 index 0000000000..c0e3aeae7f --- /dev/null +++ b/content/changes/2013-01-08-new-user-scopes.html @@ -0,0 +1,22 @@ +--- +kind: change +title: New User scopes +created_at: 2013-01-08 +author_name: technoweenie +--- + +We've added a [few new user scopes][scopes] for 3rd party applications that want very +specific user functionality. The `user:email` scope gives apps read-only access +to a user's private email addresses. The `user:follow` scope lets a user +follow and unfollow other users. + +This should help keep applications from requiring the `user` scope, which +can be potentially dangerous. + +We also added a read-only endpoint to get a user's public SSH keys. + + GET https://api.github.com/users/technoweenie/keys + +[scopes]: http://developer.github.com/v3/oauth/#scopes +[keys]: http://developer.github.com/v3/users/keys/#list-public-keys-for-a-user + diff --git a/content/changes/2013-01-31-user-agent-will-soon-be-mandatory.html b/content/changes/2013-01-31-user-agent-will-soon-be-mandatory.html new file mode 100644 index 0000000000..2407d3a97d --- /dev/null +++ b/content/changes/2013-01-31-user-agent-will-soon-be-mandatory.html @@ -0,0 +1,21 @@ +--- +kind: change +title: User Agent mandatory from March 4th 2013 +created_at: 2013-01-31 +author_name: agh +--- + +Following on from our [previous post](http://developer.github.com/changes/2012-10-14-rate-limit-changes/) +about requiring requests to include a valid [User Agent header](http://en.wikipedia.org/wiki/User_agent) +we will soon be changing our API servers to return HTTP 403 +to any clients not providing a valid User Agent header. + +We will be making this change on Monday, March 4th 2013. + +Setting this helps us identify requests from you, and get in touch with people who are using +the API in a way which causes disruption to GitHub. Most HTTP libraries and tools like cURL +already provide a valid header for you, and allow you to customize it, so this will not require +many of our users to make any changes whatsoever. + +If you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=User Agent Requirement). diff --git a/content/changes/2013-04-24-user-agent-required.html b/content/changes/2013-04-24-user-agent-required.html new file mode 100644 index 0000000000..292d14c5a1 --- /dev/null +++ b/content/changes/2013-04-24-user-agent-required.html @@ -0,0 +1,16 @@ +--- +kind: change +title: User Agent now mandatory +created_at: 2013-04-24 +author_name: pengwynn +--- + +After an almost six week grace period, we're now enforcing the [User Agent +header][1] for all API requests. Most HTTP libraries (including cURL) +set this header by default. If you're experiencing an increase in `403` +responses, be sure and check your code. + +[1]: /v3/#user-agent-required + +If you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=User Agent Requirement). diff --git a/content/changes/2013-04-25-deprecating-merge-commit-sha.html b/content/changes/2013-04-25-deprecating-merge-commit-sha.html new file mode 100644 index 0000000000..54a024593b --- /dev/null +++ b/content/changes/2013-04-25-deprecating-merge-commit-sha.html @@ -0,0 +1,23 @@ +--- +kind: change +title: Deprecating a Confusing Attribute in the Pull Request API +created_at: 2013-04-25 +author_name: jasonrudolph +--- + +When you get the details for a Pull Request from the API, the +[response](/v3/pulls/#get-a-single-pull-request) provides everything there is to +know about that Pull Request. In addition to the useful information provided in +the API response, the JSON also includes the `merge_commit_sha` attribute. This +attribute is a frequent source of misunderstanding, and we aim to remove the +confusion. + +To help current API consumers, we've [documented the +attribute](/v3/pulls/#mergability) for improved understanding. + +To protect future API consumers from this confusion, we have +[deprecated](/v3/versions/#v3-deprecations) the `merge_commit_sha` attribute, and we will +remove it in the next major version of the API. + +As always, if you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=Deprecating merge_commit_sha). diff --git a/content/changes/2013-04-30-improved-submodule-support-in-repository-contents-api.md b/content/changes/2013-04-30-improved-submodule-support-in-repository-contents-api.md new file mode 100644 index 0000000000..fcd99765f1 --- /dev/null +++ b/content/changes/2013-04-30-improved-submodule-support-in-repository-contents-api.md @@ -0,0 +1,39 @@ +--- +kind: change +title: Improved Support for Submodules in the Repository Contents API +created_at: 2013-04-30 +author_name: jasonrudolph +--- + +When you view a repository with a submodule on github.com, you get useful links and information for the submodule. + +[![Repository Contents with Submodule](/images/posts/submodule-links.png)][screenshot] + +Today we're making that data available in the [Repository Contents API][docs]. + +
+curl https://api.github.com/repos/jquery/jquery/contents/test/qunit
+
+{
+  "name": "qunit",
+  "path": "test/qunit",
+  "type": "submodule",
+  "submodule_git_url": "git://github.com/jquery/qunit.git",
+  "sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
+  "size": 0,
+  "url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
+  "git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
+  "html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
+  "_links": {
+    "self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
+    "git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
+    "html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
+  }
+}
+
+ +If you have any questions or feedback, please drop us a line at +[support@github.com](mailto:support@github.com?subject=Submodules in Repository Contents API). + +[docs]: /v3/repos/contents/#get-contents +[screenshot]: /images/posts/submodule-links.png diff --git a/content/changes/2013-04-30-statuses-for-branches-and-tags.md b/content/changes/2013-04-30-statuses-for-branches-and-tags.md new file mode 100644 index 0000000000..d35724dcd6 --- /dev/null +++ b/content/changes/2013-04-30-statuses-for-branches-and-tags.md @@ -0,0 +1,19 @@ +--- +kind: change +title: Commit Statuses Now Available for Branches and Tags +created_at: 2013-04-30 +author_name: foca +--- + +Last week we announced [support for build statuses in the branches page][blog]. +Now we are extending this to the API. The [API endpoint for commit statuses][doc] +has been extended to allow branch and tag names, as well as commit SHAs. + +
+curl https://api.github.com/repos/rails/rails/statuses/3-2-stable
+
+ +Enjoy. + +[blog]: https://github.com/blog/1484-check-the-status-of-your-branches +[doc]: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref diff --git a/content/changes/2013-05-06-create-update-delete-individual-files.md b/content/changes/2013-05-06-create-update-delete-individual-files.md new file mode 100644 index 0000000000..bd30049ca0 --- /dev/null +++ b/content/changes/2013-05-06-create-update-delete-individual-files.md @@ -0,0 +1,23 @@ +--- +kind: change +title: Create, update, and delete individual files +created_at: 2013-05-06 +author_name: ymendel +--- + +We're following in the footsteps of GitHub.com's ability to [edit][web_edit] and +[create][web_create] files in your web browser. Starting today, the +[Repository Contents API][docs] will let you easily [create][], [update][], and even +[delete][] individual files. + +Happy editing! + + +[web_edit]: https://github.com/blog/143-inline-file-editing +[web_create]: https://github.com/blog/1327-creating-files-on-github + +[docs]: /v3/repos/contents/ +[create]: /v3/repos/contents/#create-a-file +[update]: /v3/repos/contents/#update-a-file +[delete]: /v3/repos/contents/#delete-a-file + diff --git a/content/changes/2013-05-06-repository-stats.md b/content/changes/2013-05-06-repository-stats.md new file mode 100644 index 0000000000..08569d9347 --- /dev/null +++ b/content/changes/2013-05-06-repository-stats.md @@ -0,0 +1,20 @@ +--- +kind: change +title: Repository Statistics +created_at: 2013-05-06 +author_name: Caged +--- + +Today we're happy to open our [Repository Statistics API](/v3/repos/statistics) to everyone. We're using +repository statistics to power [our graphs](https://github.com/github/linguist/graphs), +but we can't wait to see what others can do with this information. + +Starting today, these resources are available to you: + +* **[Contributors](/v3/repos/statistics/#contributors)** +* **[Commit Activity](/v3/repos/statistics/#commit-activity)** +* **[Code Frequency](/v3/repos/statistics/#code-frequency)** +* **[Participation](/v3/repos/statistics/#participation)** +* **[Punch Card](/v3/repos/statistics/#punch-card)** + +Enjoy! diff --git a/content/changes/2013-07-01-feeds-api.md b/content/changes/2013-07-01-feeds-api.md new file mode 100644 index 0000000000..8111964252 --- /dev/null +++ b/content/changes/2013-07-01-feeds-api.md @@ -0,0 +1,56 @@ +--- +kind: change +title: Feeds API +created_at: 2013-7-01 +author_name: pengwynn +--- + +Today we're releasing a new [Feeds API][], an easy way to list all the Atom +resources available to the authenticated user. + +
+
+curl -u defunkt https://api.github.com/feeds
+
+{
+  "timeline_url": "https://github.com/timeline",
+  "user_url": "https://github.com/{user}",
+  "current_user_public_url": "https://github.com/defunkt",
+  "current_user_url": "https://github.com/defunkt.private?token=abc123",
+  "current_user_actor_url": "https://github.com/defunkt.private.actor?token=abc123",
+  "current_user_organization_url": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
+  "_links": {
+    "timeline": {
+      "href": "https://github.com/timeline",
+      "type": "application/atom+xml"
+    },
+    "user": {
+      "href": "https://github.com/{user}",
+      "type": "application/atom+xml"
+    },
+    "current_user_public": {
+      "href": "https://github.com/defunkt",
+      "type": "application/atom+xml"
+    },
+    "current_user": {
+      "href": "https://github.com/defunkt.private?token=abc123",
+      "type": "application/atom+xml"
+    },
+    "current_user_actor": {
+      "href": "https://github.com/defunkt.private.actor?token=abc123",
+      "type": "application/atom+xml"
+    },
+    "current_user_organization": {
+      "href": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
+      "type": "application/atom+xml"
+    }
+  }
+}
+
+
+ +If you have any questions or feedback, [please drop us a line][contact]. + +[Feeds API]: /v3/activity/feeds/ +[contact]: https://github.com/contact?form[subject]=Feeds%20API + diff --git a/content/changes/2013-07-02-rate-limit-reset.md b/content/changes/2013-07-02-rate-limit-reset.md new file mode 100644 index 0000000000..ab19eed93e --- /dev/null +++ b/content/changes/2013-07-02-rate-limit-reset.md @@ -0,0 +1,45 @@ +--- +kind: change +title: When Does My Rate Limit Reset? +created_at: 2013-07-02 +author_name: jasonrudolph +--- + +Have you ever wondered when your [rate limit][rate-limit-docs] will reset back to its maximum value? +That information is now available in the new `X-RateLimit-Reset` response header. + +
+$ curl -I https://api.github.com/orgs/octokit
+
+HTTP/1.1 200 OK
+Status: 200 OK
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 42
+X-RateLimit-Reset: 1372700873
+...
+
+ +The `X-RateLimit-Reset` header provides a [Unix UTC timestamp][unix-time], letting you know the exact time that your fresh new rate limit kicks in. + +The reset timestamp is also available as part of the `/rate_limit` resource. + +
+$ curl https://api.github.com/rate_limit
+
+{
+  "rate": {
+    "limit": 60,
+    "remaining": 42,
+    "reset": 1372700873
+  }
+}
+
+ +For more information on rate limits, be sure to check out the [docs][rate-limit-docs]. + +If you have any questions or feedback, please [drop us a line][contact]. + + +[contact]: https://github.com/contact?form[subject]=X-RateLimit-Reset +[rate-limit-docs]: /v3/#rate-limiting +[unix-time]: http://en.wikipedia.org/wiki/Unix_time diff --git a/content/changes/2013-07-19-preview-the-new-search-api.md b/content/changes/2013-07-19-preview-the-new-search-api.md new file mode 100644 index 0000000000..736b4a28b6 --- /dev/null +++ b/content/changes/2013-07-19-preview-the-new-search-api.md @@ -0,0 +1,69 @@ +--- +kind: change +title: Preview the New Search API +created_at: 2013-07-19 +author_name: jasonrudolph +--- + +Today we're excited to announce a [brand new Search API][docs]. Whether you're +searching for [code][code-docs], [repositories][repo-docs], +[issues][issue-docs], or [users][user-docs], all the query abilities of +github.com are now available via the API as well. + +Maybe you want to find [popular Tetris implementations written in Assembly][tetris-repos]. +We've got you covered. +Or perhaps you're looking for [new gems that are using Octokit.rb][octokit-gemspecs]. +No problem. +The possibilities are endless. + +## Highlights + +On github.com, we enjoy the context provided by code snippets and highlights in +search results. + +[![code-snippet-highlighting](https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png)][example-web-search] + +We want API consumers to have access to that information as well. So, API +requests can opt to receive those +[text fragments in the response][text-matches]. Each fragment is accompanied by +numeric offsets identifying the exact location of each matching search term. + +## Preview period + +We're making this new API available today for developers to +preview. We think developers are going to love it, but we want +to get your feedback before we declare the Search API "final" and +"unchangeable." We expect the preview period to last for roughly 60 days. + +As we discover opportunities to improve this new API during the preview period, +we may ship changes that break clients using the preview version of the API. We +want to iterate quickly. To do so, we will announce any changes here (on the +developer blog), but we will not provide any advance notice. + +At the end of preview period, the Search API will become an official component +of GitHub API v3. At that point, the new Search API will be stable and suitable +for production use. + +## What about the old search API? + +The [legacy search API][legacy-search] is still available. Many existing clients +depend on it, and it is not changing in any way. While the new API offers much +more functionality, the legacy search endpoints remain an official part of +GitHub API v3. + +## Take it for a spin + +We hope you'll kick the tires and [send us your feedback][contact]. Happy +searching finding! + +[code-docs]: /v3/search/#search-code +[contact]: https://github.com/contact?form[subject]=New+Search+API +[docs]: /v3/search/ +[example-web-search]: https://github.com/search?q=faraday+builder+repo%3Aoctokit%2Foctokit.rb&type=Code +[issue-docs]: /v3/search/#search-issues +[legacy-search]: /v3/search/legacy/ +[octokit-gemspecs]: /v3/search/#code-search-example +[repo-docs]: /v3/search/#search-repositories +[tetris-repos]: /v3/search/#repository-search-example +[text-matches]: /v3/search#text-match-metadata +[user-docs]: /v3/search/#search-users diff --git a/content/changes/2013-08-20-search-api-improvements.md b/content/changes/2013-08-20-search-api-improvements.md new file mode 100644 index 0000000000..230de12678 --- /dev/null +++ b/content/changes/2013-08-20-search-api-improvements.md @@ -0,0 +1,77 @@ +--- +kind: change +title: Improvements to the Search API +created_at: 2013-08-20 +author_name: jasonrudolph +--- + +Today we're shipping two improvements to the [new Search API][original-search-api-announcement]. + +## More Text Match Metadata + +When searching for code, the API previously provided [text match metadata][text-matches] (i.e., "highlights") for file content. +Now, you can also [get this metadata][code-text-matches] for matches that occur within the file path. + +For example, when [searching for files that have "client" in their path][example-path-search], the results include this match for `lib/octokit/client/commits.rb`: + +
+{
+  "name": "commits.rb",
+  "path": "lib/octokit/client/commits.rb",
+  "text_matches": [
+    {
+      "object_url": "https://api.github.com/repositories/417862/contents/lib/octokit/client/commits.rb?ref=8d487ab06ccef463aa9f5412a56f1a2f1fa4dc88",
+      "object_type": "FileContent",
+      "property": "path",
+      "fragment": "lib/octokit/client/commits.rb",
+      "matches": [
+        {
+          "text": "client",
+          "indices": [ 12, 18 ]
+        }
+      ]
+    }
+  ]
+  // ...
+}
+
+ +## Better Text Match Metadata + +Before today, the API applied HTML entity encoding to all `fragment` data. +For example, imagine your search returns an issue like [rails/rails#11889][example-issue]: + +![Example Issue Title](https://f.cloud.github.com/assets/2988/994632/a84f2888-09af-11e3-9417-4bd92f1f1ed6.png) + +The response would include a `text_matches` array with the following object: + +
+{
+  "fragment": "undefined method `except' for #&lt;Array:XXX&gt;",
+  // ...
+}
+
+ +Inside the `fragment` value, we see HTML-encoded entities (e.g., `<`). +Since we're returning JSON (not HTML), API clients might not expect any HTML-encoded text. +As of today, the API returns these fragments _without_ this extraneous encoding. + +
+{
+  "fragment": "undefined method `except' for #<Array:XXX>",
+  // ...
+}
+
+ +## Preview Period + +We're about halfway through the [preview period][preview-period] for the new Search API. +We appreciate everyone that has provided feedback so far. Please [keep it coming][contact]! + +[contact]: https://github.com/contact?form[subject]=New+Search+API +[code-text-matches]: /v3/search/#highlighting-code-search-results +[example-issue]: https://github.com/rails/rails/issues/11889 +[example-path-search]: https://github.com/search?q=%40octokit%2Foctokit.rb+in%3Apath+client&type=Code +[original-search-api-announcement]: /changes/2013-07-19-preview-the-new-search-api/ +[preview-period]: /changes/2013-07-19-preview-the-new-search-api/#preview-period +[text-matches]: /v3/search/#text-match-metadata diff --git a/content/changes/2013-09-03-two-factor-authentication.md b/content/changes/2013-09-03-two-factor-authentication.md new file mode 100644 index 0000000000..4c5fc5d364 --- /dev/null +++ b/content/changes/2013-09-03-two-factor-authentication.md @@ -0,0 +1,50 @@ +--- +kind: change +title: Two-Factor Authentication and the API +created_at: 2013-09-03 +author_name: mastahyeti +--- + +As [announced earlier today][dotcom-blog-post], GitHub.com now supports two-factor +authentication (2FA) for increased security. For users with this feature +enabled, GitHub.com will prompt for a 2FA code in addition to a username and +password during authentication. We've also rolled out some improvements to the +API to ensure that 2FA requirements in the API are consistent with GitHub.com. + +## Authenticating with the API + +For users without 2FA enabled, and for applications using the [OAuth web +flow](/v3/oauth/#web-application-flow) for authentication, everything is +business as usual. You'll continue to authenticate with the API just as you +always have. (That was easy.) + +If you enable 2FA _and_ use Basic Authentication to access the API, we're +providing multiple options to make the flow simple and easy. + +## Basic Authentication and 2FA + +### Personal Access Tokens + +Personal access tokens provide the simplest option for using 2FA with Basic +Authentication. You can create these tokens via the [application settings page +on GitHub.com](https://github.com/settings/applications), and you can revoke +them at any time. For more information about authenticating to the API with +personal access tokens, be sure to check out our [help article on the +topic][personal-access-tokens]. + +### Tightly-integrated 2FA + +For developers wishing to integrate GitHub 2FA directly into their application, +the API's Basic Authentication now supports the [ability to send the user's 2FA +code][basic-auth-2fa], in addition to the username and password. + +## We're here to help + +We think GitHub users are going to love the additional security provided by +two-factor authentication. As always, if you have any questions or feedback, +[let us know][contact]. We're here to help! + +[basic-auth-2fa]: /v3/auth/#working-with-two-factor-authentication +[contact]: https://github.com/contact?form[subject]=2FA+and+the+API +[dotcom-blog-post]: https://github.com/blog/1614-two-factor-authentication +[personal-access-tokens]: https://help.github.com/articles/creating-an-access-token-for-command-line-use diff --git a/content/changes/2013-09-25-releases-api.md b/content/changes/2013-09-25-releases-api.md new file mode 100644 index 0000000000..e7a1ab9067 --- /dev/null +++ b/content/changes/2013-09-25-releases-api.md @@ -0,0 +1,65 @@ +--- +kind: change +title: Releases API +created_at: 2013-09-25 +author_name: technoweenie +--- + +This summer we made it easier to [release your software][blawg]. Today, you can fully automate those releases via the +[Releases API Preview][api]. + +This API is a little different due to the binary assets. We use the `Accept` header for content negotiation when requesting +a release asset. Pass a standard API media type to get the API representation: + +
+$ curl -i -H "Authorization: token TOKEN" \
+     -H "Accept: application/vnd.github.manifold-preview" \
+     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
+
+HTTP/1.1 200 OK
+
+{
+  "id": 123,
+  ...
+}
+
+ +Pass "application/octet-stream" to download the binary content. + +
+$ curl -i -H "Authorization: token TOKEN" \
+     -H "Accept: application/octet-stream" \
+     "https://uploads.github.com/repos/hubot/singularity/releases/assets/123"
+
+HTTP/1.1 302 Found
+
+ +Uploads are handled by a single request to a companion "uploads.github.com" service. + +
+$ curl -H "Authorization: token TOKEN" \
+     -H "Accept: application/vnd.github.manifold-preview" \
+     -H "Content-Type: application/zip" \
+     --data-binary @build/mac/package.zip \
+     "https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=1.0.0-mac.zip"
+
+ +## Preview mode + +The new API is available as a [preview][preview]. This gives developers a chance to [provide feedback][contact] on the direction of +the API before we freeze changes. We expect to lift the preview status in 30 days. + +As with [the Search API][searchapi], we'll take this opportunity to iterate quickly. Breaking changes will be announced +on this developer blog without any advance warning. Once the preview period is over, we'll consider the Releases API unchangeable. +At that point, it will be stable and suitable for production use. + +The preview media type is "application/vnd.github.manifold-preview". [Manifold](http://en.wikipedia.org/wiki/Eden_Fesi) is +a member of the Avengers, with the ability to teleport through time and space. He's the one in the middle holding the spear. + +![Manifold teleporting the Avengers to a terraformed Mars surface](https://f.cloud.github.com/assets/21/1210628/ae8556fa-25fc-11e3-986d-0ab522271d43.png) + +[blawg]: https://github.com/blog/1547-release-your-software +[api]: http://developer.github.com/v3/repos/releases/ +[preview]: http://developer.github.com/v3/repos/releases/#preview-mode +[searchapi]: http://developer.github.com/changes/2013-07-19-preview-the-new-search-api/ +[contact]: https://github.com/contact?form[subject]=New+Releases+API diff --git a/content/changes/2013-09-28-an-update-on-the-new-search-api.md b/content/changes/2013-09-28-an-update-on-the-new-search-api.md new file mode 100644 index 0000000000..2212fdff16 --- /dev/null +++ b/content/changes/2013-09-28-an-update-on-the-new-search-api.md @@ -0,0 +1,24 @@ +--- +kind: change +title: An Update on the New Search API +created_at: 2013-09-28 +author_name: jasonrudolph +--- + +We owe a big "Thank You!" to everyone that has taken the time to try out the [new Search API][original-blog-post]. +We `:heart:` every one of you. +Just as we hoped, +the [preview period][] has allowed us to see how you want to use the new API, +and it has given us a chance to improve the API before finalizing it. + +In order to incorporate everything that we've learned, +we're going to keep the Search API in [preview mode][preview period] for a little while longer. +We have a few bugs to squash and a couple performance kinks to iron out. +We're hard at work on those improvements now, +and we expect to have more news in the coming weeks. + +In the mean time, [keep the suggestions coming][contact]! + +[original-blog-post]: /changes/2013-07-19-preview-the-new-search-api +[preview period]: /changes/2013-07-19-preview-the-new-search-api/#preview-period +[contact]: https://github.com/contact?form[subject]=New+Search+API diff --git a/content/changes/2013-10-04-oauth-changes-coming.html b/content/changes/2013-10-04-oauth-changes-coming.html new file mode 100644 index 0000000000..842175a2d7 --- /dev/null +++ b/content/changes/2013-10-04-oauth-changes-coming.html @@ -0,0 +1,41 @@ +--- +kind: change +title: OAuth changes coming +created_at: 2013-10-04 +author_name: tclem +--- + +Starting today, we are returning granted scopes as part of the +[access_token response](/v3/oauth/#github-redirects-back-to-your-site). +For example, if you are making a POST with the `application/json` +mime-type you'll see an additional field for the granted scopes. + +

+{
+  "access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a",
+  "scope":"repo,gist",
+  "token_type":"bearer"
+}
+
+ +Right now, these scopes will be identical to what you requested, but we +are moving towards a feature set that will allow GitHub users to edit +their scopes, effectively granting your application less access than you +originally requested. You should be aware of this possibility and adjust +your application behavior accordingly. + +Some things to watch out for and keep in mind: + +- Most third party applications using GitHub OAuth to identify users have +the best success in adoption by starting out with a request for the +minimum access that the application can possibly get away with. +Something like no scopes or just `user:email` is very sane. + +- It is important to handle the error cases where a user chooses to +grant you less access than you originally requested. Now that we are +surfacing the granted scopes on the access_token response, applications +can warn or otherwise communicate with their users that they will see +reduced functionality or be unable to perform some actions. + +- Applications can always send users back through the flow again to get +additional permission, but don't forget that users can always say no. diff --git a/content/changes/2013-10-08-list-all-user-teams.html b/content/changes/2013-10-08-list-all-user-teams.html new file mode 100644 index 0000000000..e604a6eeee --- /dev/null +++ b/content/changes/2013-10-08-list-all-user-teams.html @@ -0,0 +1,42 @@ +--- +kind: change +title: List all teams for the authenticated user +created_at: 2013-10-08 +author_name: pengwynn +--- + +We just added a [new API method](/v3/orgs/teams/#list-user-teams) to list all +the teams for the authenticated user across all organizations: + +
+$ curl -H "Authorization: token [yours]" https://api.github.com/user/teams
+
+[
+  {
+    "name": "Testing",
+    "id": 396018,
+    "slug": "testing",
+    "permission": "pull",
+    "url": "https://api.github.com/teams/396018",
+    "members_url": "https://api.github.com/teams/396018/members{/member}",
+    "repositories_url": "https://api.github.com/teams/396018/repos",
+    "members_count": 1,
+    "repos_count": 0,
+    "organization": {
+      "login": "dotfiles",
+      "id": 1593590,
+      "url": "https://api.github.com/orgs/dotfiles",
+      "repos_url": "https://api.github.com/orgs/dotfiles/repos",
+      "events_url": "https://api.github.com/orgs/dotfiles/events",
+      "members_url": "https://api.github.com/orgs/dotfiles/members{/member}",
+      "public_members_url": "https://api.github.com/orgs/dotfiles/public_members{/member}",
+      "avatar_url": "https://0.gravatar.com/avatar/67d30facf213f62853c119fc2a05e246?d=https%3A%2F%2Fidenticons.github.com%2Fc90a68e6ab739e81c642f0e93f88c722.png"
+    }
+  },
+  ...
+]
+
+ +As always, if you have any questions or feedback, please [drop us a line][contact]. + +[contact]: https://github.com/contact?form[subject]=API+-+Listing+Teams+for+User diff --git a/content/changes/2013-10-18-new-code-search-requirements.md b/content/changes/2013-10-18-new-code-search-requirements.md new file mode 100644 index 0000000000..bef8684509 --- /dev/null +++ b/content/changes/2013-10-18-new-code-search-requirements.md @@ -0,0 +1,61 @@ +--- +kind: change +title: New Validation Rule for Beta Code Search API +created_at: 2013-10-18 +author_name: jasonrudolph +--- + +As we [prepare to end the preview period][sept-search-api-post] for the new search API, +we're making sure that it's ready to handle the traffic from all the apps you'll build on top of it. + +## New Validation Rule + +In order to support the expected volume of requests, we're applying a new validation rule to the [Code Search API][code-search-api]. +Starting today, you will need to scope your code queries to a specific set of users, organizations, or repositories. + +As usual, you specify the query via the `q` parameter. +The value must include [at least one user, organization, or repository][search-by-user-org-repo]. + +For example, with this query, we're searching for code from [@twitter][] or [@facebook][] that uses an MIT License: + + MIT License user:twitter user:facebook + +And here, we're looking for uses of the underscore library in [@mozilla's BrowserQuest][@mozilla/BrowserQuest] repository: + + underscore language:js repo:mozilla/BrowserQuest + +To perform these queries via the API, we would use the following URLs (respectively): + + https://api.github.com/search/code?q=MIT+License+user%3Atwitter+user%3Afacebook + + https://api.github.com/search/code?q=underscore+language%3Ajs+repo%3Amozilla%2FBrowserQuest + +All the various [code search qualifiers][code-search-qualifiers] are still available to you. +A [user, organization, or repository qualifier][search-by-user-org-repo] is now required. +The other search qualifiers are still optional. + +## Other Search Types Not Affected + +This new validation only applies to the [Code Search API][code-search-api]. +It does not apply to the Search API for [issues][issue-search-api], [users][user-search-api], or [repositories][repo-search-api]. + +This validation does not affect searches performed on [github.com/search][web-search]. + +By ensuring that code queries are more targeted in nature, the API will be ready to meet the expected demand from all your apps. +As we continue to tune the Search API, we hope to relax this validation in the future. +There's no ETA, but we'd like to relax it as soon as it's feasible. + +As always, if you have any questions or feedback, please [get in touch][contact]. + +[@facebook]: https://github.com/facebook +[@twitter]: https://github.com/twitter +[@mozilla/BrowserQuest]: https://github.com/mozilla/BrowserQuest +[code-search-api]: /v3/search/#search-code +[code-search-qualifiers]: https://help.github.com/articles/searching-code +[contact]: https://github.com/contact?form[subject]=New+Validation+Rule+for+Code+Search+API +[issue-search-api]: /v3/search/#search-issues +[repo-search-api]: /v3/search/#search-repositories +[search-by-user-org-repo]: https://help.github.com/articles/searching-code#users-organizations-and-repositories +[sept-search-api-post]: /changes/2013-09-28-an-update-on-the-new-search-api/ +[user-search-api]: /v3/search/#search-users +[web-search]: https://github.com/search diff --git a/content/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3.md b/content/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3.md new file mode 100644 index 0000000000..e9fb466d7f --- /dev/null +++ b/content/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3.md @@ -0,0 +1,32 @@ +--- +kind: change +title: Search API Becomes an Official Part of API v3 +created_at: 2013-10-29 +author_name: jasonrudolph +--- + +We're excited to announce that the [new Search API][search-api] has graduated from [preview mode][preview-period]. +As of today, the Search API is an official part of [GitHub API v3](/v3). +As such, the Search API is now stable and suitable for production use. + +### Preview Media Type No Longer Needed + +If you used the Search API during the preview period, you needed to provide a custom media type in the `Accept` header: + + application/vnd.github.preview+json + +Now that the preview period has ended, you no longer need to pass this custom media type. + +Instead, we [recommend][media-types] that you specify `v3` as the version in the `Accept` header: + + application/vnd.github.v3+json + +### Onward! + +Thanks again to everyone that tried out the Search API during the preview period. + +We can't wait to see what you build! + +[media-types]: /v3/media +[preview-period]: /changes/2013-07-19-preview-the-new-search-api/#preview-period +[search-api]: /v3/search diff --git a/content/changes/2013-11-04-releases-api-is-official.md b/content/changes/2013-11-04-releases-api-is-official.md new file mode 100644 index 0000000000..9691006777 --- /dev/null +++ b/content/changes/2013-11-04-releases-api-is-official.md @@ -0,0 +1,34 @@ +--- +kind: change +title: Releases API is Official +created_at: 2013-11-04 +author_name: technoweenie +--- + +Hot on the heels of the [Search API][search-api], the [Releases API][releases-api] +is now officially part of GitHub API v3. We now consider it stable for +production use. + +### Preview Media Type No Longer Needed + +If you used the Releases API during the preview period, you needed to provide a custom media type in the `Accept` header: + + application/vnd.github.manifold-preview+json + +Now that the preview period has ended, you no longer need to pass this custom media type. + +Instead, we [recommend][media-types] that you specify `v3` as the version in the `Accept` header: + + application/vnd.github.v3+json + +### Onward! + +Thanks again to everyone that tried out the Releases API during the preview period. +We got some great feedback, and we are already discussing additions to the API. + +We can't wait to see what you ship! + +[media-types]: /v3/media +[preview-period]: /changes/2013-07-19-preview-the-new-search-api/#preview-period +[releases-api]: /v3/repos/releases/ +[search-api]: http://developer.github.com/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3/ diff --git a/content/changes/2013-12-13-paginating-org-members.md b/content/changes/2013-12-13-paginating-org-members.md new file mode 100644 index 0000000000..a6f89987ad --- /dev/null +++ b/content/changes/2013-12-13-paginating-org-members.md @@ -0,0 +1,25 @@ +--- +kind: change +title: Paginated results for organization members +created_at: 2013-12-13 +author_name: pengwynn +--- + +The [organization members][members] and [organization public members][public +members] methods will soon return paginated results by default. Beginning +today, these methods will paginate if you include `page` or `per_page` query +parameters. Starting January 15th, 2014, these methods will _always_ return paginated +results. + +As always, be sure and follow those [Link headers][paginating] to get +subsequent results. If you have any questions or run into trouble, feel free to +[get in touch][contact]. + +Happy paginating. + + +[members]: http://developer.github.com/v3/orgs/members/#members-list +[public members]: http://developer.github.com/v3/orgs/members/#public-members-list +[paginating]: http://developer.github.com/v3/#pagination +[contact]: https://github.com/contact?form[subject]=API+v3:+Paginating+org+members + diff --git a/content/changes/2013-2-13-hookshot-issues.html b/content/changes/2013-2-13-hookshot-issues.html new file mode 100644 index 0000000000..6141df4757 --- /dev/null +++ b/content/changes/2013-2-13-hookshot-issues.html @@ -0,0 +1,20 @@ +--- +kind: change +title: Some Hookshot Issues +created_at: 2013-2-13T11:00:00 +author_name: technoweenie +--- + +We turned Hookshot (our new GitHub Services backend) on yesterday. Things have +been pretty smooth, with one issue: Hooks going to other EC2 nodes come from +the private IP addresses of our nodes in the 10.*.*.* range. + +If your web hook servers are on EC2 and are missing hooks from GitHub due to +an IP restriction, we recommend the following: + +1. Remove the IP white list. +2. Fall back to HTTPS and Basic Auth to restrict pushes to authorized senders only. + +We're currently working on solving this problem. Hit up [support@github.com](mailto:support@github.com) +if you have any questions. + diff --git a/content/changes/2013-2-13-hookshot-load-balancer.html b/content/changes/2013-2-13-hookshot-load-balancer.html new file mode 100644 index 0000000000..6e605af7e4 --- /dev/null +++ b/content/changes/2013-2-13-hookshot-load-balancer.html @@ -0,0 +1,13 @@ +--- +kind: change +title: Hookshot Load balancer +created_at: 2013-2-13T12:00:00 +author_name: technoweenie +--- + +We had an issue with the Hookshot load balancer this morning, causing the +majority of hooks to flow to a single node only. This lead to massive queue +times. While fixing this, we're putting the old Services backend in use. + +This means the old IPs are back in use. Use this [Help guide](https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist) +if you already removed them from your firewall. diff --git a/content/changes/2013-2-13-sortable-stars.html b/content/changes/2013-2-13-sortable-stars.html new file mode 100644 index 0000000000..fbaf50dab0 --- /dev/null +++ b/content/changes/2013-2-13-sortable-stars.html @@ -0,0 +1,19 @@ +--- +kind: change +title: Sortable Stars in Repository Starring API +created_at: 2013-2-14 +author_name: pengwynn +--- + +As we [announced on the GitHub blog][post], Stars now support sorting. The +Repository Starring API now supports [two new parameters][params] when listing +Stars: `sort` and `direction`. + +
+curl https://api.github.com/users/defunkt/starred?sort=created&direction=asc
+
+ +Enjoy. + +[post]: https://github.com/blog/1410-sortable-stars +[params]: /v3/activity/starring/#list-repositories-being-starred diff --git a/content/changes/2013-2-5-changes-to-services.html b/content/changes/2013-2-5-changes-to-services.html new file mode 100644 index 0000000000..ba86cb0243 --- /dev/null +++ b/content/changes/2013-2-5-changes-to-services.html @@ -0,0 +1,34 @@ +--- +kind: change +title: Upcoming Changes to GitHub Services +created_at: 2013-2-5 +author_name: technoweenie +--- + +We are finishing up a new GitHub Services backend, dubbed "Hookshot", to +increase the speed and reliability of our delivered payloads. We are doing +what we can to make this a seamless transition for everyone. However, there +are a few notable changes. + +* There is a new [Meta API endpoint](http://developer.github.com/v3/meta/) +listing the current public IPs that hooks originate from. + +* We're removing the AMQP service from GitHub. It hasn't worked in quite some +time, and the code it uses doesn't work in our background workers. + +* We're also instituting a new guideline to improve the reliability and +maintainability of services in the future. As of today, all new services must +accept an unmodified payload over HTTP. Any service that does not will be +rejected. To see an example of an acceptable service, check out [Code Climate][codeclimate]. +Notice their service simply accepts HTTP POST from GitHub unmodified. For an +example of a service that won't be accepted after today, check out [Campfire][cf]. It +uses other Ruby gems and contains custom logic to transform the GitHub payload +to Campfire messages. Existing hooks will keep working (don't worry 37signals, we +:heart: Campfire). + +We're making these changes because we want to focus on the reliability of the +core Services backend for everyone. Maintaining custom logic and libraries for +over 100 services is taking too much of this focus away. + +[codeclimate]: https://github.com/github/github-services/blob/master/lib/services/codeclimate.rb +[cf]: https://github.com/github/github-services/blob/master/lib/services/campfire.rb diff --git a/content/changes/2013-3-1-new-hookshot-coming.html b/content/changes/2013-3-1-new-hookshot-coming.html new file mode 100644 index 0000000000..b0ede13721 --- /dev/null +++ b/content/changes/2013-3-1-new-hookshot-coming.html @@ -0,0 +1,25 @@ +--- +kind: change +title: New Hookshot Changes +created_at: 2013-3-1 +author_name: technoweenie +--- + +We are experimenting with changes to the "Hookshot" backend that powers service +hooks. There were some significant networking changes with the new cluster, +so there are some new IP whitelist rules for hooks: + +* 204.232.175.64/27 +* 192.30.252.0/22 + +These are in CIDR notation. They represent a significant range of GitHub +addresses, meaning this should be the last IP change for a while. Once this +cluster is activated and we shut the other cluster down, we will be removing +the other entries. + +We are currently testing the new backend with all repositories in the GitHub +organization only, and expect to start testing it with user data next week. + +This also means we should be able to start accepting [GitHub Services pull +requests](https://github.com/github/github-services/pulls) very soon :) + diff --git a/content/changes/2014-01-07-upcoming-change-to-default-media-type.md b/content/changes/2014-01-07-upcoming-change-to-default-media-type.md new file mode 100644 index 0000000000..730089e6f4 --- /dev/null +++ b/content/changes/2014-01-07-upcoming-change-to-default-media-type.md @@ -0,0 +1,62 @@ +--- +kind: change +title: Upcoming Change to Default Media Type +created_at: 2014-01-07 +author_name: jasonrudolph +--- + +On April 15, 2014[*](#cutover-test), the GitHub API will start serving the v3 media type by default. The information below will help you determine whether your applications will be affected by this change. For affected applications, you'll find tips below to help you smoothly navigate this change. + +## What's changing? + +### A new default version + +There are [two versions][versions] of the GitHub API: **beta** and **v3**. Today, requests receive the beta version by default. On April 15[*](#cutover-test), requests will begin receiving the v3 version by default. + +For the most part, beta and v3 are remarkably similar. There are [just a few differences][differences] to keep in mind. + +### A new default media type + +The version is one part of the [media type][media]. By default, the API provides the beta media type: + + application/vnd.github.beta+json + +On April 15[*](#cutover-test), requests will begin responding with the v3 media type by default: + + application/vnd.github.v3+json + +## Who is affected? + +Since 2012, we have encouraged developers to explicitly [request a specific media type via the `Accept` header][request-a-media-type]. If you are requesting either beta or v3 via the `Accept` header, then you are _not_ affected by this change. The API will continue to respond with the requested media type. + +If you are not requesting beta or v3 via the `Accept` header, then the API is currently responding with the beta media type. On April 15[*](#cutover-test), the API will begin responding with the v3 media type. If your application relies on [functionality that differs between beta and v3][differences], then you are affected by this change. You will need to take steps to prepare for the change. + +## What should you do? + +If you are affected by this change, we recommend that you: + +1. Update your applications to depend on the v3 functionality instead of the beta functionality. (If you use one of the popular [client libraries][libraries], there's a good chance that they've already done the work for you. In that case, you can just update to the latest version of that library.) +2. Request the v3 media type via the `Accept` header. + +If you cannot update your application to depend on the v3 functionality by April 15[*](#cutover-test), you can just request the beta media type via the `Accept` header. Doing so will insulate you from this change. + +## Cutover test on March 12, 2014 {#cutover-test} + +To help you understand the impact of this change before it becomes permanent, we will temporarily implement this change for a single day on March 12. From approximately 12:01am UTC to 11:59pm UTC on March 12, the API will respond with the v3 media type by default. + +Follow [@GitHubAPI][] to receive updates before and after the test. + +## Stay informed + +Depending on the results of the cutover test, we may schedule additional tests before the final cutover on April 15. If so, we'll to announce them in advance. Be sure to stay tuned to the [blog] or follow [@GitHubAPI] for updates. + +If you have any questions, please [get in touch][contact]. We'll be happy to help. + +[@GitHubAPI]: https://twitter.com/GitHubAPI +[blog]: /changes +[contact]: https://github.com/contact?form[subject]=Upcoming+change+to+default+API+media+type +[differences]: /v3/versions/#differences-from-beta-version +[libraries]: /libraries/ +[media]: /v3/media +[request-a-media-type]: /v3/media/#request-specific-version +[versions]: /v3/versions diff --git a/content/changes/2014-01-09-preview-the-new-deployments-api.md b/content/changes/2014-01-09-preview-the-new-deployments-api.md new file mode 100644 index 0000000000..003a99be33 --- /dev/null +++ b/content/changes/2014-01-09-preview-the-new-deployments-api.md @@ -0,0 +1,83 @@ +--- +kind: change +title: Preview the New Deployments API +created_at: 2014-01-09 +author_name: atmos +--- + +Today we're excited to announce a [Deployments API][docs]. We ship a lot of +software at GitHub: web, mobile, and native. For the last few years, we've been +driving our deployments from our [ChatOps tooling][chatops] and we've learned a +lot. The Deployments API is a generalization of the approach that we've been +taking, and we're really excited to see what our users and integrations start +building around it. + +Deployments are a new model in the GitHub ecosystem. We don't have any UI +components currently, and deployments are intended to be used exclusively by +tooling. If you're familiar with the Status API, you know that it allows +various tools to report on the status of a commit (e.g., the progress of an +attempt to perform a build at a particular commit). The Status API doesn't +perform the build; it just reports the results. Much like the Status API, we +won't be doing actual deployments for you. Instead, the API provides a way for +you to track the status of your deployments. We're hoping to provide +consistency across the various type of release processes, regardless of the +underlying steps involved with getting your code built or shipped to your +servers. + +## Highlights + +### Automatic Merging + +The system can auto-merge the default branch for the repository if the +requested deployment ref is behind the default branch. On active projects it's +easy to fall behind, so let automation watch your back. + +### Commit Status Integration + +By default, the system rejects deployment requests for repositories that have +commit statuses but don't have a green build for the deployment ref. This can +be bypassed, but is useful in cases where continuous integration is being used. + +### Force Deployments + +Sometimes the world crashes down on you, and you need to just get the code out +the door. Forced deployments bypass any commit status checks or ahead/behind +checks in the repository. + +### Deployment Statuses + +Different deployment systems can update the status of a deployment to be +`pending`, `success`, `failure`, or `error`. There's also a field for linking +to deployment output. + +### Events + +Both Deployments and Deployment Statuses trigger events on GitHub. 3rd party +integrations can listen for these events via [webhooks][hooks] and choose +whether or not to actually deploy the repository that the event was created for. + +## Preview Period + +We're making this new API available today for developers to +preview. We think developers and existing integrations are +going to love it, but we want to [get your feedback][contact] before we declare +the Deployments API "final" and "unchangeable." We expect the preview period to +last for roughly 60-90 days. + +As we discover opportunities to improve the API during the preview period, we +may ship changes that break clients using the preview version of the API. We +want to iterate quickly. To do so, we will announce any changes here (on the +developer blog), but we will not provide any advance notice. + +At the end of preview period, the Deployments API will become an official +component of GitHub API v3. At that point, the new Deployments API will be +stable and suitable for production use. + +We hope you’ll take it for a spin and [send us your feedback][contact]. + +![Shipit Squirrel](https://camo.githubusercontent.com/da8106f759bf0d163fb002e715fb1d1f1d2b6f4e/687474703a2f2f736869706974737175697272656c2e6769746875622e696f2f696d616765732f736869702532306974253230737175697272656c2e706e67) + +[docs]: /v3/repos/deployments/ +[hooks]: /v3/repos/hooks/ +[chatops]: https://speakerdeck.com/jnewland/chatops +[contact]: https://github.com/contact?form[subject]=Deployments+API diff --git a/content/changes/2014-01-29-audit-org-members-for-2fa.md b/content/changes/2014-01-29-audit-org-members-for-2fa.md new file mode 100644 index 0000000000..ddfe46dd3a --- /dev/null +++ b/content/changes/2014-01-29-audit-org-members-for-2fa.md @@ -0,0 +1,23 @@ +--- +kind: change +title: Audit organization members for two-factor authentication +created_at: 2014-01-29 +author_name: pengwynn +--- + +We've added a [new filter][filter] for listing members of an organization without +[two-factor authentication][2fa-blog] enabled: + + +
+$ curl -H "Authorization: token [yours]" \
+       https://api.github.com/orgs/[orgname]/members\?filter\=2fa_disabled
+
+ +The new filter is available for owners of organizations with private +repositories. Happy auditing and [send us your feedback or questions][contact]. + +[filter]: /v3/orgs/members/#audit-two-factor-auth +[2fa-blog]: https://github.com/blog/1614-two-factor-authentication +[contact]: https://github.com/contact?form[subject]=API+2FA+filter + diff --git a/content/changes/2014-02-10-repo-hook-scopes.md b/content/changes/2014-02-10-repo-hook-scopes.md new file mode 100644 index 0000000000..71c91bc8f7 --- /dev/null +++ b/content/changes/2014-02-10-repo-hook-scopes.md @@ -0,0 +1,22 @@ +--- +kind: change +title: New scopes for managing repository hooks +created_at: 2014-02-10 +author_name: pengwynn +--- + +Many third party services need to set up [hooks][] in order to act upon events +in your repositories. Today, we've introduced three new [scopes][] that provide +more granular access to your repository hooks without allowing access to your +repository contents: + +* `read:repo_hook` grants read and ping access to hooks in public or private repositories. +* `write:repo_hook` grants read, write, and ping access to hooks in public or private repositories. +* `admin:repo_hook` grants read, write, ping, and delete access to hooks in public or private repositories. + +As always, if you have any questions or feedback, [get in touch][contact]. + +[hooks]: http://developer.github.com/v3/repos/hooks/ +[scopes]: http://developer.github.com/v3/oauth/#scopes +[contact]: https://github.com/contact?form%5Bsubject%5D=API+repo+hook+scopes + diff --git a/content/changes/2014-02-13-exposing-the-page-api.html b/content/changes/2014-02-13-exposing-the-page-api.html new file mode 100644 index 0000000000..314aed7336 --- /dev/null +++ b/content/changes/2014-02-13-exposing-the-page-api.html @@ -0,0 +1,14 @@ +--- +kind: change +title: Introducing the Pages API +created_at: 2014-02-13 +author_name: gjtorikian +--- + +We've created [a new API to GitHub Pages](/v3/repos/pages/). This API is accessible +by owners of a Pages repo, whether it's owned by an individual or an organization. + +With the Pages API, you can get information about your site, as well as details +on previous Pages builds. + +Enjoy! diff --git a/content/changes/2014-02-19-repo-contributors-for-empty-repos.md b/content/changes/2014-02-19-repo-contributors-for-empty-repos.md new file mode 100644 index 0000000000..67f10dde2f --- /dev/null +++ b/content/changes/2014-02-19-repo-contributors-for-empty-repos.md @@ -0,0 +1,10 @@ +--- +kind: change +title: Repository Contributors and Empty Repositories +created_at: 2014-02-20 +author_name: izuzak +--- + +We've made a small change to the [Repository Contributors API](/v3/repos/#list-contributors) in the way empty repositories are handled. Previously, the API returned a `404 Not Found` status when the list of contributors was fetched for an empty repository. To improve consistency with other API endpoints and reduce confusion, the API now returns a `204 No Content` status instead. + +If you notice any strangeness, [just let us know](https://github.com/contact?form%5Bsubject%5D=APIv3). diff --git a/content/changes/2014-02-21-gist-raw-file-url-change.md b/content/changes/2014-02-21-gist-raw-file-url-change.md new file mode 100644 index 0000000000..8d98f7097f --- /dev/null +++ b/content/changes/2014-02-21-gist-raw-file-url-change.md @@ -0,0 +1,9 @@ +--- +kind: change +title: Gist raw file URI change +created_at: 2014-02-21 +author_name: spicycode +--- + +The raw host for all Gist files is changing immediately. This change was made to further isolate user content from trusted GitHub applications. +The new host is ```https://gist.githubusercontent.com```. Existing URIs will redirect to the new host. diff --git a/content/changes/2014-02-24-finer-grained-scopes-for-ssh-keys.md b/content/changes/2014-02-24-finer-grained-scopes-for-ssh-keys.md new file mode 100644 index 0000000000..c84ec89abb --- /dev/null +++ b/content/changes/2014-02-24-finer-grained-scopes-for-ssh-keys.md @@ -0,0 +1,35 @@ +--- +kind: change +title: Finer-grained OAuth scopes for SSH keys +created_at: 2014-02-24 +author_name: pengwynn +--- +As [we announced][blog], we've made some important changes to the way that API consumers manage SSH keys. + +## Finer-grained OAuth scopes + +To help third party applications request only permissions that they need, the API now supports three new [scopes][] for working with a user's public SSH keys. + +- `read:public_key` provides read access to the user's SSH keys +- `write:public_key` allows an app to read existing keys and create new ones +- `admin:public_key` enables an app to read, write, and delete keys + +## Changes to `user` scope + +Historically, `user` scope has provided full access to manage a user's SSH keys. Now that we have dedicated scopes for managing a user's SSH keys, we have removed those permissions from the `user` scope. Now `user` scope will no longer provide access to SSH keys. Applications that need this access should request one of the new scopes described above. + +## Keys are now immutable + +To simplify the security audit trail for SSH keys, we're making keys immutable. API consumers can continue to create keys and delete keys as needed, but keys can no longer be changed. To change an existing key, API consumers should delete the existing key and create a new one with the desired attributes. This change applies both to a [user's SSH keys][user-keys] and a [repository's deploy keys][deploy-keys]. + +## Deleting keys when revoking a token + +Also any keys created via an OAuth token from this point forward will be deleted when that token is revoked. + +As always, if you have any questions or feedback, [please get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=API+improvements+for+SSH+keys +[scopes]: /v3/oauth/#scopes +[user-keys]: /v3/users/keys/ +[deploy-keys]: /v3/repos/keys/ +[blog]: https://github.com/blog/1786-enhanced-oauth-security-for-ssh-keys diff --git a/content/changes/2014-02-24-wildcard-event-for-webhooks.md b/content/changes/2014-02-24-wildcard-event-for-webhooks.md new file mode 100644 index 0000000000..5e9a29a7b7 --- /dev/null +++ b/content/changes/2014-02-24-wildcard-event-for-webhooks.md @@ -0,0 +1,14 @@ +--- +kind: change +title: Wildcard Event for Webhooks +created_at: 2014-2-24 +author_name: kdaigle +--- + +We've made a small change to make it easier for webhook integrators to receive "everything". +Instead of adding every event to your webhook, you can now opt-in to all events (including +all new events in the future) by using the [wildcard event](/webhooks/#wildcard-event) (`*`). + +If you add this event to an existing webhook, we'll remove the existing specific events and +send you payloads for all supported events. As we add new events, you'll automatically +begin receiving those too. diff --git a/content/changes/2014-02-25-organization-oauth-scopes.md b/content/changes/2014-02-25-organization-oauth-scopes.md new file mode 100644 index 0000000000..40911b2b3e --- /dev/null +++ b/content/changes/2014-02-25-organization-oauth-scopes.md @@ -0,0 +1,21 @@ +--- +kind: change +title: OAuth scopes for organization and team resources +created_at: 2014-02-25 +author_name: pengwynn +--- +As a follow up to [the new scopes][yesterday] we announced yesterday, we've +introduced even more OAuth scopes for working with organization and team +resources: + +- `read:org` provides read-only access to organizations, teams, and membership. +- `write:org` allows an application to publicize and unpublicize an organization membership. +- `admin:org` enables an application to fully manage organizations, teams, and memberships. + +Check out [the full list of OAuth scopes][scopes] supported by the API to +ensure your application asks for only the permissions it needs. As always, if +you have any questions or feedback, [get in touch][contact]. + +[yesterday]: http://developer.github.com/changes/2014-02-24-finer-grained-scopes-for-ssh-keys/ +[scopes]: /v3/oauth/#scopes +[contact]: https://github.com/contact?form[subject]=API+org+scopes diff --git a/content/changes/2014-02-28-issue-and-pull-query-enhancements.md b/content/changes/2014-02-28-issue-and-pull-query-enhancements.md new file mode 100644 index 0000000000..c5a052bd31 --- /dev/null +++ b/content/changes/2014-02-28-issue-and-pull-query-enhancements.md @@ -0,0 +1,27 @@ +--- +kind: change +title: Query enhancements for listing issues and pull requests +created_at: 2014-02-28 +author_name: pengwynn +--- +We've made it even easier to list all [issues][] and [pull requests][] via the API. +The `state` parameter now supports a value of `all` that will return issues and +pull requests regardless of state. + +
+$ curl https://api.github.com/repos/atom/vim-mode/issues\?state\=all
+
+ +We've also introduced new sorting options for [listing pull requests][pull +requests]. You can now sort pull requests by `created`, `updated`, +`popularity`, and `long-running`. + +
+$ curl https://api.github.com/repos/rails/rails/pulls\?sort\=long-running\&direction\=desc
+
+ +Happy querying. If you have any questions or feedback [get in touch][contact]. + +[issues]: /v3/issues/#list-issues +[pull requests]: /v3/pulls/#list-pull-requests +[contact]: https://github.com/contact?form[subject]=API+query+enhancements diff --git a/content/changes/2014-03-03-deployments-api-updates.md b/content/changes/2014-03-03-deployments-api-updates.md new file mode 100644 index 0000000000..b4354c8dee --- /dev/null +++ b/content/changes/2014-03-03-deployments-api-updates.md @@ -0,0 +1,21 @@ +--- +kind: change +title: New Payload Format for Deployments +created_at: 2014-03-03 +author_name: atmos +--- + +As we [iterate on the preview][january-deployment-api-post] for the new Deployments API, we're making sure that it's friendly to work with for the apps built on top of it. + +## Deserialize Deployment Payloads + +To make the API even easier to use, we'll now return your custom payload as a JSON object along with the rest of the Deployment resource. No need to parse it as JSON again. + +## Code You Need to Update + +You should only need to remove the JSON parsing if you're taking advantage of the custom payloads. The formats for creating Deployments remain unchanged. + +As always, if you have any questions or feedback, please [get in touch][contact]. + +[january-deployment-api-post]: /changes/2014-01-09-preview-the-new-deployments-api/ +[contact]: https://github.com/contact?form[subject]=Deployments+API diff --git a/content/changes/2014-03-04-timezone-handling-changes.html b/content/changes/2014-03-04-timezone-handling-changes.html new file mode 100644 index 0000000000..8642f0c46c --- /dev/null +++ b/content/changes/2014-03-04-timezone-handling-changes.html @@ -0,0 +1,54 @@ +--- +kind: change +title: Improved timezone handling in the API +created_at: 2014-03-04 +author_name: dbussink +--- + +We have improved support for handling timezones in our API. For example, if you +create commits through the API, we now allow for specifying timezone information +more accurately. + +We apply the following rules, in order of priority, to determine timezone +information for API calls: + +#### Explicitly provide an ISO 8601 timestamp with timezone information + +For API calls that allow for a timestamp to be specified, we use that exact +timestamp. An example of this is the [Commits API](/v3/git/commits) which allows +for specifying the `date` property. + +<%= json "message"=> "my commit message", \ + "author"=> \ + {"name" => "Dirkjan Bussink", "email" => "d.bussink@gmail.com", \ + "date" => "2014-02-27T15:05:06+01:00"}, \ + "parents"=>["7d1b31e74ee336d15cbd21741bc88a537ed063a0"], \ + "tree"=>"827efc6d56897b048c772eb4087f854f46256132" %> + +#### Using the `Time-Zone` header + +It is possible to supply a `Time-Zone` header which defines a timezone according +to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + + $ curl -H "Time-Zone: Europe/Amsterdam" -X POST https://api.github.com/repos/github/linguist/contents/new_file.md + +This means that we generate a timestamp for the moment your API call is made in +the timezone this header defines. For example, the [Contents API](/v3/repos/contents/) +generates a git commit for each addition or change and uses the current time +as the timestamp. This header will determine the timezone used for generating +that current timestamp. + +#### Using the last known timezone for the user + +If no `Time-Zone` header is specified and you make an authenticated call to the +API, we use the last known timezone for the authenticated user. The last know +timezone is updated whenever you browse the GitHub.com website. + +#### UTC + +If the steps above don't result in any information, we use UTC as the timezone +to create the git commit. + +If you have any questions or feedback, don't hesitate to [contact] us! + +[contact]: https://github.com/contact?form[subject]=API+timezones diff --git a/content/changes/2014-03-05-reminder-about-upcoming-cutover-test.md b/content/changes/2014-03-05-reminder-about-upcoming-cutover-test.md new file mode 100644 index 0000000000..e19dd70b96 --- /dev/null +++ b/content/changes/2014-03-05-reminder-about-upcoming-cutover-test.md @@ -0,0 +1,21 @@ +--- +kind: change +title: "Reminder: March 12 Cutover Test for Default Media Type" +created_at: 2014-03-05 +author_name: jasonrudolph +--- + +In January, we announced an [upcoming change to the default media type][2014-01-announcement]. To help developers assess the impact of that change before it becomes permanent, we're performing a [24-hour cutover test next week][cutover-test-announcement]. + +From approximately 12:01am UTC to 11:59pm UTC on March 12, the API will [respond with the v3 media type by default][what's-changing]. (See the [start time for the cutover test in your time zone][start-time].) + +Follow [@GitHubAPI][] to receive updates before and after the test. + +Please see the [original announcement][2014-01-announcement] for full details. If you have any questions, please [get in touch][contact]. + +[@GitHubAPI]: https://twitter.com/GitHubAPI +[2014-01-announcement]: /changes/2014-01-07-upcoming-change-to-default-media-type/ +[contact]: https://github.com/contact?form[subject]=Upcoming+change+to+default+API+media+type +[cutover-test-announcement]: /changes/2014-01-07-upcoming-change-to-default-media-type/#cutover-test +[start-time]: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20140312T00&p1=1440 +[what's-changing]: /changes/2014-01-07-upcoming-change-to-default-media-type/#whats-changing diff --git a/content/changes/2014-03-12-page-build-event-for-webhooks.md b/content/changes/2014-03-12-page-build-event-for-webhooks.md new file mode 100644 index 0000000000..bdc50b2a1c --- /dev/null +++ b/content/changes/2014-03-12-page-build-event-for-webhooks.md @@ -0,0 +1,14 @@ +--- +kind: change +title: Page Build Event for Webhooks +created_at: 2014-3-12 +author_name: benbalter +--- + +We've made it even easier to track the status of your [GitHub Pages](http://pages.github.com/) builds. By subscribing to the new [`page_build`](/v3/activity/events/types/#pagebuildevent) event, your application will receive an event payload containing the results of each build. (As always, these builds occur automatically following each push to a GitHub Pages-enabled branch.) + +If you have a [webhook](/webhooks/) with the ["send me everything" option](https://github.com/blog/1778-webhooks-level-up) selected (or if you use the "[wildcard event](/changes/2014-02-24-wildcard-event-for-webhooks/)" via the API), you will receive the `page_build` event after the next build of your GitHub Pages site. Alternatively, if you prefer to subscribe to specific event types, you can add to the new `page_build` event to your webhooks via your repository's webhook settings page or via the [webhooks API](/v3/repos/hooks/). + +For more information, be sure to check out our guide on [working with webhooks](/webhooks/). If you have any questions or feedback, please [drop us a line][contact]. + +[contact]: https://github.com/contact?form%5Bsubject%5D=API+Page+Build+Event diff --git a/content/changes/2014-03-18-paginating-method-changes.md b/content/changes/2014-03-18-paginating-method-changes.md new file mode 100644 index 0000000000..7366e928ae --- /dev/null +++ b/content/changes/2014-03-18-paginating-method-changes.md @@ -0,0 +1,130 @@ +--- +kind: change +title: Pagination changes for some resource lists +created_at: 2014-03-18 +author_name: pengwynn +--- + +In an effort to keep the API fast for everyone, we're enabling +[pagination][paginating] on some API methods that previously did not support it. +Beginning today, the methods below will paginate if you include `page` or +`per_page` query parameters. Starting April 17th, 2014, these methods will +_always_ return [paginated results][paginating]. If you have any questions or +run into trouble, feel free to [get in touch][contact]. + +Here's the complete list of updated methods: + +#### [Gist comments][] + + GET /gists/:gist_id/comments + +#### [Gist commits][] + + GET /gists/:gist_id/commits + +#### [Gist forks][] + + GET /gists/:gist_id/forks + +#### [Git refs][] + + GET /repos/:owner/:repo/git/refs + +#### [Issue labels][] + + GET /repos/:owner/:repo/issues/:number/labels + +#### [Milestone labels][] + + GET /repos/:owner/:repo/milestones/:id/labels + +#### [Organization teams][] + + GET /orgs/:org/teams + +#### [Pull Request commits][] + + GET /repos/:owner/:repo/pulls/:number/commits + +#### [Pull Request files][] + + GET /repos/:owner/:repo/pulls/:number/files + +#### [Release assets][] + + GET /repos/:owner/:repo/releases/:id/assets + +#### [Repository collaborators][] + + GET /repos/:owner/:repo/collaborators + +#### [Repository contributors][] + + GET /repos/:owner/:repo/contributors + +#### [Repository branches][] + + GET /repos/:owner/:repo/branches + +#### [Repository downloads][] + + GET /repos/:owner/:repo/downloads + +#### [Repository keys][] + + GET /repos/:owner/:repo/keys + +#### [Repository labels][] + + GET /repos/:owner/:repo/labels + +#### [Repository tags][] + + GET /repos/:owner/:repo/tags + +#### [Repository teams][] + + GET /repos/:owner/:repo/teams + +#### [Team members][] + + GET /teams/:id/members + +#### [Team repositories][] + + GET /teams/:id/repos + +#### [User emails][] (v3 media type only) + + GET /user/emails + +#### [User keys][] + + GET /users/:user/keys + GET /user/keys + +[Gist comments]: /v3/gists/comments/#list-comments-on-a-gist +[Gist commits]: /v3/gists/#list-gist-commits +[Gist forks]: /v3/gists/#list-gist-forks +[Git refs]: /v3/git/refs/#get-all-references +[Repository collaborators]: /v3/repos/collaborators/#list +[Repository downloads]: /v3/repos/downloads/#list-downloads-for-a-repository +[Repository keys]: /v3/repos/keys/#list +[Repository labels]: /v3/issues/labels/#list-all-labels-for-this-repository +[Team repositories]: /v3/orgs/teams/#list-team-repos +[User emails]: /v3/users/emails/#list-email-addresses-for-a-user +[User keys]: /v3/users/keys/#list-public-keys-for-a-user +[Issue labels]:/v3/issues/labels/#list-labels-on-an-issue +[Milestone labels]: /v3/issues/labels/#get-labels-for-every-issue-in-a-milestone +[Organization teams]: /v3/orgs/teams/#list-teams +[Pull Request commits]: /v3/pulls/#list-commits-on-a-pull-request +[Pull Request files]: /v3/pulls/#list-pull-requests-files +[Release assets]: /v3/repos/releases/#list-assets-for-a-release +[Repository contributors]: /v3/repos/#list-contributors +[Repository branches]: /v3/repos/#list-branches +[Repository tags]: /v3/repos/#list-tags +[Repository teams]: /v3/repos/#list-teams +[Team members]: /v3/orgs/teams/#list-team-members + +[paginating]: /v3/#pagination +[contact]: https://github.com/contact?form[subject]=API+v3:+Pagination+changes diff --git a/content/changes/2014-03-27-combined-status-api.md b/content/changes/2014-03-27-combined-status-api.md new file mode 100644 index 0000000000..bb1c5dd742 --- /dev/null +++ b/content/changes/2014-03-27-combined-status-api.md @@ -0,0 +1,56 @@ +--- +kind: change +title: Preview the New Combined Status API +created_at: 2014-03-27 +author_name: bhuga +--- + +What does it mean for a branch to be "green?" The [Status API][status-api] helps +thousands of teams answer that question. Developers use it to record the status +of continuous integration builds, contributor license agreements, code coverage +analysis, automated security testing, dependency management, and more. + +For many teams, a branch is considered "green" only when _all_ of their various +status checks are successful. With the new [Combined Status +API][combined-status-api], developers can easily fetch this single, consolidated +status for any branch, commit, or tag. + +### Status context + +To help multiple service providers use the Status API simultaneously, statuses +now support a `context` field. This field allows a provider to distinguish its +statuses from another provider's statuses. For example, your [Jenkins][] builds +might use a context of `ci/jenkins`, while your [Brakeman][] checks might adopt a +context of `security/brakeman`. + +The new [Combined Status endpoint][combined-status-api] returns a single, +combined state, as well as the latest status from each context. Systems that +consume status updates can now get all the information they need in one place. + +### Opt-in + +The existing [Status API][list-statuses] continues to work as it always has. The +`context` field is entirely optional, and the [color of the merge button on pull +requests](https://github.com/blog/1227-commit-status-api) does not currently +take context into account. + +### Preview period + +We're making this new API available today for developers to +[preview][status-api]. During this period, we may change aspects of the Combined +Status API from time to time. We will announce any changes here (on the +developer blog), but we will not provide any advance notice. + +We expect the preview period to last 30-60 days. At the end of preview period, +the Combined Status API will become an official component of GitHub API v3. At +that point, this new API will be stable and suitable for production use. + +We hope you'll [try it out][status-api] and [send us your feedback][contact]! + +[status-api]: /v3/repos/statuses/ +[contact]: https://github.com/contact?form[subject]=Combined+Status+API +[combined-status-api]: /v3/repos/statuses/#get-the-combined-status-for-a-specific-ref +[create-a-status]: /v3/repos/statuses/#create-a-status +[brakeman]: http://brakemanscanner.org/ +[jenkins]: http://jenkins-ci.org/ +[list-statuses]: /v3/repos/statuses/#list-statuses-for-a-specific-ref diff --git a/content/changes/2014-04-04-create-public-repo-without-repo-scope.md b/content/changes/2014-04-04-create-public-repo-without-repo-scope.md new file mode 100644 index 0000000000..b1627b6f2b --- /dev/null +++ b/content/changes/2014-04-04-create-public-repo-without-repo-scope.md @@ -0,0 +1,17 @@ +--- +kind: change +title: Grant access to create public repositories without granting access to private repositories +created_at: 2014-04-04 +author_name: pengwynn +--- + +The [Create Repository method][api] now allows creating public repositories via +OAuth with `public_repo` [scope][]. This means you can safely grant third +party applications the ability to create public repositories on your behalf +without granting access to your private repositories. + +If you have any questions or feedback, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=API+create+repositories+with+public_repo+scope +[api]: /v3/repos/#create +[scope]: /v3/oauth/#scopes diff --git a/content/changes/2014-04-07-understanding-search-results-and-potential-timeouts.md b/content/changes/2014-04-07-understanding-search-results-and-potential-timeouts.md new file mode 100644 index 0000000000..baf4f56c8a --- /dev/null +++ b/content/changes/2014-04-07-understanding-search-results-and-potential-timeouts.md @@ -0,0 +1,25 @@ +--- +kind: change +title: Understanding search results and potential timeouts +created_at: 2014-04-07 +author_name: izuzak +--- + +Some queries are computationally expensive for our search infrastructure to +execute. To keep the [Search API](/v3/search) fast for everyone, we limit how +long any individual query can run. In rare situations when a query exceeds the +time limit, the API returns all matches that were found prior to the timeout. + +Starting today, the Search API also now [informs you when such a timeout +happens](/v3/search/#timeouts-and-incomplete-results). Reaching a timeout does +not necessarily mean that search results are incomplete. It just means that the +query was discontinued before it searched through all possible data. More +results might have been found, but also might not. + +In some cases, if you know that your search results are potentially incomplete, +you might think about the data differently. By exposing timeouts when they +happen, the API helps you better understand how to interpret the results. + +We hope this is useful as you integrate with the Search API. In the meantime, +we're working on improving search so that these timeouts occur as rarely as +possible. If you have any questions, [let us know](https://github.com/contact?form%5Bsubject%5D=Search+API). diff --git a/content/changes/2014-04-08-reset-api-tokens.md b/content/changes/2014-04-08-reset-api-tokens.md new file mode 100644 index 0000000000..ebaf80f642 --- /dev/null +++ b/content/changes/2014-04-08-reset-api-tokens.md @@ -0,0 +1,30 @@ +--- +kind: change +title: "Recommendation: Reset OAuth authorizations" +created_at: 2014-04-08 +author_name: pengwynn +--- + +As [announced earlier today][heartbleed-blog-post], we are actively responding +to the recently-disclosed [Heartbleed security +vulnerability][heartbleed-blog-post] in OpenSSL. While at this time GitHub has +no indication that the attack has been used beyond testing the vulnerability, we +recommend that integrators [reset the API authorizations][api] for their OAuth +applications. + +We've added a [new API method][api] for this exact purpose. Calling this method +will invalidate the old token and return a new token for applications to store +and use in its place. This new method provides a safe way to reset user +authorizations without requiring users to re-authorize the application on the +web. + +Integrators can also use the existing revocation methods to [revoke all +tokens][] or [revoke a single token][] for their applications. + +If you have any questions or feedback, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=API+resetting+tokens +[api]: /v3/oauth_authorizations/#reset-an-authorization +[revoke all tokens]: /v3/oauth_authorizations/#revoke-all-authorizations-for-an-application +[revoke a single token]: /v3/oauth_authorizations/#revoke-an-authorization-for-an-application +[heartbleed-blog-post]: https://github.com/blog/1818-security-heartbleed-vulnerability diff --git a/content/changes/2014-04-09-reminder-about-default-media-type-change.md b/content/changes/2014-04-09-reminder-about-default-media-type-change.md new file mode 100644 index 0000000000..295c34071a --- /dev/null +++ b/content/changes/2014-04-09-reminder-about-default-media-type-change.md @@ -0,0 +1,16 @@ +--- +kind: change +title: "Reminder: Default media type will change on April 15" +created_at: 2014-04-09 +author_name: jasonrudolph +--- + +Just a friendly reminder: On April 15, 2014, the GitHub API will start serving the v3 media type by default. Please see the [original announcement][2014-01-announcement] for full details about [this change][what's-changing], [who it affects][who-it-affects], and [how to ensure that you are prepared][prepare]. + +If you have any questions, please [get in touch][contact]. + +[2014-01-announcement]: /changes/2014-01-07-upcoming-change-to-default-media-type/ +[contact]: https://github.com/contact?form[subject]=Upcoming+change+to+default+API+media+type +[what's-changing]: /changes/2014-01-07-upcoming-change-to-default-media-type/#whats-changing +[who-it-affects]: /changes/2014-01-07-upcoming-change-to-default-media-type/#who-is-affected +[prepare]: /changes/2014-01-07-upcoming-change-to-default-media-type/#what-should-you-do diff --git a/content/changes/2014-04-10-deployment-api-preview-extension.md b/content/changes/2014-04-10-deployment-api-preview-extension.md new file mode 100644 index 0000000000..968304164c --- /dev/null +++ b/content/changes/2014-04-10-deployment-api-preview-extension.md @@ -0,0 +1,15 @@ +--- +kind: change +title: Extending the preview period for the Deployments API +created_at: 2014-04-10 +author_name: atmos +--- + +The preview period for the new [Deployments API][2014-01-deployments-api-post] continues to yield valuable feedback from developers. In early March, we used that feedback to [improve the payload format][payload-update] that integrations can use to customize deployments. A few weeks later, we began integrating with the new [Combined Status API][combined-statuses] to help ensure that only verified code gets deployed, even if you have multiple systems verifying different aspects of your software. + +To give developers time to explore these recent refinements to the Deployments API, we're extending the preview period for a little while longer. As always, if you have any questions or feedback, please [get in touch][contact]. + +[2014-01-deployments-api-post]: /changes/2014-01-09-preview-the-new-deployments-api/ +[payload-update]: /changes/2014-03-03-deployments-api-updates/ +[combined-statuses]: /changes/2014-03-27-combined-status-api/ +[contact]: https://github.com/contact?form[subject]=Deployments+API diff --git a/content/changes/2014-04-22-deprecating-beta-media-type.md b/content/changes/2014-04-22-deprecating-beta-media-type.md new file mode 100644 index 0000000000..3c726555d8 --- /dev/null +++ b/content/changes/2014-04-22-deprecating-beta-media-type.md @@ -0,0 +1,17 @@ +--- +kind: change +title: Deprecating the beta media type +created_at: 2014-04-22 +author_name: jasonrudolph +--- + +Now that the GitHub API is [serving the v3 media type by default][v3-default], we are deprecating the legacy [beta media type][beta]. + +We will eventually remove support for the beta media type, but we have no official retirement date to annouce at the moment. When the time comes, rest assured that we'll announce the retirement with plenty of notice. In the meantime, existing API clients that rely on the beta media type should start making plans to migrate to v3. The beta media type differs from v3 in [just a few places][differences]. In most cases, migrating an application from the beta media type to the v3 media type is smooth and painless. + +As always, if you have any questions, please [get in touch][contact]. + +[v3-default]: /changes/2014-01-07-upcoming-change-to-default-media-type/ +[beta]: /v3/versions/#beta +[differences]: /v3/versions/#differences-from-beta-version +[contact]: https://github.com/contact?form[subject]=API:+Deprecating+the+beta+media+type diff --git a/content/changes/2014-04-25-user-content-security.md b/content/changes/2014-04-25-user-content-security.md new file mode 100644 index 0000000000..aaf499f291 --- /dev/null +++ b/content/changes/2014-04-25-user-content-security.md @@ -0,0 +1,37 @@ +--- +kind: change +title: New user content domains +created_at: 2014-04-25 +author_name: azizshamim +--- + +## Securing your content + +The [GitHub Bug Bounty program](https://bounty.github.com) recently identified a few cross-domain vulnerabilities related to user-generated content, and we've shipped improvements today to address those issues. + +In order to better isolate your content from potentially malicious content uploaded by other users (e.g., content that might contain Cross-Site Scripting or other embedded attacks), we now serve user-generated content from subdomains of **githubusercontent.com**. This content is no longer served from subdomains of **github.com**. + +## What's affected? + +This change affects the following subdomains: + +* **raw.github.com** : Serves raw file content from your repository. +* **embed.github.com** : Allows users to embed rich GitHub content on other sites. +* **render.github.com** : Displays rich content on GitHub.com. +* **f.cloud.github.com** : Hosts all those amazing gifs you use in Pull Requests and Issues. + +Content formerly served by these subdomains is now served from subdomains of **githubusercontent.com**. + +## Older links + +If you have old links to this content, don't worry: as of today, we're forcing the old domains to redirect to the new domains. Your existing links should continue to work automatically in your browser. If you're using a URL from Gist or GitHub to directly access user-generated content via `curl`, `wget`, or a library (like [HTTParty](https://github.com/jnunemaker/httparty)), be sure to configure that tool to follow the redirect. + +## Your proxies or filters + +Some security systems (web proxies, for example) may not recognize the **githubusercontent.com** domain. In those cases, you may need update your proxies and security software accordingly. + +As always, if you have any questions, please [get in touch][contact]. + +*Happy and safe GitHubbing!* + +[contact]: https://github.com/contact?form[subject]=Changes+to+user+content+domains diff --git a/content/changes/2014-05-06-gist-api-now-truncating-large-files.md b/content/changes/2014-05-06-gist-api-now-truncating-large-files.md new file mode 100644 index 0000000000..35e93549ce --- /dev/null +++ b/content/changes/2014-05-06-gist-api-now-truncating-large-files.md @@ -0,0 +1,40 @@ +--- +kind: change +title: "Changes to Gist API response for large files" +created_at: 2014-05-06 +author_name: leongersing +--- + +In order to provide a faster, more robust API for Gist, we are making two changes to better handle large files in [Gist API responses][gist-json-representation]. + +### Truncating file contents larger than one megabyte + +The [Gist API response][gist-json-representation] includes data for every file in the Gist. That works well for Gists with reasonably-sized files. When a Gist contains large files, however, it can lead to timeouts when preparing or sending the API response. + +To eliminate those timeouts, the API now limits the amount of content returned for each file. If a file is larger than one megabyte in size, the API response will include the first megabyte of content for that file. (Few Gists have files this large. As a result, most API clients won't notice any impact from this change.) + +### New "truncated" attribute + +The JSON snippet below illustrates the attributes provided for each file in the Gist API response. In it, you'll notice a new `truncated` attribute included as part of the file metadata. This Boolean attribute indicates whether the `content` value is truncated for this request. + + { + files: { + "my_large_file.md": { + "size": 2097152, + "content": "Large content. Truncated at end of first megabyte. [...]", + "truncated": true, + "raw_url": "https://raw.githubusercontent.com/[...]/my_large_file.md", + "type": "text/plain", + "language": "Markdown" + } + } + } + +### Getting the full content for truncated files + +We recognize that sometimes you'll still want the full content for a file, even if it's too large to get returned in the standard Gist API response. For files under 10 megabytes, simply make a request to the URL specified in the `raw_url` attribute, and you'll receive the complete content for that file. For larger files, you'll need to clone the gist locally via the ```git_pull_url``` to access the full file contents. + +If you have any questions, don’t hesitate to [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=Gist+API+now+truncates+large+files +[gist-json-representation]: /v3/gists/#detailed-gist-representation diff --git a/content/changes/2014-05-09-improved-pagination-for-the-repository-commits-api.md b/content/changes/2014-05-09-improved-pagination-for-the-repository-commits-api.md new file mode 100644 index 0000000000..8e03d3839d --- /dev/null +++ b/content/changes/2014-05-09-improved-pagination-for-the-repository-commits-api.md @@ -0,0 +1,18 @@ +--- +kind: change +title: Improved pagination for the Repository Commits API +created_at: 2014-05-09 +author_name: izuzak +--- + +The [Repository Commits API](/v3/repos/commits/) now supports an additional approach for paginating [commit lists](/v3/repos/commits/#list-commits-on-a-repository). As of today, this endpoint supports the "standard" [`page` and `per_page` parameters](/v3/#pagination) for controlling pagination. This API now uses these parameters by default when constructing [page links](/v3/#pagination). + +## Improved results and increased consistency + +This new approach improves the reliability of this endpoint, which on rare occasions skipped some commits during pagination. This enhancement also increases the overall consistency of the API, as all endpoints now paginate resource lists the same way. + +## Old parameters still supported + +The old way of paginating, using `top`, `last_sha`, and `per_page` parameters, is still supported in API v3, but it will be removed in the [next major version of the API](https://developer.github.com/v3/versions/#v3-deprecations). API clients that are manually constructing URLs for pages should be modified to use the new parameters. Even better, API clients shouldn't construct URLs for pages manually, but should use [page links provided by the `Link` header](/guides/traversing-with-pagination/) in API responses. + +Since both the new and the old pagination parameters are still supported in API v3, API clients shouldn't notice any changes today. Still, if you notice any problems with this endpoint, please [let us know](https://github.com/contact?form%5Bsubject%5D=API:+Commits+pagination+improvements). diff --git a/content/changes/2014-05-19-deployments-api-updates.md b/content/changes/2014-05-19-deployments-api-updates.md new file mode 100644 index 0000000000..c645443877 --- /dev/null +++ b/content/changes/2014-05-19-deployments-api-updates.md @@ -0,0 +1,96 @@ +--- +kind: change +title: New attributes for the Deployments API +created_at: 2014-05-19 +author_name: atmos +--- + +We're continuing to iterate on the [Deployments API preview][deployments-preview], and we're starting to see it satisfy more and more use cases. Today we're introducing new attributes for Deployments and Deployment Statuses as well as a few payload changes. + +**This is a breaking change for Deployment Status payloads**. If you're trying out this new API during its preview period, you'll need to update your code to continue working with it. + +## API Changes + +For Deployments we're introducing the concept of an `environment`. An environment is basically a unique identifier for a deployment target. Lots of people tend toward the concept of environments for staging, QA, user acceptance testing, etc. We hope this enhancement will enable more use cases for our users that deploy to multiple environments. + +Deployments are also persisting the requested deployment `ref`. Previously we resolved a ref to the current SHA for that ref. Now we'll be keeping the ref around for historical purposes. This is especially helpful if you're deploying branches to verify them before you merge them into your default branch (e.g., "master"). + +## JSON Payload Changes + +We're also adding a few attributes to the outbound Deployment payloads. We're now including the `ref` attribute so you know the branch or tag name that resolved to a specific SHA. The `environment` is also present. + +## Webhook Changes + +The Deployment Status payloads now embed the associated Deployment object. With this enhancement, Deployment Status events received via webhooks will have enough information to notify other systems, without having to call back to the GitHub API for the `environment`, `ref`, or payload that was deployed. + +### Example Deployment JSON + +

+{
+  "url": "https://api.github.com/repos/my-org/my-repo/deployments/392",
+  "id": 392,
+  "sha": "837db83be4137ca555d9a5598d0a1ea2987ecfee",
+  "ref": "master",
+  "environment": "staging",
+  "payload": {
+    "fe": [
+      "fe1",
+      "fe2",
+      "fe3"
+    ]
+  },
+  "description": "ship it!",
+  "creator": {
+    "login": "my-org",
+    "id": 521,
+    "avatar_url": "https://avatars.githubusercontent.com/u/2988?",
+    "type": "User"
+  },
+  "created_at": "2014-05-09T19:56:47Z",
+  "updated_at": "2014-05-09T19:56:47Z",
+  "statuses_url": "https://api.github.com/repos/my-org/my-repo/deployments/392/statuses"
+}
+
+ +### Example Deployment Status JSON + +

+{
+  "url": "https://api.github.com/repos/my-org/my-repo/deployments/396/statuses/1",
+  "id": 1,
+  "state": "success",
+  "deployment": {
+    "url": "https://api.github.com/repos/my-org/my-repo/deployments/396",
+    "id": 392,
+    "sha": "837db83be4137ca555d9a5598d0a1ea2987ecfee",
+    "ref": "master",
+    "payload": {
+      "fe": [
+        "fe1",
+        "fe2",
+        "fe3"
+      ]
+    },
+    "environment": "production",
+    "description": "Deploying to production",
+    "creator": {
+      "login": "alysson-goldner",
+      "id": 540,
+      "type": "User"
+    },
+    "created_at": "2014-05-09T19:59:36Z",
+    "updated_at": "2014-05-09T19:59:36Z",
+    "statuses_url": "https://api.github.com/repos/my-org/my-repo/deployments/396/statuses"
+  },
+  "description": "Deployment succeeded",
+  "target_url": "https://deploy.myorg.com/apps/my-repo/logs/420",
+  "created_at": "2014-05-09T19:59:39Z",
+  "updated_at": "2014-05-09T19:59:39Z",
+  "deployment_url": "https://api.github.com/repos/my-org/my-repo/deployments/396"
+}
+
+ +If you have any questions or feedback, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=Deployments+API +[deployments-preview]: https://developer.github.com/changes/2014-01-09-preview-the-new-deployments-api/ diff --git a/content/changes/2014-06-09-new-attributes-for-pull-request-review-comment-events.md b/content/changes/2014-06-09-new-attributes-for-pull-request-review-comment-events.md new file mode 100644 index 0000000000..03d57613fc --- /dev/null +++ b/content/changes/2014-06-09-new-attributes-for-pull-request-review-comment-events.md @@ -0,0 +1,13 @@ +--- +kind: change +title: New attributes for PullRequestReviewComment events +created_at: 2014-06-09 +author_name: jdpace +--- + +We've enhanced the [PullRequestReviewComment events payloads][pr-review-comment-events] to include `action` and `pull_request` attributes. With the addition of the `pull_request` attribute, you now have immediate access to detailed information about the pull request without needing an additional API request. + +If you have any questions or feedback, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=PullRequestReviewComment+Event+Payloads +[pr-review-comment-events]: https://developer.github.com/v3/activity/events/types/#pullrequestreviewcommentevent diff --git a/content/changes/2014-06-11-improved-ci-support-for-deployments-api.md b/content/changes/2014-06-11-improved-ci-support-for-deployments-api.md new file mode 100644 index 0000000000..43079a819e --- /dev/null +++ b/content/changes/2014-06-11-improved-ci-support-for-deployments-api.md @@ -0,0 +1,22 @@ +--- +kind: change +title: Improved CI support for the Deployments API +created_at: 2014-06-11 +author_name: atmos +--- + +Today we're making a few minor changes to the [Deployments API preview][2]. With the introduction of [combined statuses][4] in a [recent update][3], we noticed a few inconsistencies with the API that we'd like to remedy. + +We're introducing a new parameter called `required_contexts`. This parameter accepts an array of named [commit status][5] contexts that are ensured to be in a "success" state before the deployment is created. This allows you to verify that more than one system verified your code before you deploy it. + +We've removed support for the `force` parameter. The force parameter existed to bypass both the auto-merge and commit status checks. The same behavior can now be accomplished by setting `auto_merge` and `required_contexts` appropriately. + +We're also setting a context for all [commit statuses][5]. If a commit status is created without a context, we'll now set it to the string "default". + +If you have any questions or concerns, [drop us a line][1]. + +[1]: https://github.com/contact?form[subject]=Deployments+API +[2]: https://developer.github.com/changes/2014-01-09-preview-the-new-deployments-api/ +[3]: https://developer.github.com/changes/2014-04-10-deployment-api-preview-extension/ +[4]: https://developer.github.com/changes/2014-03-27-combined-status-api/ +[5]: https://developer.github.com/v3/repos/statuses/ diff --git a/content/changes/2014-06-19-combined-status-api-pagination.md b/content/changes/2014-06-19-combined-status-api-pagination.md new file mode 100644 index 0000000000..4088a3e858 --- /dev/null +++ b/content/changes/2014-06-19-combined-status-api-pagination.md @@ -0,0 +1,22 @@ +--- +kind: change +title: Pagination in the Combined Status API +created_at: 2014-06-19 +author_name: bhuga +--- + +We're getting close to bringing the [Combined Status API][1] out of preview +mode, and have just a couple of small changes to make before it's :sparkles:. + +First, we're now [paginating][2] combined status API calls. The combined status +`state` field will always take all statuses into account, but we'll now only +return 100 embedded statuses at a time. + +Second, we're adding a `total_count` field, mirroring the Search API. This +count represents the number of contexts submitted for the given commit. + +As always, we're interested in [hearing your feedback][3]. + +[1]: /v3/repos/statuses/#get-the-combined-status-for-a-specific-ref +[2]: /v3/#pagination +[3]: https://github.com/contact?form[subject]=Combined+Status+API diff --git a/content/changes/2014-06-23-the-github-enterprise-api-documentation-has-a-new-home.md b/content/changes/2014-06-23-the-github-enterprise-api-documentation-has-a-new-home.md new file mode 100644 index 0000000000..e94b77d33d --- /dev/null +++ b/content/changes/2014-06-23-the-github-enterprise-api-documentation-has-a-new-home.md @@ -0,0 +1,12 @@ +--- +kind: change +title: The GitHub Enterprise API documentation has a new home! +created_at: 2014-06-23 +author_name: gjtorikian +--- + +[GitHub Enterprise](https://enterprise.github.com) offers the same set of APIs as GitHub.com, as well as its own set of Enterprise-specific functionality. + +The GitHub Enterprise API has been documented on [the Enterprise Help site](https://enterprise.github.com/help) for some time. We've now [moved the resources to this site](https://developer.github.com/v3/enterprise/) to be hosted alongside the rest of the GitHub API documentation. + +Is there an API workflow you're particularly interested in? [Let us know](https://github.com/contact?form%5Bsubject%5D=Suggestion+for+an+Enterprise+Guide) and we'll do our best to [write a guide](https://developer.github.com/guides/)! diff --git a/content/changes/2014-07-07-example-webhook-payloads.md b/content/changes/2014-07-07-example-webhook-payloads.md new file mode 100644 index 0000000000..26263e4821 --- /dev/null +++ b/content/changes/2014-07-07-example-webhook-payloads.md @@ -0,0 +1,19 @@ +--- +kind: change +title: New example webhook payloads +created_at: 2014-07-07 +author_name: kdaigle +--- + +Today, we’ve added example [webhook][webhooks] payloads to the [event types][event-types] page. +Alongside existing descriptions for each event, we now include an [example payload][full-payload] +so that you can quickly see the data provided by the event. You can learn more about how webhooks +work with our [Webhooks Guide][webhooks-guide]. + +If you have any questions or feedback, please [get in touch][get-in-touch]. + +[webhooks]: https://github.com/blog/1778-webhooks-level-up +[event-types]: /v3/activity/events/types/ +[full-payload]: /v3/activity/events/types/#issuesevent +[webhooks-guide]: /webhooks/ +[get-in-touch]: https://github.com/contact?form[subject]=Example+webhook+payloads diff --git a/content/changes/2014-07-09-status-contexts-are-official.md b/content/changes/2014-07-09-status-contexts-are-official.md new file mode 100644 index 0000000000..a9ec470850 --- /dev/null +++ b/content/changes/2014-07-09-status-contexts-are-official.md @@ -0,0 +1,37 @@ +--- +kind: change +title: The Combined Status API is official +created_at: 2014-07-09 +author_name: bhuga +--- + +We're happy to announce that the [Combined Status API][docs] is officially part +of the GitHub API v3. We now consider it stable for production use. + +Thanks to everyone who provided feedback during the comment period. We got +some great feedback, and hope this feature helps you build the tools you +need to make GitHub the best place to ship exactly the way you want. + +### Preview media type no longer needed + +If you used the Combined Status API during the preview period, you needed to +provide a custom media type in the `Accept` header: + + application/vnd.github.she-hulk-preview+json + +Now that the preview period has ended, you no longer need to pass this custom +media type. + +Instead, we [recommend][media-types] that you specify `v3` as the version in the +`Accept` header: + + application/vnd.github.v3+json + +### Feedback + +We'll never be done listening to you! As always, please don't hesitate to +[share your feedback][feedback]. + +[docs]: /v3/repos/statuses/#get-the-combined-status-for-a-specific-ref +[media-types]: /v3/media +[feedback]: https://github.com/contact?form[subject]=Combined+Status+API diff --git a/content/changes/2014-07-28-assignee-and-label-actions-for-issue-events.md b/content/changes/2014-07-28-assignee-and-label-actions-for-issue-events.md new file mode 100644 index 0000000000..b66d1f1363 --- /dev/null +++ b/content/changes/2014-07-28-assignee-and-label-actions-for-issue-events.md @@ -0,0 +1,15 @@ +--- +kind: change +title: New assigned/labeled actions for issue and pull request events +created_at: 2014-07-28 +author_name: jdpace +--- + +As part of the [new GitHub Issues][issues-three], we've added new actions to the issues and pull requests webhook events: "labeled", "unlabeled", "assigned", and "unassigned". The payload will also include the respective assignee or label for these new actions. + +If you already have a [webhook](/webhooks/) subscribed to the `issues` or `pull_request` events, you'll start seeing these new actions immediately. The new events can also be fetched from the [issue events API](/v3/issues/events/). + +For more information, be sure to check out our documentation for the [IssuesEvent](/v3/activity/events/types/#issuesevent) or [PullRequestEvent](/v3/activity/events/types/#pullrequestevent). If you have any questions or feedback, please [drop us a line][contact]. + +[issues-three]: https://github.com/blog/1866-the-new-github-issues +[contact]: https://github.com/contact?form%5Bsubject%5D=New+Assigned+and+Labeled+Actions+for+Issues+and+Pull+Request+Events diff --git a/content/changes/2014-08-05-team-memberships-api.md b/content/changes/2014-08-05-team-memberships-api.md new file mode 100644 index 0000000000..a127f1cb0d --- /dev/null +++ b/content/changes/2014-08-05-team-memberships-api.md @@ -0,0 +1,40 @@ +--- +kind: change +title: We're changing the way you add new members to your organization +created_at: 2014-08-05 +author_name: jakeboxer +--- + +Today, we're announcing a change to the way organization owners add new members to their organization. + +Previously, if you were an organization owner, you could use the [add team member][add-team-member] endpoint to add any GitHub user to any team on your organization without any sort of approval from them. Now, we're increasing user security by sending [invitations][org-invitations] to users when they're added to teams on organizations that they aren't yet a part of. + +With this change, if you use the [add team member][add-team-member] endpoint to add a user to a team and that user isn't already on another team in your organization, the request will fail. + +### The new Team Memberships API + +You should change all your [add team member][add-team-member] requests to use the new [add team membership][add-team-membership] endpoint. This new endpoint works exactly the same as the old one, with one important change: if the membership being added is for a user who is unaffiliated with the team's organization, that user will be sent an invitation via email. + +Unlike the [add team member][add-team-member] endpoint, a successful request to the [add team membership][add-team-membership] endpoint does *not* guarantee that the user is now a member of the team. If you're trying to migrate to the new endpoint and need to know when a user has been successfully added (not just invited) to a team, please check out [TeamAddEvent][team-add-event]. + +### Preview period + +We're making the new Team Memberships API (and the breaking changes to the [add team member][add-team-member] API) available today for developers to preview. During this period, we may change aspects of these endpoints. If we do, we will announce the changes on the developer blog, but we will not provide any advance notice. + +While these new APIs are in their preview period, you'll need to provide the following custom media type in the `Accept` header: + + application/vnd.github.the-wasp-preview+json + +We expect the preview period to last 30-60 days. At the end of the preview period, the Team Memberships API will become an official component of GitHub API v3, as will the [add team member][add-team-member] API's breaking changes. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[contact]: https://github.com/contact?form[subject]=Team+Memberships+API +[org-invitations]: https://help.github.com/articles/adding-or-inviting-members-to-a-team-in-an-organization +[add-team-member]: /v3/orgs/teams/#add-team-member +[add-team-membership]: /v3/orgs/teams/#add-team-membership +[get-team-member]: /v3/orgs/teams/#get-team-member +[get-team-membership]: /v3/orgs/teams/#get-team-membership +[remove-team-member]: /v3/orgs/teams/#remove-team-member +[remove-team-member]: /v3/orgs/teams/#remove-team-membership +[team-add-event]: /v3/activity/events/types/#teamaddevent diff --git a/content/changes/2014-08-15-deployments-api-changes.md b/content/changes/2014-08-15-deployments-api-changes.md new file mode 100644 index 0000000000..4fb16cd467 --- /dev/null +++ b/content/changes/2014-08-15-deployments-api-changes.md @@ -0,0 +1,29 @@ +--- +kind: change +title: New features for the Deployments API preview +created_at: 2014-08-15 +author_name: atmos +--- + +We've added two new features to the [Deployments API preview][deployments-preview]: the ability to query deployments and a new `task` attribute for different types of deployment tasks. + +## API changes + +You can now search for deployments via query parameters to the [listing endpoint][listing-endpoint]. You can filter on `sha`, `ref`, `task`, and `environment`. This makes it easier to answer questions like "when was the last time someone deployed to staging?" + +
+$ curl -H "Authorization: token [yours]" \
+       https://api.github.com/repos/octocat/my-repo/deployments?environment=staging
+
+ +## New attribute + +We've also added a `task` attribute to the deployment resource. The `task` attribute allows you to specify tasks other than just pushing code. Popular deployment tools like [capistrano][capistrano] and [fabric][fabric] support named tasks to do things like running schema migrations. We hope this attribute will give integrators the flexibility they need to provide custom functionality. + +If you have any questions or feedback, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=Deployments+API +[deployments-preview]: https://developer.github.com/changes/2014-01-09-preview-the-new-deployments-api/ +[listing-endpoint]: https://developer.github.com/v3/repos/deployments/#list-deployments +[fabric]: http://www.fabfile.org/ +[capistrano]: http://capistranorb.com/ diff --git a/content/changes/2014-08-28-accepting-organization-invitations-from-the-api.md b/content/changes/2014-08-28-accepting-organization-invitations-from-the-api.md new file mode 100644 index 0000000000..35bbb060a8 --- /dev/null +++ b/content/changes/2014-08-28-accepting-organization-invitations-from-the-api.md @@ -0,0 +1,38 @@ +--- +kind: change +title: Accepting organization invitations from the API +created_at: 2014-08-28 +author_name: jakeboxer +--- + +The upcoming [Team Memberships API][team-memberships-api] gives you the power to [invite][org-invitations] new GitHub users to your organization via the API. We're expanding the API to also allow users to view their organization membership statuses and accept any invitations they've received. + +### The new Organization Memberships API + +When someone [invites][org-invitations] you to an organization, your membership with that organization begins in the "pending" state. The new [list organization memberships][list-org-memberships] endpoint allows you to find your pending memberships. You can then change them to "active" (accepting the invitation in the process) by using the [edit organization membership][edit-org-membership] endpoint. + +### New Team Membership API response attribute + +Previously, responses from the [add team membership][add-team-membership] and [get team membership][get-team-membership] endpoints included a "status" attribute, which could either be "active" or "pending". We've renamed this attribute from "status" to "state" for better consistency with our other API calls. + +To give you time to update your apps, we'll keep the legacy "status" attribute around alongside the new "state" attribute until **September 4th, 2014**. + +### Preview period + +The new Organization Memberships API is available for developers to preview alongside the [Team Memberships API][team-memberships-api]. During this period, we may change aspects of these endpoints. If we do, we will announce the changes on the developer blog, but we will not provide any advance notice. + +While these new APIs are in their preview period, you'll need to provide the following custom media type in the `Accept` header: + + application/vnd.github.the-wasp-preview+json + +We expect the preview period to last 30-60 days. At the end of the preview period, the Team and Organization Memberships APIs will become official components of GitHub API v3. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[contact]: https://github.com/contact?form[subject]=Team+Memberships+API +[team-memberships-api]: /changes/2014-08-05-team-memberships-api/ +[org-invitations]: https://help.github.com/articles/adding-or-inviting-members-to-a-team-in-an-organization +[list-org-memberships]: /v3/orgs/members/#list-your-organization-memberships +[edit-org-membership]: /v3/orgs/members/#edit-your-organization-membership +[add-team-membership]: /v3/orgs/teams/#add-team-membership +[get-team-membership]: /v3/orgs/teams/#get-team-membership diff --git a/content/changes/2014-09-05-removing-gravatar-id.md b/content/changes/2014-09-05-removing-gravatar-id.md new file mode 100644 index 0000000000..102ba6bcab --- /dev/null +++ b/content/changes/2014-09-05-removing-gravatar-id.md @@ -0,0 +1,23 @@ +--- +kind: change +title: Removing Gravatar ID from user payloads +created_at: 2014-09-05 +author_name: mastahyeti +--- + +We have deprecated the `gravatar_id` attribute in the [user +representation](https://developer.github.com/v3/users/). Starting September 19, +the API will always provide an empty string as the value for this attribute. + +Users have been able to upload avatars directly to GitHub for [a while +now](https://github.com/blog/1803-switch-your-picture-with-ease). If users +haven't uploaded an avatar, we still try to fetch one from Gravatar, but that +happens behind the scenes on GitHub's servers. As a result, the `gravatar_id` +attribute no longer identifies a GitHub user's canonical avatar. Instead, API +consumers should use the `avatar_url` to fetch a user's avatar. The `avatar_url` +attribute has always been present in the [v3 user representation](/v3/users/) +and is the only reliable way to find a GitHub user's avatar. + +If you have any questions or feedback, please [get drop us a line][contact]. + +[contact]: https://github.com/contact?form[subject]=Removing+Gravatar+ID diff --git a/content/changes/2014-09-12-changing-organization-feeds.md b/content/changes/2014-09-12-changing-organization-feeds.md new file mode 100644 index 0000000000..5a280e2678 --- /dev/null +++ b/content/changes/2014-09-12-changing-organization-feeds.md @@ -0,0 +1,46 @@ +--- +kind: change +title: Changing organization feeds in the Feeds API +created_at: 2014-09-12 +author_name: mastahyeti +--- + +We have deprecated the `current_user_organization_url` attribute and the +`current_user_organization.href` attribute in the [Feeds API][docs]. If you make +use of these attributes, you'll want to update your code to use the new +`current_user_organization_urls` attribute instead. + +### Changes to the deprecated attributes + +Previously, the deprecated attributes returned URI template. For example: + +

+"current_user_organization_url":
+  "https://github.com/organizations/{org}/mastahyeti.private.atom?token=abc123"
+
+ +The template included a deprecated authentication token. Our new tokens are +valid only for a concrete feed URL (not for a URI template). Because the +deprecated attributes were templates and did not specify a concrete URL, the API +could not provide a token that could be used for organization feeds. + +Starting today, the API returns empty values for the deprecated attributes. + +### New attribute for organization feeds + +In order to preserve the functionality of this API, we have added a new +attribute that lists specific Atom feed urls for each of the user's +organizations. + +

+"current_user_organization_urls": [
+  "https://github.com/organizations/github/mastahyeti.private.atom?token=abc123"
+  "https://github.com/organizations/requests/mastahyeti.private.atom?token=token=def456"
+]
+
+ +Check out the updated [Feeds API documentation][docs] for the new fields. If you +have any questions or feedback, please [get drop us a line][contact]. + +[docs]: /v3/activity/feeds/ +[contact]: https://github.com/contact?form[subject]=Changing+organization+feeds+in+the+Feeds+API diff --git a/content/changes/2014-09-16-finalizing-the-organization-and-team-membership-apis.md b/content/changes/2014-09-16-finalizing-the-organization-and-team-membership-apis.md new file mode 100644 index 0000000000..e82a76c0fb --- /dev/null +++ b/content/changes/2014-09-16-finalizing-the-organization-and-team-membership-apis.md @@ -0,0 +1,30 @@ +--- +kind: change +title: Finalizing the Organization and Team Membership APIs +created_at: 2014-09-16 +author_name: jakeboxer +--- + +For the past few weeks, the new [Organization Membership][org-membership-api] and [Team Membership][team-membership-api] APIs have been available for early access via a preview media type. As of today, these APIs are stable and suitable for production use. + +### Preview period ends on September 23 + +On September 23, 2014, these APIs will become official parts of the GitHub API v3. At that time, the preview media type will no longer be required to access these APIs. + +### Reminder: Breaking change to legacy endpoint + +The [breaking change to the "Add team member" endpoint][add-team-member] will also go into effect for all requests on **September 23, 2014**. At that time, if you use the [add team member][add-team-member] endpoint to add a user to a team and that user isn't already on another team in your organization, the request will fail. To avoid this, be sure to use the [add team membership][add-team-membership] endpoint. + +### Addition to the Organization Membership API + +Thanks to your feedback, we've updated the Organization Membership API to provide direct access to basic information about the organization whenever you fetch a [list of memberships][list-org-memberships] or a [single membership][get-org-membership]. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[contact]: https://github.com/contact?form[subject]=Organization+and+Team+Membership+APIs +[org-membership-api]: /changes/2014-08-28-accepting-organization-invitations-from-the-api/ +[team-membership-api]: /changes/2014-08-05-team-memberships-api/ +[add-team-member]: /v3/orgs/teams/#add-team-member +[add-team-membership]: /v3/orgs/teams/#add-team-membership +[list-org-memberships]: /v3/orgs/members/#list-your-organization-memberships +[get-org-membership]: /v3/orgs/members/#get-your-organization-membership diff --git a/content/changes/2014-09-23-one-more-week-before-the-add-team-member-api-breaking-change.md b/content/changes/2014-09-23-one-more-week-before-the-add-team-member-api-breaking-change.md new file mode 100644 index 0000000000..57771ad0cc --- /dev/null +++ b/content/changes/2014-09-23-one-more-week-before-the-add-team-member-api-breaking-change.md @@ -0,0 +1,23 @@ +--- +kind: change +title: One more week before the "Add team member" API breaking change +created_at: 2014-09-23 +author_name: jakeboxer +--- + +**UPDATE (2014-09-30):** In response to feedback from developers, we're delaying the breaking change to the ["Add team member" API][add-team-member] until Monday, **October 6, 2014**. The change will go into effect for all requests on that date. + +Starting October 6, if you use [the "Add team member" API][add-team-member] to add a user to a team and that user isn't already on another team in your organization, the request will fail. To avoid this, be sure to use the [the "Add team membership" API][add-team-membership]. + +### The Organization and Team Membership APIs are now official + +As promised in [our blog post earlier this month][finalizing], the [Organization Membership][org-membership-api] and [Team Membership][team-membership-api] APIs are now an official part of the GitHub API! The preview media type is no longer required to access them. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[add-team-member]: /v3/orgs/teams/#add-team-member +[add-team-membership]: /v3/orgs/teams/#add-team-membership +[finalizing]: /changes/2014-09-16-finalizing-the-organization-and-team-membership-apis/ +[org-membership-api]: /changes/2014-08-28-accepting-organization-invitations-from-the-api/ +[team-membership-api]: /changes/2014-08-05-team-memberships-api/ +[contact]: https://github.com/contact?form[subject]=Organization+and+Team+Membership+APIs diff --git a/content/changes/2014-10-06-new-attributes-for-issue-events-api.md b/content/changes/2014-10-06-new-attributes-for-issue-events-api.md new file mode 100644 index 0000000000..0f9e1f70db --- /dev/null +++ b/content/changes/2014-10-06-new-attributes-for-issue-events-api.md @@ -0,0 +1,19 @@ +--- +kind: change +title: New Attributes for Issue Events API +created_at: 2014-10-06 +author_name: jdpace +--- + +We've made it easier to track changes to issues. The Issue Events API now provides more context for several event types: + +- `assigned` and `unassigned` events now include an `assignee` object so you can see just who was assigned or unassigned. +- `labeled` and `unlabeled` events include a `label` object. +- `milestoned` and `demilesoned` events include a `milestone` object. +- `renamed` events include a `rename` object with the title before and after the rename. + +Check out the [Issue Events API documentation][issue-events] for a full list of supported events. If you have +any questions or feedback, please [drop us a line][contact]. + +[issue-events]: /v3/issues/events/ +[contact]: https://github.com/contact?form[subject]=New+Attrs+for+Issue+Events+API diff --git a/content/changes/2014-10-16-removed-ssl-version-3-support-from-webhooks-and-services.md b/content/changes/2014-10-16-removed-ssl-version-3-support-from-webhooks-and-services.md new file mode 100644 index 0000000000..79a4d3612f --- /dev/null +++ b/content/changes/2014-10-16-removed-ssl-version-3-support-from-webhooks-and-services.md @@ -0,0 +1,16 @@ +--- +kind: change +title: Removed SSLv3 support from webhooks and services +created_at: 2014-10-16 +author_name: kdaigle +--- + +This morning, we [removed support][github-services-pr] for the `ssl_version` webhook configuration +option and made `TLS 1.X` the default cryptographic protocol to address the [POODLE exploit][poodle]. +You should no longer set or rely on the `ssl_version` configuration option. + +If you have any questions or feedback, please [drop us a line][contact]. + +[github-services-pr]: https://github.com/github/github-services/pull/949 +[poodle]: https://www.openssl.org/~bodo/ssl-poodle.pdf +[contact]: https://github.com/contact?form[subject]=Removed+SSLv3+support+from+webhooks+and+services diff --git a/content/changes/2014-10-21-deployment-webhook-payload-changes.md b/content/changes/2014-10-21-deployment-webhook-payload-changes.md new file mode 100644 index 0000000000..f30ebda2fc --- /dev/null +++ b/content/changes/2014-10-21-deployment-webhook-payload-changes.md @@ -0,0 +1,156 @@ +--- +kind: change +title: Deployment webhook payload changes +created_at: 2014-10-21 +author_name: atmos +--- + +On November 4th, 2014, we will begin sending a new format for [deployment][1] and [deployment status][2] payloads for webhooks. In the meantime we'll be running in a compatability mode that will give integrators the time needed to start taking advantage of the new format. Integrators who are working with webhooks and deployments are advised to upgrade to the new payload format to avoid service interruption. + +This change brings the payloads for these events more inline with the responses you'd receive from the API. Instead of having deployment and deployment status attributes as top-level keys, we will now nest them under `deployment` and `deployment_status` keys. Since we're still in the [preview period][3] for the deployments API we felt it was best to correct this inconsistency now. + +## DeploymentEvent Changes + +#### Old Format + +

+{
+  "id": 42,
+  "sha": "deadbeef",
+  "ref": "master",
+  "task": "deploy",
+  "name": "my-org/our-app",
+  "environment": "production",
+  "payload": {…},
+  "description": "Deploying master",
+  "repository": {…},
+  "sender": {…}
+}
+
+
+ +#### Current Format - 2014/10/22 + +

+{
+  "id": 42,
+  "sha": "deadbeef",
+  "ref": "master",
+  "task": "deploy",
+  "name": "my-org/our-app",
+  "environment": "production",
+  "payload": {…},
+  "description": "Deploying master",
+  "repository": {…},
+  "deployment": {
+    "url": "https://api.github.com/repos/my-org/our-app/deployments/42",
+    "id": 42,
+    "sha": "deadbeef",
+    "ref": "master",
+    "task": "deploy",
+    "environment": "production",
+    "payload": {…},
+    "description": "Deploying master",
+    "creator": {…},
+    "created_at": "2014-09-23T16:37:49Z",
+    "updated_at": "2014-09-23T16:37:49Z",
+    "statuses_url": "https://api.github.com/repos/my-org/our-app/deployments/42/statuses"
+  },
+  "sender": {…}
+}
+
+
+ +#### New Format - 2014/11/05 + +

+{
+  "deployment": {
+    "url": "https://api.github.com/repos/my-org/our-app/deployments/42",
+    "id": 42,
+    "sha": "deadbeef",
+    "ref": "master",
+    "task": "deploy",
+    "environment": "production",
+    "payload": {…},
+    "description": "Deploying master",
+    "creator": {…},
+    "created_at": "2014-09-23T16:37:49Z",
+    "updated_at": "2014-09-23T16:37:49Z",
+    "statuses_url": "https://api.github.com/repos/my-org/our-app/deployments/42/statuses"
+  },
+  "repository": {…},
+  "sender": {…}
+}
+
+ +## DeploymentStatusEvent Changes + +#### Old Format + +

+{
+  "id": 2600,
+  "state": "success",
+  "deployment": {…},
+  "target_url": "https://gist.github.com/deadbeef",
+  "description": "Deployment was successful",
+  "repository": {…},
+  "sender": {…}
+}
+
+ +#### Current Format - 2014/10/22 + +

+{
+  "id": 2600,
+  "state": "success",
+  "target_url": "https://gist.github.com/deadbeef",
+  "description": "Deployment was successful",
+  "repository": {…},
+  "deployment_status": {
+    "url": "https://api.github.com/repos/my-org/our-app/deployments/42/statuses2600",
+    "id": 2600,
+    "state": "success",
+    "creator": {…},
+    "target_url": "https://gist.github.com/deadbeef",
+    "description": "Deployment was successful",
+    "created_at": "2014-09-23T16:45:49Z",
+    "updated_at": "2014-09-23T16:45:49Z",
+    "deployment_url": "https://api.github.com/repos/my-org/our-app/deployments/42",
+    "repository_url": "https://api.github.com/repos/my-org/our-app"
+  },
+  "deployment": {…},
+  "sender": {…}
+}
+
+ +#### New Format - 2014/11/05 + +

+{
+  "deployment_status": {
+    "url": "https://api.github.com/repos/my-org/our-app/deployments/42/statuses2600",
+    "id": 2600,
+    "state": "success",
+    "creator": {…},
+    "target_url": "https://gist.github.com/deadbeef",
+    "description": "Deployment was successful",
+    "created_at": "2014-09-23T16:45:49Z",
+    "updated_at": "2014-09-23T16:45:49Z",
+    "deployment_url": "https://api.github.com/repos/my-org/our-app/deployments/42",
+    "repository_url": "https://api.github.com/repos/my-org/our-app"
+  },
+  "deployment": {…},
+  "repository": {…},
+  "sender": {…}
+}
+
+ +If you have any questions or feedback, please [get in touch][get-in-touch]. + +[1]: https://developer.github.com/v3/activity/events/types/#deploymentevent +[2]: https://developer.github.com/v3/activity/events/types/#deploymentstatusevent +[3]: https://developer.github.com/changes/2014-01-09-preview-the-new-deployments-api/ +[get-in-touch]: https://github.com/contact?form[subject]=Deployments+API diff --git a/content/changes/2014-10-24-status-api-limits.md b/content/changes/2014-10-24-status-api-limits.md new file mode 100644 index 0000000000..f9b840056c --- /dev/null +++ b/content/changes/2014-10-24-status-api-limits.md @@ -0,0 +1,18 @@ +--- +kind: change +title: Status API Limits +created_at: 2014-10-29 +author_name: rsanheim +--- + +To ensure a high level of service for all API consumers, we will soon limit the number of [statuses] +to 1000 per commit SHA, repository, and context. + +Beginning Monday, November 3rd, we will trim existing data sets that exceed this limit, deleting the oldest +records first. Attempts to create statuses beyond that limit will result in a [validation error]. + +If you have any feedback or questions, please don't hesistate to [contact] us. + +[statuses]: /v3/repos/statuses/ +[validation error]: https://developer.github.com/v3/#client-errors +[contact]: https://github.com/contact?form[subject]=Combined+Status+API diff --git a/content/changes/2014-11-25-the-deployments-api-is-official.md b/content/changes/2014-11-25-the-deployments-api-is-official.md new file mode 100644 index 0000000000..16b1f62554 --- /dev/null +++ b/content/changes/2014-11-25-the-deployments-api-is-official.md @@ -0,0 +1,37 @@ +--- +kind: change +title: The Deployments API is official +created_at: 2014-11-25 +author_name: atmos +--- + +We're happy to announce that the [Deployments API][docs] is officially part +of GitHub API v3. We now consider it stable for production use. + +Thanks to everyone who provided feedback during the preview period. We got +some great feedback, and hope this feature helps you build the tools you +need to make GitHub the best place to ship exactly the way you want. + +### Preview media type no longer needed + +If you used the Deployments API during the preview period, you needed to +provide a custom media type in the `Accept` header: + + application/vnd.github.cannonball-preview+json + +Now that the preview period has ended, you no longer need to pass this custom +media type. + +Instead, we [recommend][media-types] that you specify `v3` as the version in the +`Accept` header: + + application/vnd.github.v3+json + +### Feedback + +We'll never be done listening to you! As always, please don't hesitate to +[share your feedback][feedback]. + +[docs]: /v3/repos/deployments +[media-types]: /v3/media +[feedback]: https://github.com/contact?form[subject]=Deployments+API diff --git a/content/changes/2014-12-03-preview-the-new-organization-webhooks-api.md b/content/changes/2014-12-03-preview-the-new-organization-webhooks-api.md new file mode 100644 index 0000000000..629df16ad4 --- /dev/null +++ b/content/changes/2014-12-03-preview-the-new-organization-webhooks-api.md @@ -0,0 +1,42 @@ +--- +kind: change +title: Preview the New Organization Webhooks API +created_at: 2014-12-03 +author_name: jdpace +--- + +Today we're very excited [to announce Organization Webhooks][dotcom-blog-post]. +Organization Webhooks allow you to subscribe to events that happen across an +entire organization. + +In addition to being able to subscribe to the existing repository oriented +events across an organization, we're also adding some new events which are +exclusive to organization webhooks. The new [`repository` +event][repository-event] allows you to receive webhook payloads when a new +repository is created. By subscribing to the [`membership` +event][membership-event], you'll be notified whenever a user is added or +removed from a team. + +We’re making this new API for Organization Webhooks available today [for +developers to preview][docs-preview]. The preview period will allow us to [get +your feedback][contact] before declaring the Organization Webhooks API final. +We expect the preview +period to last for roughly 30-60 days. + +As we discover opportunities to improve the API during the preview period, we +may ship changes that break clients using the preview version of the API. We +want to iterate quickly. To do so, we will announce any changes here (on the +developer blog), but we will not provide any advance notice. + +At the end of preview period, the Organization Webhooks API will become an +official component of GitHub API v3. At that point, the new Organization +Webhooks API will be stable and suitable for production use. + +We hope you’ll take it for a spin and [send us your feedback][contact]. + +[dotcom-blog-post]: https://github.com/blog/1933-introducing-organization-webhooks +[repository-event]: /v3/activity/events/types/#repositoryevent +[membership-event]: /v3/activity/events/types/#membershipevent +[docs]: /v3/orgs/hooks/ +[docs-preview]: /v3/orgs/hooks/#preview-period +[contact]: https://github.com/contact?form[subject]=Organization+Webhooks diff --git a/content/changes/2014-12-08-organization-permissions-api-preview.md b/content/changes/2014-12-08-organization-permissions-api-preview.md new file mode 100644 index 0000000000..35d8e36b10 --- /dev/null +++ b/content/changes/2014-12-08-organization-permissions-api-preview.md @@ -0,0 +1,107 @@ +--- +kind: change +title: Preview the upcoming organization permission changes +created_at: 2014-12-08 +author_name: jakeboxer +--- +**UPDATE (2014-12-12):** The [List your organizations][list-your-organizations] API is now included in this preview as well. + +We have some upcoming changes that will affect the way organization members and repositories are managed. The most important changes are: + +- The Owners team will no longer be special. +- The [List your repositories][list-your-repos] API will include organization-owned repositories. +- The [List user organizations][list-user-organizations] API will only include public organization memberships. +- The [List your organizations][list-your-organizations] API will require `user` scope or `read:org` scope. + +## What's happening to the Owners team? + +Currently, members of your Owners team are administrators of your organization. Soon, your Owners team will become a totally normal team. Adding and removing Owners team members won't change their administrator status anymore. Instead, you'll be able to directly grant admin permissions to your organization's members without adding them to any special teams. + +We won't delete your Owners team, but you'll be able to delete or rename it yourself if you want. Organizations created after the change won't have an Owners team. + +### What should you do? + +In preparation for this change to the Owners team, we're releasing a few new APIs. You'll be able to use these APIs to manage organization admins without relying on the Owners team. + +#### Adding an organization admin + +To add a new organization admin, use the new [Add or update organization membership][add-org-membership] endpoint, specifying a role of `"admin"` in the request body. This replaces adding or inviting people to the Owners team. + +#### Removing an organization admin + +To remove someone from the organization role but keep them as a member of their teams, use the new [Add or update organization membership][add-org-membership] endpoint, specifying a role of `"member"` in the request body. This replaces removing people from the Owners team. + +#### Listing organization admins + +To get a list of all your organization's admins, use the [Organization members list][list-org-members] endpoint, specifying a role of `"admin"` in the query string. This replaces listing the members of the Owners team. + +#### Checking if someone is an organization admin + +To check if a given user is an organization admin, use the new [Get organization membership][get-org-membership] endpoint. If the returned `"role"` attribute is set to `"admin"` and the returned `"state"` attribute is set to `"active"`, the user is an organization admin. This replaces checking if a user is on the Owners team. + +## What's happening to the "List your repositories" API? + +Currently, the [List your repositories][list-your-repos] API only returns repositories that are owned by users, not by organizations. If you want a list of *all* the repositories that the authenticated user has access to, you need to use multiple API methods. + +Soon, this API will include all repositories that the authenticated user has access to (whether they're owned by a user or by an organization). + +### What should you do? + +Many apps use the [List your repositories][list-your-repos] API in conjunction with the [List your organizations][list-your-orgs] and [List organization repositories][list-org-repos] APIs to build up a list of all the repositories the authenticated user has access to. If your app is doing this, you'll be able to get rid of all the organization-related API calls and just use the [List your repositories][list-your-repos] API. + +If your app uses the [List your repositories][list-your-repos] API for another purpose, you'll need to update your app to handle the new organization-owned repositories we'll be returning. + +## What's happening to the "List user organizations" API? + +The [List user organizations][list-user-organizations] API is intended provide [public organization memberships][public-org-membership] for any user. When you use this API to fetch *your own* organizations, this API currently returns your public and private organization memberships. + +Soon, this API will only return public organization memberships. + +### What should you do? + +If your app uses the [List user organizations][list-user-organizations] API to fetch all of the organization memberships (public and private) for the authenticated user, you'll need to update your app to use the [List your organizations][list-your-organizations] API instead. The [List your organizations][list-your-organizations] API returns all organizations (public and private) that your app is authorized to access. + +## What's happening to the "List your organizations" API? + +OAuth requests will soon require minimum [scopes][] in order to access the [List your organizations][list-your-organizations] API. + +Currently, the API response always includes your [public organization memberships][public-org-membership], regardless of the OAuth scopes associated with your request. If you have `user`, `read:org`, `write:org`, or `admin:org` scope, the response also includes your private organization memberships. + +Soon, this API will only return organizations that your authorization allows you to operate on in some way (e.g., you can list teams with `read:org` scope, you can publicize your organization membership with `user` scope, etc.). Therefore, this API will require at least `user` or `read:org` scope. (`write:org` and `admin:org` scope implicitly include `read:org` scope.) OAuth requests with insufficient scope will receive a `403 Forbidden` response. + +### What should you do? + +If you [authenticate via username and password][username-password-authn], you are not affected by this change. + +If your app only needs to fetch the user's public organization memberships, you should use the [List user organizations][list-user-organizations] API instead. Since that API only returns public information, it does not require any scopes. + +## Preview period + +Starting **today**, these new APIs are available for developers to preview. We expect the preview period to last for four weeks. (Stay tuned to the developer blog for updates.) At the end of the preview period, these additions will become official components of the GitHub API. + +While these additions are in their preview period, you'll need to provide the following custom media type in the `Accept` header: + + application/vnd.github.moondragon-preview+json + +During the preview period, we may change aspects of these endpoints. If we do, we will announce the changes on the developer blog, but we will not provide any advance notice. + +## Migration period + +At the end of the preview period, we will announce the start of a migration period. At that time, developers should update their applications to use the new APIs for managing organization admins. During this period, you will still be able to use the Owners team to manage your organization's admins, so that you have time to update your applications to use the new APIs without breakage. We expect the migration period to last for four weeks. + +At the end of the migration period, the Owners team will no longer be special, and you'll no longer be able to rely on it for managing organization admins. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[contact]: https://github.com/contact?form[subject]=Organization+Admin+Pre-release+Preview +[list-your-repos]: /v3/repos/#list-your-repositories +[list-your-orgs]: /v3/orgs/#list-your-organizations +[list-org-repos]: /v3/repos/#list-organization-repositories +[add-org-membership]: /v3/orgs/members/#add-or-update-organization-membership +[list-org-members]: /v3/orgs/members/#members-list +[get-org-membership]: /v3/orgs/members/#get-organization-membership +[list-user-organizations]: /v3/orgs/#list-user-organizations +[list-your-organizations]: /v3/orgs/#list-your-organizations +[public-org-membership]: https://help.github.com/articles/publicizing-or-concealing-organization-membership +[username-password-authn]: /v3/auth/#via-username-and-password +[scopes]: /v3/oauth/#scopes diff --git a/content/changes/2014-12-08-removing-authorizations-token.md b/content/changes/2014-12-08-removing-authorizations-token.md new file mode 100644 index 0000000000..566f08fc4d --- /dev/null +++ b/content/changes/2014-12-08-removing-authorizations-token.md @@ -0,0 +1,105 @@ +--- +kind: change +title: Removing token attribute from Authorizations API responses +created_at: 2014-12-08 +author_name: ptoomey3 +--- + +Since OAuth access tokens function like passwords, they should be treated with +care. Today we are making it easier to more securely work with authorizations +via the Authorizations API. We are deprecating the use use of the `token` +attribute in the majority of the [Authorizations API](/v3/oauth_authorizations/) +responses. For the [affected APIs][authorizations-token-deprecation-notice], the +`token` attribute will soon return an empty string. To get ready for that +change, we are giving developers a chance to +[preview the updated API](#preview-period) starting today. + +## What's changing? + +The current [OAuth Authorizations API](/v3/oauth_authorizations/) requires GitHub to store the full value for +each OAuth token on our servers. In order to increase the security for our +users, we are changing our architecture to store the SHA-256 digest of OAuth +tokens instead. GitHub securely hashes user passwords using bcrypt and we want +to provide comparable security for OAuth tokens as well. + +Rest assured that this change is an entirely proactive measure from GitHub and is not associated with any security incident. + +## Who is affected? + +This change affects any code that relies on accessing the `token` attribute from +[these OAuth Authorizations API responses][authorizations-token-deprecation-notice]. +For example, our own [GitHub for Mac][github-for-mac] and +[GitHub for Windows][github-for-windows] applications relied on reading the `token` +from the [Get-or-create an authorization for a specific app][get-or-create-for-app] API, in order to support multiple installations of our desktop application for a single user. + +## What should you do? + +In order to reduce the impact of removing the `token` attribute, the OAuth +Authorizations API has added a new request attribute (`fingerprint`), added +three new response attributes (`token_last_eight`, `hashed_token`, and +`fingerprint`), and added [one new API][get-or-create-for-app-fingerprint]. +While these new APIs and attributes do not replace the full functionality that +previously existed, they can be used in place of `token` for most common use cases. + +* `token_last_eight` returns the last eight characters of the associated OAuth +token. As an example, `token_last_eight` could be used to display a list of +partial token values to help a user manage their OAuth tokens. + +* `hashed_token` is the base64 of the SHA-256 digest of the token. +`hashed_token` could be used to programmatically validate that a given token +matches an authorization returned by the API. + +* `fingerprint` is a new optional request parameter that allows an OAuth +application to create multiple authorizations for a single user. `fingerprint` +should be a string that distinguishes the new authorization from others +for the same client ID and user. + + For example, to differentiate installations of a desktop application across + multiple devices you might set `fingerprint` to + `SHA256_HEXDIGEST("GitHub for Mac - MAC_ADDRESS_OF_MACHINE")`. Since + `fingerprint` is not meant to be a user-facing value, you should still set + the `note` attribute to help a user differentiate between authorizations on their + [OAuth applications listing on GitHub][app-listing]. + +* [Get-or-create an authorization for a specific app and fingerprint][get-or-create-for-app-fingerprint] +is a new API that is analagous to the +[Get-or-create an authorization for a specific app][get-or-create-for-app] +API, but adds support for the new `fingerprint` request parameter. + +## Preview period + +We are making the new Authorizations API available today for developers to +preview. During this period, we may change aspects of these endpoints. If we do, +we will announce the changes on the developer blog, but we will not provide any +advance notice. + +While these new APIs are in their preview period, you’ll need to provide the +following custom media type in the Accept header: + + application/vnd.github.mirage-preview+json + +We expect the preview period to last 4-6 weeks. (Stay tuned to the developer blog for updates.) At the end of the preview period, these changes will become an official and stable part of GitHub API. + +## Migration period + +At the end of the preview period, we will announce the start of a migration period. Developers will have 8 weeks to update existing code to use the new APIs. + +## Why SHA-256 over bcrypt? + +Some users may be curious why we are not using bcrypt to hash our OAuth tokens +like we do for user passwords. Bcrypt is purposefully computationally expensive +in order to mitigate brute force attacks against low entropy passwords. However, +OAuth tokens are highly random and are not susceptible to brute force attacks. +Given that OAuth token validation occurs for each request to the API we chose +SHA-256 for performance reasons. + +If you have any questions or feedback, please [drop us a line][contact]. + +[contact]: https://github.com/contact?form[subject]=Removing+authorizations+token +[app-listing]: https://github.com/settings/applications +[create-a-new-authorization]: /v3/oauth_authorizations/#create-a-new-authorization +[get-or-create-for-app]: /v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app +[get-or-create-for-app-fingerprint]: /v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint +[github-for-mac]: https://mac.github.com/ +[github-for-windows]: https://windows.github.com/ +[authorizations-token-deprecation-notice]: /v3/oauth_authorizations/#deprecation-notice diff --git a/content/changes/2014-12-09-new-attributes-for-stars-api.md b/content/changes/2014-12-09-new-attributes-for-stars-api.md new file mode 100644 index 0000000000..0c7cf2f4da --- /dev/null +++ b/content/changes/2014-12-09-new-attributes-for-stars-api.md @@ -0,0 +1,19 @@ +--- +kind: change +title: New Attributes for Starring API +created_at: 2014-12-09 +author_name: arfon +--- + +You can now see when a user starred a repository. To receive the new response format containing the `starred_at` field, request the new media type: + + curl -H "Accept: application/vnd.github.v3.star+json" https://api.github.com/users/andrew/starred + +Note the starred repository is now available in the repo field. + +### Feedback + +If you have any questions or feedback about these changes, please [drop us a line][contact]. + +[starring]: /v3/activity/starring/#list-repositories-being-starred-with-star-creation-timestamps +[contact]: https://github.com/contact?form[subject]=New+Attributes+for+Starring+API diff --git a/content/changes/2014-12-12-replace-older-ssh-keys-created-by-your-application.md b/content/changes/2014-12-12-replace-older-ssh-keys-created-by-your-application.md new file mode 100644 index 0000000000..30fab36242 --- /dev/null +++ b/content/changes/2014-12-12-replace-older-ssh-keys-created-by-your-application.md @@ -0,0 +1,37 @@ +--- +kind: change +title: Replace older SSH keys created by your application +created_at: 2014-12-12 +author_name: jasonrudolph +--- +Back in February, we [improved the security audit trail for SSH keys](/changes/2014-02-24-finer-grained-scopes-for-ssh-keys/#keys-are-now-immutable). Soon, organizations will be able to block access for SSH keys that were created prior to those improvements. If your application relies on [deploy keys](/guides/managing-deploy-keys/#deploy-keys) or [user keys](/v3/users/keys/) for repository access, we recommend replacing any keys created before February 24, 2014. + +To ensure that your application is not affected by organizations blocking access to these keys, **you should replace the affected keys by January 15, 2015**. + +## How should you replace these keys? + +We recommend the following steps for identifying and replacing the affected keys. + +### 1. Identify the affected keys + +You only need to replace keys that your application created prior to February 24, 2014. If you don't know when your app created a given key, you can get the creation timestamp from the API. The `created_at` property is available for [deploy keys](/v3/repos/keys/) and for [user keys](/v3/users/keys/#list-your-public-keys). + +### 2. Inform the affected users + +Once you know which keys you need to replace, we recommend that you inform the affected users. + +For security, GitHub automatically sends an email to a user whenever a new SSH key is added to their account. Similarly, when a new deploy key is added to a repository, GitHub sends an email to the repository's administrators. When you replace your application's old keys with new ones, GitHub will email the affected users. To avoid surprising those users, you should alert them that you'll be replacing your keys. You may want to include a link to this post in your message. + +### 3. Add a new key + +Use the API to add the new [deploy key](/v3/repos/keys/#create) or [user key](/v3/users/keys/#create-a-public-key). + +### 4. Delete the old key + +Once your application is using the new key, use the API to delete the old one. There's an [API for deleting deploy keys](/v3/repos/keys/#delete) and an [API for deleting user keys](/v3/users/keys/#delete-a-public-key). + +## We're here to help + +As always, if you have any questions or concerns, please [get in touch][contact]. + +[contact]: https://github.com/contact?form[subject]=Replace+SSH+keys+created+by+application diff --git a/content/changes/2014-2-10-ping-event-for-webhooks.html b/content/changes/2014-2-10-ping-event-for-webhooks.html new file mode 100644 index 0000000000..cfd9c38eec --- /dev/null +++ b/content/changes/2014-2-10-ping-event-for-webhooks.html @@ -0,0 +1,18 @@ +--- +kind: change +title: Ping Event for Webhooks +created_at: 2014-2-10 +author_name: kdaigle +--- + +With the release of our [new webhook UI](https://github.com/blog/1778-webhooks-level-up), we included a new +[ping event](/webhooks/#ping-event) that webhooks will receive. When you +create a new webhook, we will send this event as an initial test of the webhook. + +The ping is only informational, doesn't need to be responded to in a specific way, +and nothing bad will happen if you respond with an error. It's just a quick +"hello world" to let you know you set everything up correctly. + +We also added a [ping endpoint](/v3/repos/hooks/#ping-a-hook) to the hooks API. +By using ping instead of [test](/v3/repos/hooks/#test-a-push-hook), you can ensure +you won't be limited by the `push` event requirement that the test endpoint has. diff --git a/content/changes/2015-01-07-prepare-for-organization-permissions-changes.md b/content/changes/2015-01-07-prepare-for-organization-permissions-changes.md new file mode 100644 index 0000000000..2a458f4cfc --- /dev/null +++ b/content/changes/2015-01-07-prepare-for-organization-permissions-changes.md @@ -0,0 +1,35 @@ +--- +kind: change +title: Prepare for upcoming organization permissions changes +created_at: 2015-01-07 +author_name: jakeboxer +--- + +Last month, we [released a preview][org-permissions-preview] of several API changes related to managing organization members and repositories. Today, we're finalizing these changes. This new functionality is now stable and suitable for production use. If your application relies on any of the affected functionality (described below), be sure to **update your code before February 24** to account for these changes. + +### Breaking changes coming on February 24 + +If your application uses any of the following APIs, then you are affected by this change: + +- APIs for managing your organization's admins through the Owners team +- The [List your repositories][list-your-repos] API +- The [List your organizations][list-your-organizations] API +- The [List user organizations][list-user-organizations] API + +If your application uses these APIs, we urge you to update your application as soon as possible. (Read [last month's announcement][org-permissions-preview] for more details on the changes.) + +Starting today, we're offering a migration period allowing applications to opt in to these changes (as described below). On February 24, these changes will become official parts of the GitHub API v3. At that time, these changes will apply to all API consumers. + +### Migration period + +During the migration period, you can opt-in to these changes using the following custom media type in the `Accept` header: + + application/vnd.github.moondragon+json + +We want to make these updates as smooth as possible for everyone, and we hope that the migration period gives you flexibility to adopt these changes on your own schedule. If you have any questions or feedback, please [get in touch with us][contact]! + +[org-permissions-preview]: /changes/2014-12-08-organization-permissions-api-preview/ +[list-your-repos]: /v3/repos/#list-your-repositories +[list-user-organizations]: /v3/orgs/#list-user-organizations +[list-your-organizations]: /v3/orgs/#list-your-organizations +[contact]: https://github.com/contact?form[subject]=Organization+Permissions+API diff --git a/content/changes/2015-01-08-discovering-resources-for-a-user.md b/content/changes/2015-01-08-discovering-resources-for-a-user.md new file mode 100644 index 0000000000..a257d5a67b --- /dev/null +++ b/content/changes/2015-01-08-discovering-resources-for-a-user.md @@ -0,0 +1,12 @@ +--- +kind: change +title: "New guide: Discovering resources for a user" +created_at: 2015-01-08 +author_name: jasonrudolph +--- + +Is your application taking advantage of the recommended workflow for discovering a user's repositories and organizations? With the [recent improvements to the API](/changes/2014-12-08-organization-permissions-api-preview/), the process is simpler than ever. In our newest guide, we show you how to [reliably identify the resources that your app can access for a given user](/guides/discovering-resources-for-a-user/). + +If you have any questions or feedback, we'd love to [hear from you][contact]. + +[contact]: https://github.com/contact?form%5Bsubject%5D=API+v3:+Discovering+resources+for+a+user diff --git a/content/changes/2015-01-19-an-integrators-guide-to-organization-application-policies.md b/content/changes/2015-01-19-an-integrators-guide-to-organization-application-policies.md new file mode 100644 index 0000000000..66b1c160ad --- /dev/null +++ b/content/changes/2015-01-19-an-integrators-guide-to-organization-application-policies.md @@ -0,0 +1,99 @@ +--- +kind: change +title: "An integrator's guide to organization application policies" +created_at: 2015-01-19 +author_name: pengwynn +--- + +As we [announced over on the GitHub blog][ann], organization admins can now +control how third-party applications access their organization data. Allowing +admins to approve or deny applications will ultimately result in deeper trust +and increase overall adoption of integrations within organizations on GitHub. + +As an integrator, here's what you need to know about organization application +policies and how this feature could impact your application. + +### Guiding principles + +We've tried to strike the right balance between organization privacy and the +user experience for integrators and end users. Organizations should be able to +prevent applications they do not trust from accessing their organization data +without creating a multitude of new edge cases for integrators. + +With that goal in mind, the feature works like this: **if an organization's +application policy prevents an application from accessing its resources, the +API behaves as if the authenticating user is not a member of the +organization**. Specifically, this means an application authenticating on +behalf of a user using OAuth will have: + +- **Read-only access to public resources.** Organization-owned public + repositories, issues, and other resources will be visible via the API and + show up in resource listings, but mutating methods (`POST`, `PATCH`, `PUT`, + and `DELETE`) will return status `403`. +- **No access to private resources.** Organization-owned private repositories, + issues, and other resources will not be visible via the API and will not + show up in resource [listings][] that co-mingle public and private + resources. Hooks for these private repositories are muted and will not be + delivered as long as the application is restricted by the organization. + +Since applications should already handle the scenario where a user loses access +to organization resources, this reduces the work integrators need to do. + +### Checking organization access + +As organization admins adopt application whitelists and restrict third-party +application access to organization resources, your application may lose access +to those resources. If an organization member is not aware of the new access +policy, they may wonder why their private repositories or other resources no +longer work or show up in your application. + +There are a couple ways to help troubleshoot access for your end users. + +- **Via the GitHub UI.** The simplest way to help end users understand how + organization access policies affect their access to your application is to + provide a link to [their authorization details][help-request-approval] + under their GitHub account settings as [described in the OAuth + documentation][auth-link]. + +- **Via the API.** For an even better user experience, [use the + API][discovering-guide] to list which user organizations your application + can access, and provide users with the link mentioned above to request + access from their organization admins. + +### Listing accessible organization resources + +In addition to checking access to a user's organizations, you'll want to ensure +you're discovering their accessible resources in the most efficient way. Recent +changes to the [Respositories API][listing-repos] might reduce the API calls +your application needs to make to find a user's repositories across all of +their organization mememberships. + +### Ensuring uninterrupted SSH access + +Since applications should already handle the scenario where a user loses access +to organization resources (e.g., when a user leaves an organization), this +reduces the work integrators need to do. Keys created by OAuth applications (or +those created before GitHub started tracking that information) will not have +access to repositories owned by organizations that restrict third-party +applications. If your application uses keys **created before February 24, +2014**, you [should replace those older keys][keys] to ensure things keep +running smoothly for your application. + +### We're here to help + +This is a big feature, and we're sure it will impact many of our integrators as +organizations adopt third-party application restrictions. We also think it +provides a huge net benefit for integrators as organizations choose to use +OAuth integrations with more confidence. + +If you have any questions or feedback, please [get in touch][contact]. + +[ann]: https://github.com/blog/1941-organization-approved-applications +[auth-link]: /v3/oauth/#directing-users-to-review-their-access-for-an-application +[help-request-approval]: https://help.github.com/articles/requesting-organization-approval-for-your-authorized-applications/ +[list-orgs]: /v3/orgs/#list-your-organizations +[contact]: https://github.com/contact?form[subject]=Organization+Access+Policies+help+for+integrators +[listing-repos]: /v3/repos/#list-your-repositories +[discovering-guide]: /guides/discovering-resources-for-a-user/ +[keys]: /changes/2014-12-12-replace-older-ssh-keys-created-by-your-application/ +[listings]: /v3/issues/#list-issues diff --git a/content/changes/2015-02-03-removing-authorizations-token-update.md b/content/changes/2015-02-03-removing-authorizations-token-update.md new file mode 100644 index 0000000000..6999353c73 --- /dev/null +++ b/content/changes/2015-02-03-removing-authorizations-token-update.md @@ -0,0 +1,17 @@ +--- +kind: change +title: Removing token attribute from Authorizations API responses (Update) +created_at: 2015-02-03 +author_name: ptoomey3 +--- + +In December, we [released a preview][removing-authorizations-token] of several API changes related to managing OAuth application authorizations. As part of those changes we introduced several new response attributes (`token_last_eight`, `hashed_token`, and `fingerprint`) to the Authorizations API. We have decided to modify `hashed_token` to return the SHA-256 hex digest of the associated token instead of Base64. Given that Base64 has several common variants (original, URL safe, etc) we decided that returning the value as hex is less ambiguous and will be more useful for developers. + +### Extended preview period + +Because of the change to `hashed_token`, we are extending the preview period by two weeks. If no additional changes are made during this extended preview period we will announce the end of the preview and beginning of the eight week migration period on February 17. The migration period will allow applications to opt in to these changes before they become an official part of the GitHub API v3. + +If you have any questions or feedback, please [drop us a line][contact]! + +[removing-authorizations-token]: /changes/2014-12-08-removing-authorizations-token/ +[contact]: https://github.com/contact?form[subject]=Removing+authorizations+token diff --git a/content/changes/2015-02-18-new-releases-api-methods.md b/content/changes/2015-02-18-new-releases-api-methods.md new file mode 100644 index 0000000000..a9af04fb61 --- /dev/null +++ b/content/changes/2015-02-18-new-releases-api-methods.md @@ -0,0 +1,21 @@ +--- +kind: change +title: New Releases API methods +created_at: 2015-02-18 +author_name: pengwynn +--- + +We've added two new methods to the [Releases API][]. You can now get the [latest published release][latest] for a repository. + + GET /repos/:owner/:repo/releases/latest + +You can also get a [release by tag name][by-tag]. + + GET /repos/:owner/:repo/releases/tags/:tag + +If you have any questions or feedback, please [get in touch][contact]. + +[Releases API]: /v3/repos/releases/ +[latest]: /v3/repos/releases/#get-the-latest-release +[by-tag]: /v3/repos/releases/#get-a-release-by-tag-name +[contact]: https://github.com/contact?form[subject]=New+Releases+API+methods diff --git a/content/changes/2015-02-20-migration-period-removing-authorizations-token.md b/content/changes/2015-02-20-migration-period-removing-authorizations-token.md new file mode 100644 index 0000000000..49d551e55b --- /dev/null +++ b/content/changes/2015-02-20-migration-period-removing-authorizations-token.md @@ -0,0 +1,40 @@ +--- +kind: change +title: Breaking changes to Authorizations API responses on April 20 +created_at: 2015-02-19 +author_name: ptoomey3 +--- + +A couple weeks ago we [extended the preview period][removing-authorizations-token-extended-preview] of several API changes related to managing OAuth application authorizations. Today, we're finalizing these changes. This new functionality is now stable and suitable for production use. If your application relies on any of the affected functionality (described below), be sure to **update your code before April 20** to account for these changes. + +### Breaking changes coming on April 20 + +If your application uses any of the following APIs, then you may be affected by this change: + +- The [List your authorizations][list-your-authorizations] API +- The [Get a single authorization][get-a-single-authorization] API +- The [Get-or-create an authorization for a specific app][get-or-create-an-authorization-for-a-specific-app] API (`token` is still returned for "create") +- The [Get-or-create an authorization for a specific app and fingerprint][get-or-create-an-authorization-for-a-specific-app-and-fingerprint] API (`token` is still returned for "create") +- The [Update an existing authorization][update-an-existing-authorization] API + + +If your application uses these APIs, we urge you to update your application as soon as possible. (Read [the December announcement][removing-authorizations-token] for more details on the changes.) + +Starting today, we're offering a migration period allowing applications to opt in to these changes (as described below). On April 20, these changes will become official parts of the GitHub API v3. At that time, these changes will apply to all API consumers. + +### Migration period + +During the migration period, you can opt-in to these changes using the following custom media type in the `Accept` header: + + application/vnd.github.mirage-preview+json + +We want to make these updates as smooth as possible for everyone, and we hope that the migration period gives you flexibility to adopt these changes on your own schedule. If you have any questions or feedback, please [get in touch with us][contact]! + +[removing-authorizations-token-extended-preview]: /changes/2015-02-03-removing-authorizations-token-update/ +[removing-authorizations-token]: /changes/2014-12-08-removing-authorizations-token/ +[list-your-authorizations]: /v3/oauth_authorizations/#list-your-authorizations +[get-a-single-authorization]: /v3/oauth_authorizations/#get-a-single-authorization +[get-or-create-an-authorization-for-a-specific-app]: /v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app +[get-or-create-an-authorization-for-a-specific-app-and-fingerprint]: /v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint +[update-an-existing-authorization]: /v3/oauth_authorizations/#update-an-existing-authorization +[contact]: https://github.com/contact?form[subject]=Removing+authorizations+token diff --git a/content/changes/2015-02-24-more-time-to-prepare-for-the-breaking-changes-to-organization-permissions.md b/content/changes/2015-02-24-more-time-to-prepare-for-the-breaking-changes-to-organization-permissions.md new file mode 100644 index 0000000000..14c9239010 --- /dev/null +++ b/content/changes/2015-02-24-more-time-to-prepare-for-the-breaking-changes-to-organization-permissions.md @@ -0,0 +1,13 @@ +--- +kind: change +title: More time to prepare for the breaking changes to organization permissions +created_at: 2015-02-24 +author_name: jakeboxer +--- + +After listening to your feedback on the upcoming [breaking changes to organization permissions][org-permissions-preview], we're giving developers more time to update their applications. We'll announce an updated timeline for these changes in the coming weeks. + +In the meantime, if your application relies on any of the affected functionality described in our [previous blog post][org-permissions-preview], please **update your code** to account for these changes. If you have any questions or feedback, please [get in touch with us][contact]! + +[org-permissions-preview]: /changes/2014-12-08-organization-permissions-api-preview/ +[contact]: https://github.com/contact?form[subject]=Organization+Permissions+API diff --git a/content/changes/2015-03-09-licenses-api.md b/content/changes/2015-03-09-licenses-api.md new file mode 100644 index 0000000000..d88197bad5 --- /dev/null +++ b/content/changes/2015-03-09-licenses-api.md @@ -0,0 +1,26 @@ +--- +kind: change +title: Licenses API +created_at: 2015-03-09 +author_name: benbalter +--- + +We're introducing a new [license API](/v3/licenses) preview to support [open source license usage on GitHub.com](https://github.com/blog/1964-license-usage-on-github-com). + +To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.drax-preview+json + +This will then expose two new API endpoints. You can get a list of all known licenses: + + GET /licenses + +Or get information about a particular license: + + GET /licenses/mit + +When the preview media type is passed, the repository api will also return information about a repository's license file when you get an individual repository: + + GET /repos/github/hubot + +For more information, see the [licenses API documentation](/v3/licenses/), and if you have any questions or feedback, please [let us know](https://github.com/contact?form%5Bsubject%5D=Licenses+API). diff --git a/content/changes/index.html b/content/changes/index.html new file mode 100644 index 0000000000..f11cff1475 --- /dev/null +++ b/content/changes/index.html @@ -0,0 +1,7 @@ +--- +title: GitHub API Changes +layout: blog +--- + +<%= render '_changes', :changes => api_changes %> + diff --git a/content/feed.atom b/content/feed.atom new file mode 100644 index 0000000000..d04f5aae55 --- /dev/null +++ b/content/feed.atom @@ -0,0 +1,9 @@ +--- +title: GitHub API Changes +is_hidden: true +author_name: technoweenie +author_uri: https://github.com/technoweenie +layout: false +--- + +<%= atom_feed :limit => 30, :articles => api_changes %> diff --git a/content/guides/automating-deployments-to-integrators.md b/content/guides/automating-deployments-to-integrators.md new file mode 100644 index 0000000000..54d2e651f9 --- /dev/null +++ b/content/guides/automating-deployments-to-integrators.md @@ -0,0 +1,75 @@ +--- +title: Automating deployments to integrators | GitHub API +--- + +# Automating deployments to integrators + +* TOC +{:toc} + +The "[Delivering deployments](/guides/delivering-deployments/)" guide describes how to build a server that uses the [Deployments API][deploy API] to easily get your code from GitHub into production. But what if you don't want to host a separate service for deploying code? What if you just want to merge code and have it deploy without thinking about maintaining another app? + +You can use the GitHub Auto-Deployment service to receive changes made to your repository and configure it to deliver a deployment to integrators. The Auto-Deployment service can deliver payloads based on two events: whenever a push is made and whenever [the CI status is passing](/guides/building-a-ci-server/). + +Here's a diagram demonstrating what the process might look like: + +
++--------------------+        +--------+                    +-----------+
+| GitHub Auto-Deploy |        | GitHub |                    |  Heroku   |
+|      Service       |        +--------+                    +-----------+
++--------------------+         |                                  |
+     |                         |                                  |
+     |  Create Deployment      |                                  |
+     |------------------------>|                                  |
+     |                         |                                  |
+     |                         |                                  |
+     |                         |       Deployment Event           |
+     |                         |--------------------------------->|
+     |                         |                                  |
+     |                         |    Deployment Status (pending)   |
+     |                         |<---------------------------------|
+     |                         |                                  |
+     |                         |                                  |
+     |                         |   Deployment Status (success)    |
+     |                         |<---------------------------------|
+     |                         |                                  |
+
+ +{{#tip}} + +Note that the Auto-Deployment service only picks up changes from your default branch, which is usually `master`. + +{{/tip}} + +## Sending deployments whenever you push to a repository + +The Auto-Deployment service will be responsible for creating deployments when a push is made to your defalt branch. Next, we'll set up a service to receive those deployment events and handle the deployment of your project. + +1. Navigate to the repository where you’re setting up your deployments. +2. In your repository's right sidebar, click . +3. On the left, click **Webhooks & Services**. +![The webhooks and services menu](https://github-images.s3.amazonaws.com/help/settings/webhooks_and_services_menu.png) +4. Click **Add service**, then type "GitHub Auto-Deployment." ![Adding the GitHub Auto-Deployment service](/images/add_github_autodeploy_service.png) +5. Under **GitHub token**, paste an access token you've created. It must have at least the `repo` scope. For more information, see "[Creating an access token for command-line use](https://help.github.com/articles/creating-an-access-token-for-command-line-use)." +6. Under **Environments**, optionally provide a list of environments you'd like to send your deployments to. This can be [any string you define](https://developer.github.com/v3/repos/deployments/#parameters) to describe your environment. The default is "production." +7. If you *only* want builds that successfully passed a continuous test suite, select **Deploy on status**. +8. If you're running this service on GitHub Enterprise, you must pass in your appliance's [endpoint URL](https://developer.github.com/v3/enterprise/#endpoint-urls). +9. Click **Add service**. + +## Hooking up an integrator to deployments + +To implement our deployments, we'll use Heroku as an example service. + +1. Navigate to the repository where you’re setting up your deployments. +2. In your repository's right sidebar, click . +3. On the left, click **Webhooks & Services**. +![The webhooks and services menu](https://github-images.s3.amazonaws.com/help/settings/webhooks_and_services_menu.png) +4. Click **Add service**, then type "Heroku." ![Adding the GitHub Auto-Deployment service](/images/add_heroku_autodeploy_service.png) +5. Type the name of the Heroku application your GitHub repository should deploy to. +6. Enter in your [Heroku OAuth token](https://devcenter.heroku.com/articles/oauth#direct-authorization). You must generate this yourself following the instructions in Heroku's documentation. +7. Under **GitHub token**, paste the same token you provided earlier. +8. Click **Add service**. + +From now on, any commits made to your `master` branch--including those generated from merging pull requests--will automatically trigger a deployment to your Heroku application. + +[deploy API]: /v3/repos/deployments/ diff --git a/content/guides/basics-of-authentication.md b/content/guides/basics-of-authentication.md new file mode 100644 index 0000000000..e9d8214dac --- /dev/null +++ b/content/guides/basics-of-authentication.md @@ -0,0 +1,354 @@ +--- +title: Basics of Authentication | GitHub API +--- + +# Basics of Authentication + +* TOC +{:toc} + +In this section, we're going to focus on the basics of authentication. Specifically, +we're going to create a Ruby server (using [Sinatra][Sinatra]) that implements +the [web flow][webflow] of an application in several different ways. + +
+

You can download the complete source code for this project from the platform-samples repo.

+
+ +## Registering your app + +First, you'll need to [register your application][new oauth app]. Every +registered OAuth application is assigned a unique Client ID and Client Secret. +The Client Secret should not be shared! That includes checking the string +into your repository. + +You can fill out every piece of information however you like, except the +**Authorization callback URL**. This is easily the most important piece to setting +up your application. It's the callback URL that GitHub returns the user to after +successful authentication. + +Since we're running a regular Sinatra server, the location of the local instance +is set to `http://localhost:4567`. Let's fill in the callback URL as `http://localhost:4567/callback`. + +## Accepting user authorization + +Now, let's start filling out our simple server. Create a file called _server.rb_ and paste this into it: + + #!ruby + require 'sinatra' + require 'rest-client' + require 'json' + + CLIENT_ID = ENV['GH_BASIC_CLIENT_ID'] + CLIENT_SECRET = ENV['GH_BASIC_SECRET_ID'] + + get '/' do + erb :index, :locals => {:client_id => CLIENT_ID} + end + +Your client ID and client secret keys come from [your application's configuration +page][app settings]. You should **never, _ever_** store these values in +GitHub--or any other public place, for that matter. We recommend storing them as +[environment variables][about env vars]--which is exactly what we've done here. + +Next, in _views/index.erb_, paste this content: + + #!html+erb + + + + +

+ Well, hello there! +

+

+ We're going to now talk to the GitHub API. Ready? + Click here to begin! +

+

+ If that link doesn't work, remember to provide your own Client ID! +

+ + + +(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra guide].) + +Also, notice that the URL uses the `scope` query parameter to define the +[scopes][oauth scopes] requested by the application. For our application, we're +requesting `user:email` scope for reading private email addresses. + +Navigate your browser to `http://localhost:4567`. After clicking on the link, you +should be taken to GitHub, and presented with a dialog that looks something like this: +![GitHub's OAuth Prompt](/images/oauth_prompt.png) + +If you trust yourself, click **Authorize App**. Wuh-oh! Sinatra spits out a +`404` error. What gives?! + +Well, remember when we specified a Callback URL to be `callback`? We didn't provide +a route for it, so GitHub doesn't know where to drop the user after they authorize +the app. Let's fix that now! + +### Providing a callback + +In _server.rb_, add a route to specify what the callback should do: + + #!ruby + get '/callback' do + # get temporary GitHub code... + session_code = request.env['rack.request.query_hash']['code'] + + # ... and POST it back to GitHub + result = RestClient.post('https://github.com/login/oauth/access_token', + {:client_id => CLIENT_ID, + :client_secret => CLIENT_SECRET, + :code => session_code}, + :accept => :json) + + # extract the token and granted scopes + access_token = JSON.parse(result)['access_token'] + end + +After a successful app authentication, GitHub provides a temporary `code` value. +You'll need to `POST` this code back to GitHub in exchange for an `access_token`. +To simplify our GET and POST HTTP requests, we're using the [rest-client][REST Client]. +Note that you'll probably never access the API through REST. For a more serious +application, you should probably use [a library written in the language of your choice][libraries]. + +### Checking granted scopes + +In the future, users will be able to [edit the scopes you requested][edit scopes post], +and your application might be granted less access than you originally asked for. +So, before making any requests with the token, you should check the scopes that +were granted for the token by the user. + +The scopes that were granted are returned as a part of the response from +exchanging a token. + + #!ruby + # check if we were granted user:email scope + scopes = JSON.parse(result)['scope'].split(',') + has_user_email_scope = scopes.include? 'user:email' + +In our application, we're using `scopes.include?` to check if we were granted +the `user:email` scope needed for fetching the authenticated user's private +email addresses. Had the application asked for other scopes, we would have +checked for those as well. + +Also, since there's a hierarchical relationship between scopes, you should +check that you were granted the lowest level of required scopes. For example, +if the application had asked for `user` scope, it might have been granted only +`user:email` scope. In that case, the application wouldn't have been granted +what it asked for, but the granted scopes would have still been sufficient. + +Checking for scopes only before making requests is not enough since it's posible +that users will change the scopes in between your check and the actual request. +In case that happens, API calls you expected to succeed might fail with a `404` +or `401` status, or return a different subset of information. + +To help you gracefully handle these situations, all API responses for requests +made with valid tokens also contain an [`X-OAuth-Scopes` header][oauth scopes]. +This header contains the list of scopes of the token that was used to make the +request. In addition to that, the Authorization API provides an endpoint to +[check a token for validity][check token valid]. +Use this information to detect changes in token scopes, and inform your users of +changes in available application functionality. + +### Making authenticated requests + +At last, with this access token, you'll be able to make authenticated requests as +the logged in user: + + #!ruby + # fetch user information + auth_result = JSON.parse(RestClient.get('https://api.github.com/user', + {:params => {:access_token => access_token}})) + + # if the user authorized it, fetch private emails + if has_user_email_scope + auth_result['private_emails'] = + JSON.parse(RestClient.get('https://api.github.com/user/emails', + {:params => {:access_token => access_token}})) + + erb :basic, :locals => auth_result + +We can do whatever we want with our results. In this case, we'll just dump them straight into _basic.erb_: + + #!html+erb +

Hello, <%= login %>!

+

+ <% if !email.nil? && !email.empty? %> It looks like your public email address is <%= email %>. + <% else %> It looks like you don't have a public email. That's cool. + <% end %> +

+

+ <% if defined? private_emails %> + With your permission, we were also able to dig up your private email addresses: + <%= private_emails.map{ |private_email_address| private_email_address["email"] }.join(', ') %> + <% else %> + Also, you're a bit secretive about your private email addresses. + <% end %> +

+ +## Implementing "persistent" authentication + +It'd be a pretty bad model if we required users to log into the app every single +time they needed to access the web page. For example, try navigating directly to +`http://localhost:4567/basic`. You'll get an error. + +What if we could circumvent the entire +"click here" process, and just _remember_ that, as long as the user's logged into +GitHub, they should be able to access this application? Hold on to your hat, +because _that's exactly what we're going to do_. + +Our little server above is rather simple. In order to wedge in some intelligent +authentication, we're going to switch over to using sessions for storing tokens. +This will make authentication transparent to the user. + +Also, since we're persisting scopes within the session, we'll need to +handle cases when the user updates the scopes after we checked them, or revokes +the token. To do that, we'll use a `rescue` block and check that the first API +call succeeded, which verifies that the token is still valid. After that, we'll +check the `X-OAuth-Scopes` response header to verify that the user hasn't revoked +the `user:email` scope. + +Create a file called _advanced_server.rb_, and paste these lines into it: + + #!ruby + require 'sinatra' + require 'rest_client' + require 'json' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + # if ENV['GITHUB_CLIENT_ID'] && ENV['GITHUB_CLIENT_SECRET'] + # CLIENT_ID = ENV['GITHUB_CLIENT_ID'] + # CLIENT_SECRET = ENV['GITHUB_CLIENT_SECRET'] + # end + + CLIENT_ID = ENV['GH_BASIC_CLIENT_ID'] + CLIENT_SECRET = ENV['GH_BASIC_SECRET_ID'] + + use Rack::Session::Pool, :cookie_only => false + + def authenticated? + session[:access_token] + end + + def authenticate! + erb :index, :locals => {:client_id => CLIENT_ID} + end + + get '/' do + if !authenticated? + authenticate! + else + access_token = session[:access_token] + scopes = [] + + begin + auth_result = RestClient.get('https://api.github.com/user', + {:params => {:access_token => access_token}, + :accept => :json}) + rescue => e + # request didn't succeed because the token was revoked so we + # invalidate the token stored in the session and render the + # index page so that the user can start the OAuth flow again + + session[:access_token] = nil + return authenticate! + end + + # the request succeeded, so we check the list of current scopes + if auth_result.headers.include? :x_oauth_scopes + scopes = auth_result.headers[:x_oauth_scopes].split(', ') + end + + auth_result = JSON.parse(auth_result) + + if scopes.include? 'user:email' + auth_result['private_emails'] = + JSON.parse(RestClient.get('https://api.github.com/user/emails', + {:params => {:access_token => access_token}, + :accept => :json})) + end + + erb :advanced, :locals => auth_result + end + end + + get '/callback' do + session_code = request.env['rack.request.query_hash']['code'] + + result = RestClient.post('https://github.com/login/oauth/access_token', + {:client_id => CLIENT_ID, + :client_secret => CLIENT_SECRET, + :code => session_code}, + :accept => :json) + + session[:access_token] = JSON.parse(result)['access_token'] + + redirect '/' + end + + +Much of the code should look familiar. For example, we're still using `RestClient.get` +to call out to the GitHub API, and we're still passing our results to be rendered +in an ERB template (this time, it's called `advanced.erb`). + +Also, we now have the `authenticated?` method which checks if the user is already +authenticated. If not, the `authenticate!` method is called, which performs the +OAuth flow and updates the session with the granted token and scopes. + +Next, create a file in _views_ called _advanced.erb_, and paste this markup into it: + + #!html+erb + + + + +

Well, well, well, <%= login %>!

+

+ <% if !email.empty? %> It looks like your public email address is <%= email %>. + <% else %> It looks like you don't have a public email. That's cool. + <% end %> +

+

+ <% if defined? private_emails %> + With your permission, we were also able to dig up your private email addresses: + <%= private_emails.map{ |private_email_address| private_email_address["email"] }.join(', ') %> + <% else %> + Also, you're a bit secretive about your private email addresses. + <% end %> +

+ + + +From the command line, call `ruby advanced_server.rb`, which starts up your +server on port `4567` -- the same port we used when we had a simple Sinatra app. +When you navigate to `http://localhost:4567`, the app calls `authenticate!` +which redirects you to `/callback`. `/callback` then sends us back to `/`, +and since we've been authenticated, renders _advanced.erb_. + +We could completely simplify this roundtrip routing by simply changing our callback +URL in GitHub to `/`. But, since both _server.rb_ and _advanced.rb_ are relying on +the same callback URL, we've got to do a little bit of wonkiness to make it work. + +Also, if we had never authorized this application to access our GitHub data, +we would've seen the same confirmation dialog from earlier pop-up and warn us. + +If you'd like, you can play around with [yet another Sinatra-GitHub auth example][sinatra auth github test] +available as a separate project. + +[webflow]: /v3/oauth/#web-application-flow +[Sinatra]: http://www.sinatrarb.com/ +[about env vars]: http://en.wikipedia.org/wiki/Environment_variable#Getting_and_setting_environment_variables +[Sinatra guide]: https://github.com/sinatra/sinatra-book/blob/master/book/Introduction.markdown#hello-world-application +[REST Client]: https://github.com/archiloque/rest-client +[libraries]: /libraries/ +[sinatra auth github test]: https://github.com/atmos/sinatra-auth-github-test +[oauth scopes]: /v3/oauth/#scopes +[edit scopes post]: /changes/2013-10-04-oauth-changes-coming/ +[check token valid]: /v3/oauth_authorizations/#check-an-authorization +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/basics-of-authentication +[new oauth app]: https://github.com/settings/applications/new +[app settings]: https://github.com/settings/applications diff --git a/content/guides/best-practices-for-integrators.md b/content/guides/best-practices-for-integrators.md new file mode 100644 index 0000000000..6543e68087 --- /dev/null +++ b/content/guides/best-practices-for-integrators.md @@ -0,0 +1,72 @@ +--- +title: Best practices for integrators | GitHub API +--- + +# Best practices for integrators + +Interested in integrating with the GitHub platform? [You're in good company](https://github.com/integrations). This guide will help you build an app that provides the best experience for your users *and* ensure that it's reliably interacting with the API. + +* TOC +{:toc} + +## Secure payloads delivered from GitHub + +It's very important that you secure [the payloads sent from GitHub](/v3/activity/events/types/). Although no personal information (like passwords) is ever transmitted in a payload, leaking *any* information is not good. Some information that might be sensitive include committer email address or the names of private repositories. + +There are three steps you can take to secure receipt of payloads delivered by GitHub: + +1. Ensure that your receiving server is on an HTTPS connection. By default, GitHub will verify SSL certificates when delivering payloads. +2. You can whitelist [the IP address we use when delivering hooks](https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist) to your server. To ensure that you're always checking the right IP address, you can [use the `/meta` endpoint](/v3/meta/#meta) to find the address we use. +3. Provide [a secret token](/webhooks/securing/) to ensure payloads are definitely coming from GitHub. By enforcing a secret token, you're ensuring that any data received by your server is absolutely coming from GitHub. Ideally, you should provide a different secret token *per user* of your service. That way, if one token is compromised, no other user would be affected. + +## Favor asynchronous work over synchronous + +GitHub expects that integrations respond within thirty seconds of receiving the webhook payload. If your service takes longer than that to complete, then GitHub terminates the connection and the payload is lost. + +Since it's impossible to predict how fast your service will complete, you should do all of "the real work" in a background job. [Resque](https://github.com/resque/resque/) (for Ruby), [RQ](http://python-rq.org/) (for Python), or [RabbitMQ](http://www.rabbitmq.com/) (for Java) are examples of libraries that can handle queuing and processing of background jobs. + +Note that even with a background job running, GitHub still expects your server to respond within thirty seconds. Your server simply needs to acknowledge that it received the payload by sending some sort of response. It's critical that your service to performs any validations on a payload as soon as possible, so that you can accurately report whether your server will continue with the request or not. + +## Use appropriate HTTP status codes when responding to GitHub + +Every webhook has its own "Recent Deliveries" section, which lists whether a deployment was successful or not. + +![Recent Deliveries view](/images/webhooks_recent_deliveries.png) + +You should make use of proper HTTP status codes in order to inform users. You can use codes like `201` or `202` to acknowledge receipt of payload that won't be processed (for example, a payload delivered by a branch that's not the default). Reserve the `500` error code for catastrophic failures. + +## Provide as much information as possible to the user + +Users can dig into the server responses you send back to GitHub. Ensure that your messages are clear and informative. + +![Viewing a payload response](/images/payload_response_tab.png) + +## Follow any redirects that the API sends you + +GitHub is explicit in telling you when a resource has moved by providing a redirect status code. You should follow these redirections. Every redirect response sets the `Location` header with the new URI to go to. If you receive a redirect, it's best to update your code to follow the new URI, in case you're requesting a deprecated path that we might remove. + +We've provided [a list of HTTP status codes](/v3/#http-redirects) to watch out for when designing your app to follow redirects. + +## Don't manually parse URLs + +Often, API responses contain data in the form of URLs. For example, when requesting a repository, we'll send a key called `clone_url` with a URL you can use to clone the repository. + +For the stability of your app, you shouldn't try to parse this data or try to guess and construct the format of future URLs. Your app is liable to break if we decide to change the URL. + +For example, when working with paginated results, it's often tempting to construct URLs that append `?page=` to the end. Avoid that temptation. [Our guide on pagination](/guides/traversing-with-pagination) offers some safe tips on dependably following paginated results. + +## Dealing with rate limits + +The GitHub API [rate limit](/v3/#rate-limiting) ensures that the API is fast and available for everyone. + +If you hit a rate limit, it's expected that you back off from making requests and try again later when you're permitted to do so. Failure to do so may result in the banning of your app. + +You can always [check your rate limit status](/v3/rate_limit/) at any time. Checking your rate limit incurs no cost against your rate limit. + +## Dealing with API errors + +Although your code would never introduce a bug, you may find that you've encountered successive errors when trying to access the API. + +Rather than ignore repeated `4xx` and `5xx` status codes, you should ensure that you're correctly interacting with the API. For example, if an endpoint requests a string and you're passing it a numeric value, you're going to receive a `5xx` validation error, and your call won't succeed. Similarly, attempting to access an unauthorized or nonexistent endpoint will result in a `4xx` error. + +Intentionally ignoring repeated validation errors may result in the suspension of your app for abuse. diff --git a/content/guides/building-a-ci-server.md b/content/guides/building-a-ci-server.md new file mode 100644 index 0000000000..7d977716f2 --- /dev/null +++ b/content/guides/building-a-ci-server.md @@ -0,0 +1,172 @@ +--- +title: Building a CI server | GitHub API +--- + +# Building a CI server + +* TOC +{:toc} + +The [Status API][status API] is responsible for tying together commits with +a testing service, so that every push you make can be tested and represented +in a GitHub pull request. + +This guide will use that API to demonstrate a setup that you can use. +In our scenario, we will: + +* Run our CI suite when a Pull Request is opened (we'll set the CI status to pending). +* When the CI is finished, we'll set the Pull Request's status accordingly. + +Our CI system and host server will be figments of our imagination. They could be +Travis, Jenkins, or something else entirely. The crux of this guide will be setting up +and configuring the server managing the communication. + +If you haven't already, be sure to [download ngrok][ngrok], and learn how +to [use it][using ngrok]. We find it to be a very useful tool for exposing local +connections. + +Note: you can download the complete source code for this project +[from the platform-samples repo][platform samples]. + +## Writing your server + +We'll write a quick Sinatra app to prove that our local connections are working. +Let's start with this: + + #!ruby + require 'sinatra' + require 'json' + + post '/event_handler' do + payload = JSON.parse(params[:payload]) + "Well, it worked!" + end + + +(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra].) + +Start this server up. By default, Sinatra starts on port `9393`, so you'll want +to configure ngrok to start listening for that, too. + +In order for this server to work, we'll need to set a repository up with a webhook. +The webhook should be configured to fire whenever a Pull Request is created, or merged. +Go ahead and create a repository you're comfortable playing around in. Might we +suggest [@octocat's Spoon/Knife repository](https://github.com/octocat/Spoon-Knife)? +After that, you'll create a new webhook in your repository, feeding it the URL +that ngrok gave you: + +![A new ngrok URL](/images/webhook_sample_url.png) + +Click **Update webhook**. You should see a body response of `Well, it worked!`. +Great! Click on **Let me select individual events**, and select the following: + +* Status +* Pull Request + +These are the events GitHub will send to our server whenever the relevant action +occurs. Let's update our server to *just* handle the Pull Request scenario right now: + + #!ruby + post '/event_handler' do + @payload = JSON.parse(params[:payload]) + + case request.env['HTTP_X_GITHUB_EVENT'] + when "pull_request" + if @payload["action"] == "opened" + process_pull_request(@payload["pull_request"]) + end + end + end + + helpers do + def process_pull_request(pull_request) + puts "It's #{pull_request['title']}" + end + end + +What's going on? Every event that GitHub sends out attached a `X-GitHub-Event` +HTTP header. We'll only care about the PR events for now. From there, we'll +take the payload of information, and return the title field. In an ideal scenario, +our server would be concerned with every time a pull request is updated, not just +when it's opened. That would make sure that every new push passes the CI tests. +But for this demo, we'll just worry about when it's opened. + +To test out this proof-of-concept, make some changes in a branch in your test +repository, and open a pull request. Your server should respond accordingly! + +## Working with statuses + +With our server in place, we're ready to start our first requirement, which is +setting (and updating) CI statuses. Note that at any time you update your server, +you can click **Redeliver** to send the same payload. There's no need to make a +new pull request every time you make a change! + +Since we're interacting with the GitHub API, we'll use [Octokit.rb][octokit.rb] +to manage our interactions. We'll configure that client with +[a personal access token][access token]: + + #!ruby + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + ACCESS_TOKEN = ENV['MY_PERSONAL_TOKEN'] + + before do + @client ||= Octokit::Client.new(:access_token => ACCESS_TOKEN) + end + +After that, we'll just need to update the pull request on GitHub to make clear +that we're processing on the CI: + + #!ruby + def process_pull_request(pull_request) + puts "Processing pull request..." + @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'pending') + end + +We're doing three very basic things here: + +* we're looking up the full name of the repository +* we're looking up the last SHA of the pull request +* we're setting the status to "pending" + +That's it! From here, you can run whatever process you need to in order to execute +your test suite. Maybe you're going to pass off your code to Jenkins, or call +on another web service via its API, like [Travis][travis api]. After that, you'd +be sure to update the status once more. In our example, we'll just set it to `"success"`: + + #!ruby + def process_pull_request(pull_request) + @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'pending') + sleep 2 # do busy work... + @client.create_status(pull_request['base']['repo']['full_name'], pull_request['head']['sha'], 'success') + puts "Pull request processed!" + end + +## Conclusion + +At GitHub, we've used a version of [Janky][janky] to manage our CI for years. +The basic flow is essentially the exact same as the server we've built above. +At GitHub, we: + +* Fire to Jenkins when a pull request is created or updated (via Janky) +* Wait for a response on the state of the CI +* If the code is green, we merge the pull request + +All of this communication is funneled back to our chat rooms. You don't need to +build your own CI setup to use this example. +You can always rely on [third-party services][integrations]. + +[deploy API]: /v3/repos/deployments/ +[status API]: /v3/repos/statuses/ +[ngrok]: https://ngrok.com/ +[using ngrok]: /webhooks/configuring/#using-ngrok +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/building-a-ci-server +[Sinatra]: http://www.sinatrarb.com/ +[webhook]: /webhooks/ +[octokit.rb]: https://github.com/octokit/octokit.rb +[access token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use +[travis api]: https://api.travis-ci.org/docs/ +[janky]: https://github.com/github/janky +[heaven]: https://github.com/atmos/heaven +[hubot]: https://github.com/github/hubot +[integrations]: https://github.com/integrations diff --git a/content/guides/delivering-deployments.md b/content/guides/delivering-deployments.md new file mode 100644 index 0000000000..0a88037df7 --- /dev/null +++ b/content/guides/delivering-deployments.md @@ -0,0 +1,189 @@ +--- +title: Delivering deployments | GitHub API +--- + +# Delivering deployments + +* TOC +{:toc} + +The [Deployments API][deploy API] provides your projects hosted on GitHub with +the capability to launch them on a server that you own. Combined with +[the Status API][status API], you'll be able to coordinate your deployments +the moment your code lands on `master`. + +This guide will use that API to demonstrate a setup that you can use. +In our scenario, we will: + +* Merge a Pull Request +* When the CI is finished, we'll set the Pull Request's status accordingly. +* When the Pull Request is merged, we'll run our deployment to our server. + +Our CI system and host server will be figments of our imagination. They could be +Heroku, Amazon, or something else entirely. The crux of this guide will be setting up +and configuring the server managing the communication. + +If you haven't already, be sure to [download ngrok][ngrok], and learn how +to [use it][using ngrok]. We find it to be a very useful tool for exposing local +connections. + +Note: you can download the complete source code for this project +[from the platform-samples repo][platform samples]. + +## Writing your server + +We'll write a quick Sinatra app to prove that our local connections are working. +Let's start with this: + + #!ruby + require 'sinatra' + require 'json' + + post '/event_handler' do + payload = JSON.parse(params[:payload]) + "Well, it worked!" + end + + +(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra].) + +Start this server up. By default, Sinatra starts on port `9393`, so you'll want +to configure ngrok to start listening for that, too. + +In order for this server to work, we'll need to set a repository up with a webhook. +The webhook should be configured to fire whenever a Pull Request is created, or merged. +Go ahead and create a repository you're comfortable playing around in. Might we +suggest [@octocat's Spoon/Knife repository](https://github.com/octocat/Spoon-Knife)? +After that, you'll create a new webhook in your repository, feeding it the URL +that ngrok gave you: + +![A new ngrok URL](/images/webhook_sample_url.png) + +Click **Update webhook**. You should see a body response of `Well, it worked!`. +Great! Click on **Let me select individual events.**, and select the following: + +* Deployment +* Deployment status +* Pull Request + +These are the events GitHub will send to our server whenever the relevant action +occurs. We'll configure our server to *just* handle when Pull Requests are merged +right now: + + #!ruby + post '/event_handler' do + @payload = JSON.parse(params[:payload]) + + case request.env['HTTP_X_GITHUB_EVENT'] + when "pull_request" + if @payload["action"] == "closed" && @payload["pull_request"]["merged"] + puts "A pull request was merged! A deployment should start now..." + end + end + end + +What's going on? Every event that GitHub sends out attached a `X-GitHub-Event` +HTTP header. We'll only care about the PR events for now. When a pull request is +merged (its state is `closed`, and `merged` is `true`), we'll kick off a deployment. + +To test out this proof-of-concept, make some changes in a branch in your test +repository, open a pull request, and merge it. Your server should respond accordingly! + +## Working with deployments + +With our server in place, the code being reviewed, and our pull request +merged, we want our project to be deployed. + +We'll start by modifying our event listener to process pull requests when they're +merged, and start paying attention to deployments: + + #!ruby + when "pull_request" + if @payload["action"] == "closed" && @payload["pull_request"]["merged"] + start_deployment(@payload["pull_request"]) + end + when "deployment" + process_deployment(@payload) + when "deployment_status" + update_deployment_status + end + +Based on the information from the pull request, we'll start by filling out the +`start_deployment` method: + + #!ruby + def start_deployment(pull_request) + user = pull_request['user']['login'] + payload = JSON.generate(:environment => 'production', :deploy_user => user) + @client.create_deployment(pull_request['head']['repo']['full_name'], pull_request['head']['sha'], {:payload => payload, :description => "Deploying my sweet branch"}) + end + +Deployments can have some metadata attached to them, in the form of a `payload` +and a `description`. Although these values are optional, it's helpful to use +for logging and representing information. + +When a new deployment is created, a completely separate event is trigged. That's +why we have a new `switch` case in the event handler for `deployment`. You can +use this information to be notified when a deployment has been triggered. + +Deployments can take a rather long time, so we'll want to listen for various events, +such as when the deployment was created, and what state it's in. + +Let's simulate a deployment that does some work, and notice the effect it has on +the output. First, let's complete our `process_deployment` method: + + #!ruby + def process_deployment + payload = JSON.parse(@payload['payload']) + # you can send this information to your chat room, monitor, pager, e.t.c. + puts "Processing '#{@payload['description']}' for #{payload['deploy_user']} to #{payload['environment']}" + sleep 2 # simulate work + @client.create_deployment_status("repos/#{@payload['repository']['full_name']}/deployments/#{@payload['id']}", 'pending') + sleep 2 # simulate work + @client.create_deployment_status("repos/#{@payload['repository']['full_name']}/deployments/#{@payload['id']}", 'success') + end + +Finally, we'll simulate storing the status information as console output: + + #!ruby + def update_deployment_status + puts "Deployment status for #{@payload['id']} is #{@payload['state']}" + end + +Let's break down what's going on. A new deployment is created by `start_deployment`, +which triggers the `deployment` event. From there, we call `process_deployment` +to simulate work that's going on. During that processing, we also make a call to +`create_deployment_status`, which lets a receiver know what's going on, as we +switch the status to `pending`. + +After the deployment is finished, we set the status to `success`. You'll notice +that this pattern is the exact same as when we you your CI statuses. + +## Conclusion + +At GitHub, we've used a version of [Heaven][heaven] to manage +our deployments for years. The basic flow is essentially the exact same as the +server we've built above. At GitHub, we: + +* Wait for a response on the state of the CI +* If the code is green, we merge the pull request +* Heaven takes the merged code, and deploys it to our production and staging servers +* In the meantime, Heaven also notifies everyone about the build, via [Hubot][hubot] sitting in our chat rooms + +That's it! You don't need to build your own deployment setup to use this example. +You can always rely on [third-party services][integrations]. + +[deploy API]: /v3/repos/deployments/ +[status API]: /guides/building-a-ci-server +[ngrok]: https://ngrok.com/ +[using ngrok]: /webhooks/configuring/#using-ngrok +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/delivering-deployments +[Sinatra]: http://www.sinatrarb.com/ +[webhook]: /webhooks/ +[octokit.rb]: https://github.com/octokit/octokit.rb +[access token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use +[travis api]: https://api.travis-ci.org/docs/ +[janky]: https://github.com/github/janky +[heaven]: https://github.com/atmos/heaven +[hubot]: https://github.com/github/hubot +[integrations]: https://github.com/integrations diff --git a/content/guides/discovering-resources-for-a-user.md b/content/guides/discovering-resources-for-a-user.md new file mode 100644 index 0000000000..a4fe3fda22 --- /dev/null +++ b/content/guides/discovering-resources-for-a-user.md @@ -0,0 +1,107 @@ +--- +title: Discovering resources for a user | GitHub API +--- + +# Discovering resources for a user + +* TOC +{:toc} + +When making authenticated requests to the GitHub API, applications often need to fetch the current user's repositories and organizations. In this guide, will explain how to reliably discover those resources. + +To interact with the GitHub API, we'll be using [Octokit.rb][octokit.rb]. You can find the complete source code for this project in the [platform-samples][platform samples] repository. + +## Getting started + +If you haven't already, you should read the ["Basics of Authentication"][basics-of-authentication] guide before working through the examples below. The examples below assume that you have [registered an OAuth application][register-oauth-app] and that your [application has an OAuth token for a user][make-authenticated-request-for-user]. + +## Discover the repositories that your app can access for a user + +In addition to having their own personal repositories, a user may be a collaborator on repositories owned by other users and organizations. Collectively, these are the repositories where the user has privileged access: either it's a private repository where the user has read or write access, or it's a public repository where the user has write access. + +[OAuth scopes][scopes] and [organization application policies][oap] determine which of those repositories your app can access for a user. Use the workflow below to discover those repositories. + +As always, first we'll require [GitHub's Octokit.rb][octokit.rb] Ruby library. Then we'll configure Octokit.rb to automatically handle [pagination][pagination] for us. + + #!ruby + require 'octokit' + + Octokit.auto_paginate = true + +Next, we want to opt in to the [upcoming improvements to the repository listing API][list-repositories-for-current-user]. To do so, we'll set the media type that gives us access to that functionality. + + #!ruby + Octokit.default_media_type = "application/vnd.github.moondragon+json" + +Now, we'll pass in our application's [OAuth token for a given user][make-authenticated-request-for-user]: + + #!ruby + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below. + client = Octokit::Client.new :access_token => ENV["OAUTH_ACCESS_TOKEN"] + +Then, we're ready to fetch the [repositories that our application can access for the user][list-repositories-for-current-user]: + + #!ruby + client.repositories.each do |repository| + full_name = repository[:full_name] + has_push_access = repository[:permissions][:push] + + access_type = if has_push_access + "write" + else + "read-only" + end + + puts "User has #{access_type} access to #{full_name}." + end + +## Discover the organizations that your app can access for a user + +Applications can perform all sorts of organization-related tasks for a user. To perform these tasks, the app needs an [OAuth authorization][scopes] with sufficient permission. For example, the `read:org` scope allows you to [list teams][list-teams], and the `user` scope lets you [publicize the user’s organization membership][publicize-membership]. Once a user has granted one or more of these scopes to your app, you're ready to fetch the user’s organizations. + +Just as we did when discovering repositories above, we'll start by requiring [GitHub's Octokit.rb][octokit.rb] Ruby library and configuring it to take care of [pagination][pagination] for us: + + #!ruby + require 'octokit' + + Octokit.auto_paginate = true + +Next, we'll opt in to the [upcoming enhancements to the organization listing API][list-orgs-for-current-user]. To do so, we'll set the media type that gives us access to that functionality. + + #!ruby + Octokit.default_media_type = "application/vnd.github.moondragon+json" + +Now, we'll pass in our application's [OAuth token for a given user][make-authenticated-request-for-user] to initialize our API client: + + #!ruby + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below. + client = Octokit::Client.new :access_token => ENV["OAUTH_ACCESS_TOKEN"] + +Then, we can [list the organizations that our application can access for the user][list-orgs-for-current-user]: + + #!ruby + client.organizations.each do |organization| + puts "User belongs to the #{organization[:login]} organization." + end + +### Don’t rely on public organizations + +If you've read the docs from cover to cover, you may have noticed an [API method for listing a user's public organization memberships][list-public-orgs]. Most applications should avoid this API method. This method only returns the user's public organization memberships, not their private organization memberships. + +As an application, you typically want all of the user's organizations (public and private) that your app is authorized to access. The workflow above will give you exactly that. + +[basics-of-authentication]: /guides/basics-of-authentication/ +[list-public-orgs]: /v3/orgs/#list-user-organizations +[list-repositories-for-current-user]: /v3/repos/#list-your-repositories +[list-orgs-for-current-user]: /v3/orgs/#list-your-organizations +[list-teams]: /v3/orgs/teams/#list-teams +[make-authenticated-request-for-user]: /guides/basics-of-authentication/#making-authenticated-requests +[oap]: /changes/2015-01-19-an-integrators-guide-to-organization-application-policies/ +[octokit.rb]: https://github.com/octokit/octokit.rb +[pagination]: /v3/#pagination +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/discovering-resources-for-a-user +[publicize-membership]: /v3/orgs/members/#publicize-a-users-membership +[register-oauth-app]: /guides/basics-of-authentication/#registering-your-app +[scopes]: /v3/oauth/#scopes diff --git a/content/guides/getting-started.md b/content/guides/getting-started.md new file mode 100644 index 0000000000..859c04d123 --- /dev/null +++ b/content/guides/getting-started.md @@ -0,0 +1,556 @@ +--- +title: Getting Started | GitHub API +--- + +# Getting Started + +* TOC +{:toc} + +Let's walk through core API concepts as we tackle some everyday use cases. + +## Overview + +Most applications will use an existing [wrapper library][wrappers] in the language +of your choice, but it's important to familiarize yourself with the underlying API +HTTP methods first. + +There's no easier way to kick the tires than through [cURL][curl]. + +### Hello World + +Let's start by testing our setup. Open up a command prompt and enter the +following command (without the `$`): + +
+$ curl https://api.github.com/zen
+
+Keep it logically awesome.
+
+ +The response will be a random selection from our design philosophies. + +Next, let's `GET` [Chris Wanstrath's][defunkt github] [GitHub profile][users api]: + +
+# GET /users/defunkt
+$ curl https://api.github.com/users/defunkt
+
+{
+  "login": "defunkt",
+  "id": 2,
+  "url": "https://api.github.com/users/defunkt",
+  "html_url": "https://github.com/defunkt",
+  ...
+}
+
+ +Mmmmm, tastes like [JSON][json]. Let's add the `-i` flag to include headers: + +
+$ curl -i https://api.github.com/users/defunkt
+
+HTTP/1.1 200 OK
+Server: GitHub.com
+Date: Sun, 11 Nov 2012 18:43:28 GMT
+Content-Type: application/json; charset=utf-8
+Connection: keep-alive
+Status: 200 OK
+ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 57
+X-RateLimit-Reset: 1352660008
+X-GitHub-Media-Type: github.v3
+Vary: Accept
+Cache-Control: public, max-age=60, s-maxage=60
+X-Content-Type-Options: nosniff
+Content-Length: 692
+Last-Modified: Tue, 30 Oct 2012 18:58:42 GMT
+
+{
+  "login": "defunkt",
+  "id": 2,
+  "url": "https://api.github.com/users/defunkt",
+  "html_url": "https://github.com/defunkt",
+  ...
+}
+
+ +There are a few interesting bits in the response headers. As expected, the +`Content-Type` is `application/json`. + +Any headers beginning with `X-` are custom headers, and are not included in the +HTTP spec. Let's take a look at a few of them: + +* `X-GitHub-Media-Type` has a value of `github.v3`. This lets us know the [media type][media types] +for the response. Media types have helped us version our output in API v3. We'll +talk more about that later. +* Take note of the `X-RateLimit-Limit` and `X-RateLimit-Remaining` headers. This +pair of headers indicate [how many requests a client can make][rate limiting] in +a rolling time period (typically an hour) and how many of those requests the +client has already spent. + +## Authentication + +Unauthenticated clients can make 60 requests per hour. To get more, we'll need to +_authenticate_. In fact, doing anything interesting with the GitHub API requires +[authentication][authentication]. + +### Basic + +The easiest way to authenticate with the GitHub API is by simply using your GitHub +username and password via Basic Authentication. + +
+$ curl -i -u <your_username> https://api.github.com/users/defunkt
+
+Enter host password for user '<your_username>':
+
+ +The `-u` flag sets the username, and cURL will prompt you for the password. You +can use `-u "username:password"` to avoid the prompt, but this leaves your +password in shell history and isn't recommended. When authenticating, you +should see your rate limit bumped to 5,000 requests an hour, as indicated in the +`X-RateLimit-Limit` header. + +In addition to just getting more calls per hour, authentication is the key to +reading and writing private information via the API. + +### Two-factor authentication + +If you have [two-factor authentication][2fa] enabled, the API will return a +`401 Unauthorized` error code for the above request (and every other API request): + +
+$ curl -i -u <your_username> https://api.github.com/users/defunkt
+
+Enter host password for user '<your_username>':
+
+HTTP/1.1 401 Unauthorized
+X-GitHub-OTP: required; :2fa-type
+
+{
+  "message": "Must specify two-factor authentication OTP code.",
+  "documentation_url": "https://developer.github.com/v3/auth#working-with-two-factor-authentication"
+}
+
+ +The easiest way to get around that error is to create an OAuth token and use +OAuth authentication instead of Basic Authentication. See the +[OAuth section][oauth section] below for more information. + +### Get your own user profile + +When properly authenticated, you can take advantage of the permissions +associated with your GitHub account. For example, try getting +[your own user profile][auth user api]: + +
+$ curl -i -u <your_username> https://api.github.com/user
+
+{
+  ...
+  "plan": {
+    "space": 2516582,
+    "collaborators": 10,
+    "private_repos": 20,
+    "name": "medium"
+  }
+  ...
+}
+
+ +This time, in addition to the same set of public information we +retrieved for [@defunkt][defunkt github] earlier, you should also see the non-public +information for your user profile. For example, you'll see a `plan` object +in the response which gives details about the GitHub plan for the account. + +### OAuth + +While convenient, Basic Authentication isn't ideal because you shouldn't give your GitHub +username and password to anyone. Applications that need to read or write +private information using the API on behalf of another user should use [OAuth][oauth]. + +Instead of usernames and passwords, OAuth uses _tokens_. Tokens provide two big +features: + +* **Revokable access**: users can revoke authorization to third party apps at any time +* **Limited access**: users can review the specific access that a token + will provide before authorizing a third party app + +Normally, tokens are created via a [web flow][webflow]. An application +sends users to GitHub to log in. GitHub then presents a dialog +indicating the name of the app, as well as the level of access the app +has once it's authorized by the user. After a user authorizes access, GitHub +redirects the user back to the application: + +![GitHub's OAuth Prompt](/images/oauth_prompt.png) + +However, you don't need to set up the entire web flow to begin working with OAuth tokens. +An easier way to get a token is to [create a **personal access token**][personal token] via your +[Application settings page][application settings]: + +![Personal Token selection](/images/personal_token.png) + +Also, the [**Authorizations API**][authorizations api] makes it simple to use Basic Authentication +to create an OAuth token. Try pasting and running the following command: + +
+$ curl -i -u <your_username> -d '{"scopes": ["repo", "user"], "note": "getting-started"}' \
+    https://api.github.com/authorizations
+
+HTTP/1.1 201 Created
+Location: https://api.github.com/authorizations/2
+Content-Length: 384
+
+{
+  "scopes": [
+    "repo",
+    "user"
+  ],
+  "token": "5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4",
+  "updated_at": "2012-11-14T14:04:24Z",
+  "url": "https://api.github.com/authorizations/2",
+  "app": {
+    "url": "https://developer.github.com/v3/oauth/#oauth-authorizations-api",
+    "name": "GitHub API"
+  },
+  "created_at": "2012-11-14T14:04:24Z",
+  "note_url": null,
+  "id": 2,
+  "note": "getting-started"
+}
+
+ +There's a lot going on in this one little call, so let's break it down. First, +the `-d` flag indicates we're doing a `POST`, using the +`application/x-www-form-urlencoded` content type (as opposed to `GET`). All `POST` +requests to the GitHub API should be in JSON. + +Next, let's look at the `scopes` we're sending over in this call. When creating +a new token, we include an optional array of [_scopes_][scopes], or access +levels, that indicate what information this token can access. In this case, +we're setting up the token with _repo_ access, which grants access to read and +write to public and private repositories, and _user_ scope, which grants read +and write access to public and private user profile data. See +[the scopes docs][scopes] for a full list of +scopes. You should **only** request scopes that your application actually needs, +in order to not frighten users with potentially invasive actions. The `201` +status code tells us that the call was successful, and the JSON returned +contains the details of our new OAuth token. + +If you have [two-factor authentication][2fa] enabled, the API will +return the [previously described `401 Unauthorized` error code][2fa section] +for the above request. You can get around that error by providing a 2FA OTP code +in the [X-GitHub-OTP request header][2fa header]: + +
+$ curl -i -u <your_username> -H "X-GitHub-OTP: <your_2fa_OTP_code>" \
+    -d '{"scopes": ["repo", "user"], "note": "getting-started"}' \
+    https://api.github.com/authorizations
+
+ +If you enabled 2FA with a mobile application, go ahead and get an OTP code from +your one-time password application on your phone. If you enabled 2FA with text +messages, you'll receive an SMS with your OTP code after making a request to +this endpoint. + +Now, we can use the forty character `token` instead of a username and password +in the rest of our examples. Let's grab our own user info again, using OAuth this time: + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    https://api.github.com/user
+
+ +**Treat OAuth tokens like passwords!** Don't share them with other users or store +them in insecure places. The tokens in these examples are fake and the names have +been changed to protect the innocent. + +Now that we've got the hang of making authenticated calls, let's move along to +the [Repositories API][repos-api]. + +## Repositories + +Almost any meaningful use of the GitHub API will involve some level of Repository +information. We can [`GET` repository details][get repo] in the same way we fetched user +details earlier: + +
+$ curl -i https://api.github.com/repos/twbs/bootstrap
+
+ +In the same way, we can [view repositories for the authenticated user][user repos api]: + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    https://api.github.com/user/repos
+
+ +Or, we can [list repositories for another user][other user repos api]: + +
+$ curl -i https://api.github.com/users/technoweenie/repos
+
+ +Or, we can [list repositories for an organization][org repos api]: + +
+$ curl -i https://api.github.com/orgs/mozilla/repos
+
+ +The information returned from these calls will depend on how we authenticate: + +* Using Basic Authentication, the response includes all repositories the + the user has access to see on github.com. +* Using OAuth, private repositories are only returned if the OAuth token + contains the `repo` [scope][scopes]. + +As the [docs][repos-api] indicate, these methods take a `type` parameter that +can filter the repositories returned based on what type of access the user has +for the repository. In this way, we can fetch only directly-owned repositories, +organization repositories, or repositories the user collaborates on via a team. + +
+$ curl -i "https://api.github.com/users/technoweenie/repos?type=owner"
+
+ +In this example, we grab only those repositories that technoweenie owns, not the +ones on which he collaborates. Note the quoted URL above. Depending on your +shell setup, cURL sometimes requires a quoted URL or else it ignores the +query string. + +### Create a repository + +Fetching information for existing repositories is a common use case, but the +GitHub API supports creating new repositories as well. To [create a repository][create repo], +we need to `POST` some JSON containing the details and configuration options. + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    -d '{ \
+        "name": "blog", \
+        "auto_init": true, \
+        "private": true, \
+        "gitignore_template": "nanoc" \
+      }' \
+    https://api.github.com/user/repos
+
+ +In this minimal example, we create a new repository for our blog (to be served +on [GitHub Pages][pages], perhaps). Though the blog will be public, we've made +the repository private. In this single step, we'll also initialize it with +a README and a [nanoc][nanoc]-flavored [.gitignore template][gitignore +templates]. + +The resulting repository will be found at `https://github.com//blog`. +To create a repository under an organization for which you're +an owner, just change the API method from `/user/repos` to `/orgs//repos`. + +Next, let's fetch our newly created repository: + +
+$ curl -i https://api.github.com/repos/pengwynn/blog
+
+HTTP/1.1 404 Not Found
+
+{
+    "message": "Not Found"
+}
+
+ +Oh noes! Where did it go? Since we created the repository as _private_, we need +to authenticate in order to see it. If you're a grizzled HTTP user, you might +expect a `403` instead. Since we don't want to leak information about private +repositories, the GitHub API returns a `404` in this case, as if to say "we can +neither confirm nor deny the existence of this repository." + +## Issues + +The UI for Issues on GitHub aims to provide 'just enough' workflow while +staying out of your way. With the GitHub [Issues API][issues-api], you can pull +data out or create issues from other tools to create a workflow that works for +your team. + +Just like github.com, the API provides a few methods to view issues for the +authenticated user. To [see all your issues][get issues api], call `GET /issues`: + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    https://api.github.com/issues
+
+ +To get only the [issues under one of your GitHub organizations][get issues api], call `GET +/orgs//issues`: + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    https://api.github.com/orgs/rails/issues
+
+ +We can also get [all the issues under a single repository][repo issues api]: + +
+$ curl -i https://api.github.com/repos/rails/rails/issues
+
+ +### Pagination + +A project the size of Rails has thousands of issues. We'll need to [paginate][pagination], +making multiple API calls to get the data. Let's repeat that last call, this +time taking note of the response headers: + +
+$ curl -i https://api.github.com/repos/rails/rails/issues
+
+HTTP/1.1 200 OK
+
+Link: <https://api.github.com/repos/rails/rails/issues?page=2>; rel="next",
+<https://api.github.com/repos/rails/rails/issues?page=14>; rel="last"
+
+ +The [`Link` header][link-header] provides a way for a response to link to +external resources, in this case additional pages of data. Since our call found +more than thirty issues (the default page size), the API tells us where we can +find the next page and the last page of results. + +### Creating an issue + +Now that we've seen how to paginate lists of issues, let's [create an issue][create issue] from +the API. + +To create an issue, we need to be authenticated, so we'll pass an +OAuth token in the header. Also, we'll pass the title, body, and labels in the JSON +body to the `/issues` path underneath the repository in which we want to create +the issue: + +
+$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
+    -d '{ \
+         "title": "New logo", \
+         "body": "We should have one", \
+         "labels": ["design"] \
+       }' \
+    https://api.github.com/repos/pengwynn/api-sandbox/issues
+
+HTTP/1.1 201 Created
+Location: https://api.github.com/repos/pengwynn/api-sandbox/issues/17
+X-RateLimit-Limit: 5000
+
+{
+  "pull_request": {
+    "patch_url": null,
+    "html_url": null,
+    "diff_url": null
+  },
+  "created_at": "2012-11-14T15:25:33Z",
+  "comments": 0,
+  "milestone": null,
+  "title": "New logo",
+  "body": "We should have one",
+  "user": {
+    "login": "pengwynn",
+    "gravatar_id": "7e19cd5486b5d6dc1ef90e671ba52ae0",
+    "avatar_url": "https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
+    "id": 865,
+    "url": "https://api.github.com/users/pengwynn"
+  },
+  "closed_at": null,
+  "updated_at": "2012-11-14T15:25:33Z",
+  "number": 17,
+  "closed_by": null,
+  "html_url": "https://github.com/pengwynn/api-sandbox/issues/17",
+  "labels": [
+    {
+      "color": "ededed",
+      "name": "design",
+      "url": "https://api.github.com/repos/pengwynn/api-sandbox/labels/design"
+    }
+  ],
+  "id": 8356941,
+  "assignee": null,
+  "state": "open",
+  "url": "https://api.github.com/repos/pengwynn/api-sandbox/issues/17"
+}
+
+ +The response gives us a couple of pointers to the newly created issue, both in +the `Location` response header and the `url` field of the JSON response. + +## Conditional requests + +A big part of being a good API citizen is respecting rate limits by +caching information that hasn't changed. The API supports [conditional +requests][conditional-requests] and helps you do the right thing. Consider the +first call we made to get defunkt's profile: + +
+$ curl -i https://api.github.com/users/defunkt
+
+HTTP/1.1 200 OK
+ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
+
+ +In addition to the JSON body, take note of the HTTP status code of `200` and +the `ETag` header. +The [ETag][etag] is a fingerprint of the response. If we pass that on subsequent calls, +we can tell the API to give us the resource again, only if it has changed: + +
+$ curl -i -H 'If-None-Match: "bfd85cbf23ac0b0c8a29bee02e7117c6"' \
+    https://api.github.com/users/defunkt
+
+HTTP/1.1 304 Not Modified
+
+ +The `304` status indicates that the resource hasn't changed since the last time +we asked for it and the response will contain no body. As a bonus, `304` +responses don't count against your [rate limit][rate-limiting]. + +Woot! Now you know the basics of the GitHub API! + +* Basic & OAuth authentication +* Fetching and creating repositories and issues +* Conditional requests + +Keep learning with the next API guide [Basics of Authentication][auth guide]! + + +[wrappers]: /libraries/ +[curl]: http://curl.haxx.se/ +[media types]: /v3/media/ +[oauth]: /v3/oauth/ +[webflow]: /v3/oauth/#web-application-flow +[authorizations api]: /v3/oauth_authorizations/#create-a-new-authorization +[scopes]: /v3/oauth/#scopes +[repos-api]: /v3/repos/ +[pages]: http://pages.github.com +[nanoc]: http://nanoc.ws/ +[gitignore templates]: https://github.com/github/gitignore +[issues-api]: /v3/issues/ +[link-header]: http://www.w3.org/wiki/LinkHeader +[conditional-requests]: /v3/#conditional-requests +[rate-limiting]: /v3/#rate-limiting +[users api]: /v3/users/#get-a-single-user +[auth user api]: /v3/users/#get-the-authenticated-user +[defunkt github]: https://github.com/defunkt +[json]: http://en.wikipedia.org/wiki/JSON +[rate limiting]: /v3/#rate-limiting +[authentication]: /v3/#authentication +[2fa]: https://help.github.com/articles/about-two-factor-authentication +[2fa header]: /v3/auth/#working-with-two-factor-authentication +[oauth section]: /guides/getting-started/#oauth +[personal token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use +[application settings]: https://github.com/settings/applications +[pagination]: /v3/#pagination +[get repo]: /v3/repos/#get +[create repo]: /v3/repos/#create +[create issue]: /v3/issues/#create-an-issue +[auth guide]: /guides/basics-of-authentication +[user repos api]: /v3/repos/#list-your-repositories +[other user repos api]: /v3/repos/#list-user-repositories +[org repos api]: /v3/repos/#list-organization-repositories +[get issues api]: /v3/issues/#list-issues +[repo issues api]: /v3/issues/#list-issues-for-a-repository +[etag]: http://en.wikipedia.org/wiki/HTTP_ETag +[2fa section]: /guides/getting-started/#two-factor-authentication diff --git a/content/guides/index.md b/content/guides/index.md new file mode 100644 index 0000000000..6c3b0be0ed --- /dev/null +++ b/content/guides/index.md @@ -0,0 +1,18 @@ +--- +title: Development Guides | GitHub API +layout: guides +--- + +# Development Guides + +This section of the documentation is intended to get you up-and-running with +real-world GitHub API applications. We'll cover everything you need to know, from +authentication, to manipulating results, to combining results with other services. + +Every tutorial here will have a project, and every project will be +stored and documented in our public +[platform-samples](https://github.com/github/platform-samples) repository. + +Feel free to fork, clone, and improve these guides. + +![The Professorcat](/images/electrocat.png) diff --git a/content/guides/managing-deploy-keys.md b/content/guides/managing-deploy-keys.md new file mode 100644 index 0000000000..318144205f --- /dev/null +++ b/content/guides/managing-deploy-keys.md @@ -0,0 +1,120 @@ +--- +title: Managing deploy keys | GitHub API +--- + +# Managing Deploy Keys + +* TOC +{:toc} + +There are four ways to manage SSH keys on your servers when automating deployment scripts: + +* SSH agent forwarding +* HTTPS with OAuth tokens +* Deploy keys +* Machine users + +This guide will help you decide what strategy is best for you. + +## SSH agent forwarding + +In many cases, especially in the beginning of a project, SSH agent forwarding is the quickest and simplest method to use. Agent forwarding uses the same SSH keys that your local development computer uses. + +#### Pros + +* You do not have to generate or keep track of any new keys. +* There is no key management; users have the same permissions on the server that they do locally. +* No keys are stored on the server, so in case the server is compromised, you don't need to hunt down and remove the compromised keys. + +#### Cons + +* Users **must** SSH in to deploy; automated deploy processes can't be used. +* SSH agent forwarding can be troublesome to run for Windows users. + +#### Setup + +1. Turn on agent forwarding locally. See [our guide on SSH agent forwarding][ssh-agent-forwarding] for more information. +2. Set your deploy scripts to use agent forwarding. For example, on a bash script, enabling agent forwarding would look something like this: `ssh -A serverA 'bash -s' < deploy.sh` + +## HTTPS cloning with OAuth tokens + +If you don't want to use SSH keys, you can use [HTTPS with OAuth tokens][git-automation]. + +#### Pros + +* Anyone with access to the server can deploy the repository. +* Users don't have to change their local SSH settings. +* Multiple tokens (one for each user) are not needed; one token per server is enough. +* A token can be revoked at any time, turning it essentially into a one-use password. +* Generating new tokens can be easily scripted using [the OAuth API](https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization) + +#### Cons + +* You must make sure that you configure your token with the correct access scopes. +* Tokens are essentially passwords, and must be protected the same way. + +#### Setup + +See [our guide on Git automation with tokens][git-automation]. + +## Deploy keys + +A deploy key is an SSH key that is stored on your server and grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account. + +#### Pros + +* Anyone with access to the repository and server has the ability to deploy the project. +* Users don't have to change their local SSH settings. + +#### Cons + +* Deploy keys only grant access to a single repository. More complex projects may have many repositories to pull to the same server. +* Deploy keys always provide full read/write access to a repository. +* Deploy keys are usually not protected by a passphrase, making the key easily accessible if the server is compromised. + +#### Setup + +1. [Run the `ssh-keygen` procedure][generating-ssh-keys] on your server. +2. In the top right corner of any GitHub page, click your profile photo. + ![Sample of an avatar](https://github-images.s3.amazonaws.com/help/profile/top_right_avatar.png) +3. On your profile page, click the **Repositories** tab, then click the name of your repository. + ![Repository tab](https://github-images.s3.amazonaws.com/help/profile/profile_repositories_tab.png) +4. In your repository's right sidebar, click **Settings**. + ![Settings tab](https://github-images.s3.amazonaws.com/help/repository/repo-actions-settings.png) +3. In the sidebar, click **Deploy Keys**. + ![Deploy Keys section](/images/deploy-keys.png) +3. Click **Add deploy key**. Paste your public key in and submit. + ![Add Deploy Key button](https://github-images.s3.amazonaws.com/help/repository/repo-deploy-key.png) + +## Machine users + +If your server needs to access multiple repositories, you can choose to create a new GitHub account and attach an SSH key that will be used exclusively for automation. Since this GitHub account won't be used by a human, it's called a machine user. You can then [add the machine user as collaborator][collaborator] or [add the machine user to a team][team] with access to the repositories it needs to manipulate. **NOTE**: Adding a machine user as a collaborator always grants read/write access. Adding a machine user to a team grants the permissions of the team. + +
+

+Tip: Our terms of service do mention that 'Accounts registered by "bots" or other automated methods are not permitted.' and that 'One person or legal entity may not maintain more than one free account.' But don't fear, we won't send rabid lawyers out to hunt you down if you create machine users for your server deploy scripts. Machine users are completely kosher. +

+
+ +#### Pros + +* Anyone with access to the repository and server has the ability to deploy the project. +* No (human) users need to change their local SSH settings. +* Multiple keys are not needed; one per server is adequate. + +#### Cons + +* Only organizations have access to create teams; therefore only organizations can use them to restrict machine users to read-only access. Personal repositories always grant collaborators read/write access. +* Machine user keys, like deploy keys, are usually not protected by a passphrase. + +#### Setup + +1. [Run the `ssh-keygen` procedure][generating-ssh-keys] on your server and attach the public key to the machine user account. +2. Give that account access to the repositories it will need to access. You can do this by [adding the account as collaborator][collaborator] or [adding it to a team][team] in an organization. + +[ssh-agent-forwarding]: /guides/using-ssh-agent-forwarding/ +[generating-ssh-keys]: https://help.github.com/articles/generating-ssh-keys +[tos]: https://help.github.com/articles/github-terms-of-service +[git-automation]: https://help.github.com/articles/git-automation-with-oauth-tokens +[collaborator]: https://help.github.com/articles/how-do-i-add-a-collaborator +[team]: https://help.github.com/articles/adding-organization-members-to-a-team diff --git a/content/guides/rendering-data-as-graphs.md b/content/guides/rendering-data-as-graphs.md new file mode 100644 index 0000000000..2ea993b55d --- /dev/null +++ b/content/guides/rendering-data-as-graphs.md @@ -0,0 +1,359 @@ +--- +title: Rendering Data as Graphs | GitHub API +--- + +# Rendering Data as Graphs + +* TOC +{:toc} + +In this guide, we're going to use the API to fetch information about repositories +that we own, and the programming languages that make them up. Then, we'll +visualize that information in a couple of different ways using the [D3.js][D3.js] library. To +interact with the GitHub API, we'll be using the excellent Ruby library, [Octokit][Octokit]. + +If you haven't already, you should read the ["Basics of Authentication"][basics-of-authentication] +guide before starting this example. You can find the complete source code for this project in the [platform-samples][platform samples] repository. + +Let's jump right in! + +## Setting up an OAuth application + +First, [register a new application][new oauth application] on GitHub. Set the main and callback +URLs to `http://localhost:4567/`. As [before][basics-of-authentication], we're going to handle authentication for the API by +implementing a Rack middleware using [sinatra-auth-github][sinatra auth github]: + + #!ruby + require 'sinatra/auth/github' + + module Example + class MyGraphApp < Sinatra::Base + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + # if ENV['GITHUB_CLIENT_ID'] && ENV['GITHUB_CLIENT_SECRET'] + # CLIENT_ID = ENV['GITHUB_CLIENT_ID'] + # CLIENT_SECRET = ENV['GITHUB_CLIENT_SECRET'] + # end + + CLIENT_ID = ENV['GH_GRAPH_CLIENT_ID'] + CLIENT_SECRET = ENV['GH_GRAPH_SECRET_ID'] + + enable :sessions + + set :github_options, { + :scopes => "repo", + :secret => CLIENT_SECRET, + :client_id => CLIENT_ID, + :callback_url => "/" + } + + register Sinatra::Auth::Github + + get '/' do + if !authenticated? + authenticate! + else + access_token = github_user["token"] + end + end + end + end + +Set up a similar _config.ru_ file as in the previous example: + + #!ruby + ENV['RACK_ENV'] ||= 'development' + require "rubygems" + require "bundler/setup" + + require File.expand_path(File.join(File.dirname(__FILE__), 'server')) + + run Example::MyGraphApp + +## Fetching repository information + +This time, in order to talk to the GitHub API, we're going to use the [Octokit +Ruby library][Octokit]. This is much easier than directly making a bunch of +REST calls. Plus, Octokit was developed by a GitHubber, and is actively maintained, +so you know it'll work. + +Authentication with the API via Octokit is easy. Just pass your login +and token to the `Octokit::Client` constructor: + + #!ruby + if !authenticated? + authenticate! + else + octokit_client = Octokit::Client.new(:login => github_user.login, :oauth_token => github_user.token) + end + +Let's do something interesting with the data about our repositories. We're going +to see the different programming languages they use, and count which ones are used +most often. To do that, we'll first need a list of our repositories from the API. +With Octokit, that looks like this: + + #!ruby + repos = client.repositories + +Next, we'll iterate over each repository, and count the language that GitHub +associates with it: + + #!ruby + language_obj = {} + repos.each do |repo| + # sometimes language can be nil + if repo.language + if !language_obj[repo.language] + language_obj[repo.language] = 1 + else + language_obj[repo.language] += 1 + end + end + end + + languages.to_s + +When you restart your server, your web page should display something +that looks like this: + + {"JavaScript"=>13, "PHP"=>1, "Perl"=>1, "CoffeeScript"=>2, "Python"=>1, "Java"=>3, "Ruby"=>3, "Go"=>1, "C++"=>1} + +So far, so good, but not very human-friendly. A visualization +would be great in helping us understand how these language counts are distributed. Let's feed +our counts into D3 to get a neat bar graph representing the popularity of the languages we use. + +## Visualizing language counts + +D3.js, or just D3, is a comprehensive library for creating many kinds of charts, graphs, and interactive visualizations. +Using D3 in detail is beyond the scope of this guide, but for a good introductory article, +check out ["D3 for Mortals"][D3 mortals]. + +D3 is a JavaScript library, and likes working with data as arrays. So, let's convert our Ruby hash into +a JSON array for use by JavaScript in the browser. + + #!ruby + languages = [] + language_obj.each do |lang, count| + languages.push :language => lang, :count => count + end + + erb :lang_freq, :locals => { :languages => languages.to_json} + +We're simply iterating over each key-value pair in our object and pushing them into +a new array. The reason we didn't do this earlier is because we didn't want to iterate +over our `language_obj` object while we were creating it. + +Now, _lang_freq.erb_ is going to need some JavaScript to support rendering a bar graph. +For now, you can just use the code provided here, and refer to the resources linked above +if you want to learn more about how D3 works: + + #!html + + + + + + + + +

Check this sweet data out:

+
+ + + + + +Phew! Again, don't worry about what most of this code is doing. The relevant part +here is a line way at the top--`var data = <%= languages %>;`--which indicates +that we're passing our previously created `languages` array into ERB for manipulation. + +As the "D3 for Mortals" guide suggests, this isn't necessarily the best use of +D3. But it does serve to illustrate how you can use the library, along with Octokit, +to make some really amazing things. + +## Combining different API calls + +Now it's time for a confession: the `language` attribute within repositories +only identifies the "primary" language defined. That means that if you have +a repository that combines several languages, the one with the most bytes of code +is considered to be the primary language. + +Let's combine a few API calls to get a _true_ representation of which language +has the greatest number of bytes written across all our code. A [treemap][D3 treemap] +should be a great way to visualize the sizes of our coding languages used, rather +than simply the count. We'll need to construct an array of objects that looks +something like this: + + #!javascript + [ { "name": "language1", "size": 100}, + { "name": "language2", "size": 23} + ... + ] + +Since we already have a list of repositories above, let's inspect each one, and +call [the language listing API method][language API]: + + #!ruby + repos.each do |repo| + repo_name = repo.name + repo_langs = octokit_client.languages("#{github_user.login}/#{repo_name}") + end + +From there, we'll cumulatively add each language found to a "master list": + + #!ruby + repo_langs.each do |lang, count| + if !language_obj[lang] + language_obj[lang] = count + else + language_obj[lang] += count + end + end + +After that, we'll format the contents into a structure that D3 understands: + + #!ruby + language_obj.each do |lang, count| + language_byte_count.push :name => "#{lang} (#{count})", :count => count + end + + # some mandatory formatting for D3 + language_bytes = [ :name => "language_bytes", :elements => language_byte_count] + +(For more information on D3 tree map magic, check out [this simple tutorial][language API].) + +To wrap up, we pass this JSON information over to the same ERB template: + + #!ruby + erb :lang_freq, :locals => { :languages => languages.to_json, :language_byte_count => language_bytes.to_json} + + +Like before, here's a bunch of JavaScript that you can drop +directly into your template: + + #!html +
+ + +Et voila! Beautiful rectangles containing your repo languages, with relative +proportions that are easy to see at a glance. You might need to +tweak the height and width of your treemap, passed as the first two +arguments to `drawTreemap` above, to get all the information to show up properly. + + +[D3.js]: http://d3js.org/ +[basics-of-authentication]: ../basics-of-authentication/ +[sinatra auth github]: https://github.com/atmos/sinatra_auth_github +[Octokit]: https://github.com/octokit/octokit.rb +[D3 mortals]: http://www.recursion.org/d3-for-mere-mortals/ +[D3 treemap]: http://bl.ocks.org/mbostock/4063582 +[language API]: https://developer.github.com/v3/repos/#list-languages +[simple tree map]: http://2kittymafiasoftware.blogspot.com/2011/09/simple-treemap-visualization-with-d3.html +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/rendering-data-as-graphs +[new oauth application]: https://github.com/settings/applications/new diff --git a/content/guides/traversing-with-pagination.md b/content/guides/traversing-with-pagination.md new file mode 100644 index 0000000000..62ab0b7d5d --- /dev/null +++ b/content/guides/traversing-with-pagination.md @@ -0,0 +1,248 @@ +--- +title: Traversing with Pagination | GitHub API +--- + +# Traversing with Pagination + +* TOC +{:toc} + +The GitHub API provides a vast wealth of information for developers to consume. +Most of the time, you might even find that you're asking for _too much_ information, +and in order to keep our servers happy, the API will automatically [paginate the requested items][pagination]. + +In this guide, we'll make some calls to the GitHub Search API, and iterate over +the results using pagination. You can find the complete source code for this project +in the [platform-samples][platform samples] repository. + +## Basics of Pagination + +To start with, it's important to know a few facts about receiving paginated items: + +1. Different API calls respond with different defaults. For example, a call to +[list GitHub's public repositories](https://developer.github.com/v3/repos/#list-all-public-repositories) +provides paginated items in sets of 30, whereas a call to the GitHub Search API +provides items in sets of 100 +2. You can specify how many items to receive (up to a maximum of 100); but, +3. For technical reasons, not every endpoint behaves the same. For example, +[events](https://developer.github.com/v3/activity/events/) won't let you set a maximum for items to receive. +Be sure to read the documentation on how to handle paginated results for specific endpoints. + +Information about pagination is provided in [the Link header](http://tools.ietf.org/html/rfc5988) +of an API call. For example, let's make a curl request to the search API, to find +out how many times Mozilla projects use the phrase `addClass`: + + curl -I "https://api.github.com/search/code?q=addClass+user:mozilla" + +The `-I` parameter indicates that we only care about the headers, not the actual +content. In examining the result, you'll notice some information in the Link header +that looks like this: + + Link: ; rel="next", + ; rel="last" + +Let's break that down. `rel="next"` says that the next page is `page=2`. This makes +sense, since by default, all paginated queries start at page `1.` `rel="last"` +provides some more information, stating that the last page of results is on page `34`. +Thus, we have 33 more pages of information about `addClass` that we can consume. +Nice! + +Keep in mind that you should **always** rely on these link relations provided +to you. Don't try to guess or construct your own URL. Some API calls, like [listing +commits on a repository][listing commits], use pagination results that are based +on SHA values, not numbers. + +### Navigating through the pages + +Now that you know how many pages there are to receive, you can start navigating +through the pages to consume the results. You do this by passing in a `page` +parameter. By default, `page` always starts at `1`. Let's jump ahead to page 14 +and see what happens: + + curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&page=14" + +Here's the link header once more: + + Link: ; rel="next", + ; rel="last", + ; rel="first", + ; rel="prev" + +As expected, `rel="next"` is at 15, and `rel="last"` is still 34. But now we've +got some more information: `rel="first"` indicates the URL for the _first_ page, +and more importantly, `rel="prev"` lets you know the page number of the previous +page. Using this information, you could construct some UI that lets users jump +between the first, previous, next, or last list of results in an API call. + +### Changing the number of items received + +By passing the `per_page` parameter, you can specify how many items you want +each page to return, up to 100 items. Let's try asking for 50 items about `addClass`: + + curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&per_page=50" + +Notice what it does to the header response: + + Link: ; rel="next", + ; rel="last" + +As you might have guessed, the `rel="last"` information says that the last page +is now 20. This is because we are asking for more information per page about +our results. + +## Consuming the information + +You don't want to be making low-level curl calls just to be able to work with +pagination, so let's write a little Ruby script that does everything we've +just described above. + +As always, first we'll require [GitHub's Octokit.rb][octokit.rb] Ruby library, and +pass in our [personal access token][personal token]: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + +Next, we'll execute the search, using Octokit's `search_code` method. Unlike +using `curl`, we can also immediately retrieve the number of results, so let's +do that: + + #!ruby + results = client.search_code('addClass user:mozilla') + total_count = results.total_count + +Now, let's grab the number of the last page, similar to `page=34>; rel="last"` +information in the link header. Octokit.rb support pagination information through +an implementation called "[Hypermedia link relations][hypermedia-relations]." +We won't go into detail about what that is, but, suffice to say, each element +in the `results` variable has a hash called `rels`, which can contain information +about `:next`, `:last`, `:first`, and `:prev`, depending on which result you're +on. These relations also contain information about the resulting URL, by calling +`rels[:last].href`. + +Knowing this, let's grab the page number of the last result, and present all +this information to the user: + + #!ruby + last_response = client.last_response + number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1] + + puts "There are #{total_count} results, on #{number_of_pages} pages!" + +Finally, let's iterate through the results. You could do this with a loop `for i in 1..number_of_pages.to_i`, +but instead, let's follow the `rels[:next]` headers to retrieve information from +each page. For the sake of simplicity, let's just grab the file path of the first +result from each page. To do this, we'll need a loop; and at the end of every loop, +we'll retrieve the data set for the next page by following the `rels[:next]` information. +The loop will finish when there is no `rels[:next]` information to consume (in other +words, we are at `rels[:last]`). It might look something like this: + + #!ruby + loop do + puts last_response.data.items.first.path + last_response = last_response.rels[:next].get + sleep 4 # back off from the API rate limiting; don't do this in Real Life + break if last_response.rels[:next].nil? + end + +Changing the number of items per page is extremely simple with Octokit.rb. Simply +pass a `per_page` options hash to the initial client construction. After that, +your code should remain intact: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + + results = client.search_code('addClass user:mozilla', :per_page => 100) + total_count = results.total_count + + last_response = client.last_response + number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1] + + puts last_response.rels[:last].href + puts "There are #{total_count} results, on #{number_of_pages} pages!" + + puts "And here's the first path for every set" + + loop do + puts last_response.data.items.first.path + last_response = last_response.rels[:next].get + sleep 4 # back off from the API rate limiting; don't do this in Real Life + break if last_response.rels[:next].nil? + end + +## Constructing Pagination Links + +Normally, with pagination, your goal isn't to concatenate all of the possible +results, but rather, to produce a set of navigation, like this: + +![Sample of pagination links](/images/pagination_sample.png) + +Let's sketch out a micro-version of what that might entail. + +From the code above, we already know we can get the `number_of_pages` in the +paginated results from the first call: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + + results = client.search_code('addClass user:mozilla') + total_count = results.total_count + + last_response = client.last_response + number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1] + + puts last_response.rels[:last].href + puts "There are #{total_count} results, on #{number_of_pages} pages!" + + +From there, we can construct a beautiful ASCII representation of the number boxes: + + #!ruby + numbers = "" + for i in 1..number_of_pages.to_i + numbers << "[#{i}] " + end + puts numbers + +Let's simulate a user clicking on one of these boxes, by constructing a random +number: + + #!ruby + random_page = Random.new + random_page = random_page.rand(1..number_of_pages.to_i) + + puts "A User appeared, and clicked number #{random_page}!" + +Now that we have a page number, we can use Octokit to explicitly retrieve that +individual page, by passing the `:page` option: + + #!ruby + clicked_results = client.search_code('addClass user:mozilla', :page => random_page) + +If we wanted to get fancy, we could also grab the previous and next pages, in +order to generate links for back (`<<`) and foward (`>>`) elements: + + #!ruby + prev_page_href = client.last_response.rels[:prev] ? client.last_response.rels[:prev].href : "(none)" + next_page_href = client.last_response.rels[:next] ? client.last_response.rels[:next].href : "(none)" + + puts "The prev page link is #{prev_page_href}" + puts "The next page link is #{next_page_href}" + +[pagination]: /v3/#pagination +[platform samples]: https://github.com/github/platform-samples/tree/master/api/ruby/traversing-with-pagination +[octokit.rb]: https://github.com/octokit/octokit.rb +[personal token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use +[hypermedia-relations]: https://github.com/octokit/octokit.rb#pagination +[listing commits]: https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository diff --git a/content/guides/using-ssh-agent-forwarding.md b/content/guides/using-ssh-agent-forwarding.md new file mode 100644 index 0000000000..827b0d207e --- /dev/null +++ b/content/guides/using-ssh-agent-forwarding.md @@ -0,0 +1,146 @@ +--- +title: Using SSH Agent Forwarding | GitHub API +--- + +# Using SSH agent forwarding + +* TOC +{:toc} + +SSH agent forwarding can be used to make deploying to a server simple. It allows you to use your local SSH keys instead of leaving keys (without passphrases!) sitting on your server. + +If you've already set up an SSH key to interact with GitHub, you're probably familiar with `ssh-agent`. It's a program that runs in the background and keeps your key loaded into memory, so that you don't need to enter your passphrase every time you need to use the key. The nifty thing is, you can choose to let servers access your local `ssh-agent` as if they were already running on the server. This is sort of like asking a friend to enter their password so that you can use their computer. + +Check out [Steve Friedl's Tech Tips guide][tech-tips] for a more detailed explanation of SSH agent forwarding. + +## Setting up SSH agent forwarding + +Ensure that your own SSH key is set up and working. You can use [our guide on generating SSH keys][generating-keys] if you've not done this yet. + +You can test that your local key works by entering `ssh -T git@github.com` in the terminal: + +
+$ ssh -T git@github.com
+# Attempt to SSH in to github
+Hi username! You've successfully authenticated, but GitHub does not provide
+shell access.
+
+ +We're off to a great start. Let's set up SSH to allow agent forwarding to your server. + +1. Using your favorite text editor, open up the file at `~/.ssh/config`. If this file doesn't exist, you can create it by entering `touch ~/.ssh/config` in the terminal. + +2. Enter the following text into the file, replacing `example.com` with your server's domain name or IP: + + Host example.com + ForwardAgent yes + +
+

+Warning: You may be tempted to use a wildcard like Host * to just apply this setting to all SSH connections. That's not really a good idea, as you'd be sharing your local SSH keys with every server you SSH into. They won't have direct access to the keys, but they will be able to use them as you while the connection is established. You should only add servers you trust and that you intend to use with agent forwarding. +

+
+ +## Testing SSH agent forwarding + +To test that agent forwarding is working with your server, you can SSH into your server and run `ssh -T git@github.com` once more. If all is well, you'll get back the same prompt as you did locally. + +If you're unsure if your local key is being used, you can also inspect the `SSH_AUTH_SOCK` variable on your server: + +
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+/tmp/ssh-4hNGMk8AZX/agent.79453
+
+ +If the variable is not set, it means that agent forwarding is not working: + +
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+[No output]
+$ ssh -T git@github.com
+# Try to SSH to github
+Permission denied (publickey).
+
+ +## Troubleshooting SSH agent forwarding + +Here are some things to look out for when troubleshooting SSH agent forwarding. + +### You must be using an SSH URL to check out code + +SSH forwarding only works with SSH URLs, not HTTP(s) URLs. Check the *.git/config* file on your server and ensure the URL is an SSH-style URL like below: + +
+[remote "origin"]
+  url = git@github.com:yourAccount/yourProject.git
+  fetch = +refs/heads/*:refs/remotes/origin/*
+
+ +### Your SSH keys must work locally + +Before you can make your keys work through agent forwarding, they must work locally first. [Our guide on generating SSH keys][generating-keys] can help you set up your SSH keys locally. + +### Your system must allow SSH agent forwarding + +Sometimes, system configurations disallow SSH agent forwarding. You can check if a system configuration file is being used by entering the following command in the terminal: + +
+$ ssh -v example.com
+# Connect to example.com with verbose debug output
+OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
+debug1: Reading configuration data /Users/you/.ssh/config
+debug1: Applying options for example.com
+debug1: Reading configuration data /etc/ssh_config
+debug1: Applying options for *
+$ exit
+# Returns to your local command prompt
+
+ +In the example above, the file *~/.ssh/config* is loaded first, then */etc/ssh_config* is read. We can inspect that file to see if it's overriding our options by running the following commands: + +
+$ cat /etc/ssh_config
+# Print out the /etc/ssh_config file
+ Host *
+   SendEnv LANG LC_*
+   ForwardAgent no
+
+ +In this example, our */etc/ssh_config* file specifically says `ForwardAgent no`, which is a way to block agent forwarding. Deleting this line from the file should get agent forwarding working once more. + +### Your server must allow SSH agent forwarding on inbound connections + +Agent forwarding may also be blocked on your server. You can check that agent forwarding is permitted by SSHing into the server and running `sshd_config`. The output from this command should indicate that `AllowAgentForwarding` is set. + +### Your local `ssh-agent` must be running + +On most computers, the operating system automatically launches `ssh-agent` for you. On Windows, however, you need to do this manually. We have [a guide on how to start `ssh-agent` whenever you open Git Bash][autolaunch-ssh-agent]. + +To verify that `ssh-agent` is running on your computer, type the following command in the terminal: + +
+$ echo "$SSH_AUTH_SOCK"
+# Print out the SSH_AUTH_SOCK variable
+/tmp/launch-kNSlgU/Listeners
+
+ +### Your key must be available to `ssh-agent` + +You can check that your key is visible to `ssh-agent` by running the following command: + +
+ssh-add -L
+
+ +If the command says that no identity is available, you'll need to add your key: + +
+ssh-add yourkey
+
+ +[tech-tips]: http://www.unixwiz.net/techtips/ssh-agent-forwarding.html +[generating-keys]: https://help.github.com/articles/generating-ssh-keys +[ssh-passphrases]: https://help.github.com/ssh-key-passphrases/ +[autolaunch-ssh-agent]: https://help.github.com/articles/working-with-ssh-key-passphrases#auto-launching-ssh-agent-on-msysgit diff --git a/content/guides/working-with-comments.md b/content/guides/working-with-comments.md new file mode 100644 index 0000000000..3a1f3850bf --- /dev/null +++ b/content/guides/working-with-comments.md @@ -0,0 +1,118 @@ +--- +title: Working with Comments | GitHub API +--- + +# Working with Comments + +* TOC +{:toc} + +For any Pull Request, GitHub provides three kinds of comment views: +[comments on the Pull Request][PR comment] as a whole, [comments on a specific line][PR line comment] within the Pull Request, +and [comments on a specific commit][commit comment] within the Pull Request. + +Each of these types of comments goes through a different portion of the GitHub API. +In this guide, we'll explore how you can access and manipulate each one. For every +example, we'll be using [this sample Pull Request made][sample PR] on the "octocat" +repository. As always, samples can be found in [our platform-samples repository][platform-samples]. + +## Pull Request Comments + +To access comments on a Pull Request, you'll go through [the Issues API][issues]. +This may seem counterintuitive at first. But once you understand that a Pull +Request is just an Issue with code, it makes sense to use the Issues API to +create comments on a Pull Request. + +We'll demonstrate fetching Pull Request comments by creating a Ruby script using +[Octokit.rb][octokit.rb]. You'll also want to create a [personal access token][personal token]. + +The following code should help you get started accessing comments from a Pull Request +using Octokit.rb: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + + client.issue_comments("octocat/Spoon-Knife", 1176).each do |comment| + username = comment[:user][:login] + post_date = comment[:created_at] + content = comment[:body] + + puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n" + end + +Here, we're specifically calling out to the Issues API to get the comments (`issue_comments`), +providing both the repository's name (`octocat/Spoon-Knife`), and the Pull Request ID +we're interested in (`1176`). After that, it's simply a matter of iterating through +the comments to fetch information about each one. + +## Pull Request Comments on a Line + +Within the diff view, you can start a discussion on a particular aspect of a singular +change made within the Pull Request. These comments occur on the individual lines +within a changed file. The endpoint URL for this discussion comes from [the Pull Request Review API][PR Review API]. + +The following code fetches all the Pull Request comments made on files, given a single Pull Request number: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + + client.pull_request_comments("octocat/Spoon-Knife", 1176).each do |comment| + username = comment[:user][:login] + post_date = comment[:created_at] + content = comment[:body] + path = comment[:path] + position = comment[:position] + + puts "#{username} made a comment on #{post_date} for the file called #{path}, on line #{position}. It says:\n'#{content}'\n" + end + +You'll notice that it's incredibly similar to the example above. The difference +between this view and the Pull Request comment is the focus of the conversation. +A comment made on a Pull Request should be reserved for discussion or ideas on +the overall direction of the code. A comment made as part of a Pull Request review should +deal specifically with the way a particular change was implemented within a file. + +## Commit Comments + +The last type of comments occur specifically on individual commits. For this reason, +they make use of [the commit comment API][commit comment API]. + +To retrieve the comments on a commit, you'll want to use the SHA1 of the commit. +In other words, you won't use any identifier related to the Pull Request. Here's an example: + + #!ruby + require 'octokit' + + # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!! + # Instead, set and test environment variables, like below + client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN'] + + client.commit_comments("octocat/Spoon-Knife", "cbc28e7c8caee26febc8c013b0adfb97a4edd96e").each do |comment| + username = comment[:user][:login] + post_date = comment[:created_at] + content = comment[:body] + + puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n" + end + +Note that this API call will retrieve single line comments, as well as comments made +on the entire commit. + +[PR comment]: https://github.com/octocat/Spoon-Knife/pull/1176#issuecomment-24114792 +[PR line comment]: https://github.com/octocat/Spoon-Knife/pull/1176#discussion_r6252889 +[commit comment]: https://github.com/octocat/Spoon-Knife/commit/cbc28e7c8caee26febc8c013b0adfb97a4edd96e#commitcomment-4049848 +[sample PR]: https://github.com/octocat/Spoon-Knife/pull/1176 +[platform-samples]: https://github.com/github/platform-samples/tree/master/api/ruby/working-with-comments +[issues]: https://developer.github.com/v3/issues/comments/ +[personal token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use +[octokit.rb]: https://github.com/octokit/octokit.rb +[PR Review API]: https://developer.github.com/v3/pulls/comments/ +[commit comment API]: https://developer.github.com/v3/repos/comments/#get-a-single-commit-comment diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000000..b17f294c01 --- /dev/null +++ b/content/index.md @@ -0,0 +1,41 @@ +--- +title: GitHub Developer +layout: overview +--- + +
+

+ Leverage the power of
+ GitHub in your app. +

+

Get started with one of our guides, or jump straight into the API documentation.

+ Browse the documentation + Rocketship +
+ +
+
+

Join the GitHub Developer Program.

+

The best way to integrate with GitHub. Learn more.

+
+
+ +
+
    +
  • + +

    Get Started

    +

    New to the GitHub API? With these guides you’ll be up and running in a snap.

    +
  • +
  • + +

    Libraries

    +

    We’ve got you covered. Use the GitHub API in your favorite language.

    +
  • +
  • + +

    Support

    +

    Are you stuck? Already tried our troubleshooting guide? Talk to a supportocat.

    +
  • +
+
diff --git a/content/libraries.md b/content/libraries.md new file mode 100644 index 0000000000..1d597a3be9 --- /dev/null +++ b/content/libraries.md @@ -0,0 +1,183 @@ +--- +title: Libraries | GitHub API +layout: libraries +--- + +
+

Octokit comes in
+many flavors

+

Use the official Octokit library, or choose between any of the available third party libraries.

+ + The Gundamcat +
+ +# Third-party libraries + +## Dart + +* [github.dart][github.dart] + +[github.dart]: https://github.com/DirectMyFile/github.dart + +## .NET + +* [IronGithub][irongithub] +* [CSharp GitHub API][csharp] +* [FSharp.GitHubApi][fsharp] + +[irongithub]: https://github.com/in2bits/IronGitHub +[csharp]: https://github.com/sgrassie/csharp-github-api +[fsharp]: https://github.com/saxonmatt/FSharp.GitHubApi + +## Clojure + +* [Tentacles][tentacles] + +[tentacles]: https://github.com/Raynes/tentacles + +## Emacs Lisp + +* [gh.el][gh.el] + +[gh.el]: https://github.com/sigma/gh.el + +## Erlang + +* [Erlang GitHub API][erlang] +* [octo.erl][octo-erl] + +[erlang]: https://github.com/onlyshk/erlang-github-api +[octo-erl]: https://github.com/sdepold/octo.erl + +## Go + +* [go-github][] + +[go-github]: https://github.com/google/go-github + +## Haskell + +* [github][haskell-github] +* [Haskell GitHub API][haskell] + +[haskell-github]: https://github.com/fpco/GitHub +[haskell]: https://github.com/dmnpignaud/haskell-github-api + +## Java + +* The [GitHub Java API (org.eclipse.egit.github.core)](https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core) library +is part of the [GitHub Mylyn Connector](https://github.com/eclipse/egit-github) and aims to support the entire +GitHub v3 API. Builds are available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22org.eclipse.egit.github.core%22). +* [GitHub API for Java (org.kohsuke.github)](http://github-api.kohsuke.org/) defines an object oriented representation of the GitHub API. +* [JCabi GitHub API](http://github.jcabi.com) is based on Java7 JSON API (JSR-353), simplifies tests with a runtime GitHub stub, and +covers the entire API. + +## JavaScript + +* [Node-GitHub][mikedeboer-node-github] +* [NodeJS GitHub library][octonode] +* [gh3 client-side API v3 wrapper][gh3] +* [GitHub.js wrapper around the GitHub API][github] +* [Promise-Based CoffeeScript library for the browser or NodeJS][github-client] + +[mikedeboer-node-github]: https://github.com/mikedeboer/node-github +[octonode]: https://github.com/pksunkara/octonode +[gh3]: https://github.com/k33g/gh3 +[github]: https://github.com/michael/github +[github-client]: https://github.com/philschatz/github-client + +## Julia + +* [GitHub.jl][github.jl] + +[github.jl]: https://github.com/WestleyArgentum/GitHub.jl + +## Objective-C + +* [UAGithubEngine][uagithubengine] + +[uagithubengine]: http://github.com/owainhunt/uagithubengine + +## OCaml + +* [ocaml-github][ocaml-github] + +[ocaml-github]: https://github.com/avsm/ocaml-github + +## Perl + +* [Pithub][pithub-github] ([CPAN][pithub-cpan]) +* [Net::GitHub][net-github-github] ([CPAN][net-github-cpan]) + +[net-github-github]: https://github.com/fayland/perl-net-github +[net-github-cpan]: http://search.cpan.org/dist/Net-GitHub/ +[pithub-github]: https://github.com/plu/Pithub +[pithub-cpan]: http://metacpan.org/module/Pithub + +## PHP + +* [GitHub PHP Client][github-php-client] +* [PHP GitHub API][php-github-api] +* [GitHub API][github-api] +* [GitHub Kohana Module][kohana] +* [GitHub Joomla! Package][joomla] +* [Github Nette Extension][kdyby-github] +* [GitHub API Easy Access][milo-github-api] +* [GitHub bridge for Laravel][github-laravel] + +[github-php-client]: https://github.com/tan-tan-kanarek/github-php-client +[php-github-api]: https://github.com/KnpLabs/php-github-api +[github-api]: https://github.com/yiiext/github-api +[kohana]: https://github.com/acoulton/github_v3_api +[joomla]: https://github.com/joomla-framework/github-api +[kdyby-github]: https://github.com/kdyby/github +[milo-github-api]: https://github.com/milo/github-api +[github-laravel]: https://github.com/GrahamCampbell/Laravel-GitHub + +## Python + +* [PyGithub][jacquev6_pygithub] +* [Pygithub3][pygithub3-api] +* [libsaas][libsaas] +* [github3.py][github3py] +* [sanction][sanction] +* [agithub][agithub] +* [githubpy][githubpy] +* [octohub][octohub] +* [Github-Flask][github-flask] +* [torngithub][torngithub] + +[jacquev6_pygithub]: https://github.com/jacquev6/PyGithub +[pygithub3-api]: https://github.com/copitux/python-github3 +[libsaas]: https://github.com/ducksboard/libsaas +[github3py]: https://github.com/sigmavirus24/github3.py +[sanction]: https://github.com/demianbrecht/sanction +[agithub]: https://github.com/jpaugh/agithub "Agnostic GitHub" +[githubpy]: https://github.com/michaelliao/githubpy +[octohub]: https://github.com/turnkeylinux/octohub +[github-flask]: http://github-flask.readthedocs.org +[torngithub]: https://github.com/jkeylu/torngithub + +## Ruby + +* [GitHub API Gem][ghapi] +* [GitHub v3 API][ruby1] +* [GitHub API Client][ruby2] +* [Ghee][ghee] + +[ghapi]: https://github.com/peter-murach/github +[ruby1]: https://github.com/jwilger/github-v3-api +[ruby2]: https://github.com/okonski/github-api-client +[ghee]: https://github.com/rauhryan/ghee + +## Scala + +* [Dispatch GitHub][dispatchgithub] +* [Hubcat][hubcat] + +[dispatchgithub]: https://github.com/andreazevedo/dispatch-github +[hubcat]: https://github.com/softprops/hubcat diff --git a/content/program.md b/content/program.md new file mode 100644 index 0000000000..f54d401286 --- /dev/null +++ b/content/program.md @@ -0,0 +1,58 @@ +--- +title: GitHub Developer +layout: developers +--- + +
+
+

It takes a community to design, build, and ship great software.

+

Building an application that integrates with GitHub? Register for our Developer Program! The possibilities are endless, and you enjoy the kudos.

+ Register now +
+ GitHub Universe + GitHub Universe +
+ +
+
    +
  • + +

    Stay in the know

    +

    Be the first to know about API changes and try out new features before they launch.

    +
  • +
  • + +

    Scratch an itch

    +

    Build your own tools that seamlessly integrate with the place you push code every day.

    +
  • +
  • + +

    Take on the enterprise

    +

    Obtain developer licenses to build and test your application against GitHub Enterprise.

    +
  • +
+
+ +
+
+ +

Have an integration that works with GitHub?

+

Awesome! We'd love to have you be part of the program. Here’s how you can spread the word:

+ +
+ +
+ +

Ready to join the GitHub Developer Program?

+

Membership is open to individual developers and companies who have:

+ +
+
diff --git a/content/v3.md b/content/v3.md new file mode 100644 index 0000000000..d00106d792 --- /dev/null +++ b/content/v3.md @@ -0,0 +1,649 @@ +--- +title: GitHub API v3 +--- + +# Overview + +This describes the resources that make up the official GitHub API v3. If you have any problems or requests please contact +[support][]. + +* TOC +{:toc} + +## Current Version + +By default, all requests receive the **v3** [version](/v3/versions) of the API. +We encourage you to [explicitly request this version via the `Accept` header](/v3/media/#request-specific-version). + + Accept: application/vnd.github.v3+json + +## Schema + +All API access is over HTTPS, and accessed from the `api.github.com` +domain (or through `yourdomain.com/api/v3/` for enterprise). All data is +sent and received as JSON. + +
+$ curl -i https://api.github.com/users/octocat/orgs
+
+HTTP/1.1 200 OK
+Server: nginx
+Date: Fri, 12 Oct 2012 23:33:14 GMT
+Content-Type: application/json; charset=utf-8
+Connection: keep-alive
+Status: 200 OK
+ETag: "a00049ba79152d03380c34652f2cb612"
+X-GitHub-Media-Type: github.v3
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4987
+X-RateLimit-Reset: 1350085394
+Content-Length: 5
+Cache-Control: max-age=0, private, must-revalidate
+X-Content-Type-Options: nosniff
+
+[]
+
+ +Blank fields are included as `null` instead of being omitted. + +All timestamps are returned in ISO 8601 format: + + YYYY-MM-DDTHH:MM:SSZ + +### Summary Representations + +When you fetch a list of resources, the response includes a _subset_ of the +attributes for that resource. This is the "summary" representation of the +resource. (Some attributes are computationally expensive for the API to provide. +For performance reasons, the summary representation excludes those attributes. +To obtain those attributes, fetch the "detailed" representation.) + +**Example**: When you get a list of repositories, you get the summary +representation of each repository. Here, we fetch the list of repositories owned +by the [octokit](https://github.com/octokit) organization: + + GET /orgs/octokit/repos + +### Detailed Representations + +When you fetch an individual resource, the response typically includes _all_ +attributes for that resource. This is the "detailed" representation of the +resource. (Note that authorization sometimes influences the amount of detail +included in the representation.) + +**Example**: When you get an individual repository, you get the detailed +representation of the repository. Here, we fetch the +[octokit/octokit.rb](https://github.com/octokit/octokit.rb) repository: + + GET /repos/octokit/octokit.rb + +The documentation provides an example response for each API method. The example +response illustrates all attributes that are returned by that method. + +## Parameters + +Many API methods take optional parameters. For GET requests, any parameters not +specified as a segment in the path can be passed as an HTTP query string +parameter: + +
+$ curl -i "https://api.github.com/repos/vmg/redcarpet/issues?state=closed"
+
+ +In this example, the 'vmg' and 'redcarpet' values are provided for the `:owner` +and `:repo` parameters in the path while `:state` is passed in the query +string. + +For POST, PATCH, PUT, and DELETE requests, parameters not included in the URL should be encoded as JSON +with a Content-Type of 'application/json': + +
+$ curl -i -u username -d '{"scopes":["public_repo"]}' https://api.github.com/authorizations
+
+ +## Root Endpoint + +You can issue a `GET` request to the root endpoint to get all the endpoint categories that the API supports: + +
+$ curl https://api.github.com
+
+ +Note that for GitHub Enterprise, [as with all other endpoints](https://developer.github.com/v3/enterprise/#endpoint-urls), you'll need to pass in your GitHub Enterprise endpoint as the hostname, *as well as your username and password*: + +
+$ curl https://hostname/api/v3/ -u username:password
+
+ +## Client Errors + +There are three possible types of client errors on API calls that +receive request bodies: + +1. Sending invalid JSON will result in a `400 Bad Request` response. + + HTTP/1.1 400 Bad Request + Content-Length: 35 + + {"message":"Problems parsing JSON"} + +2. Sending the wrong type of JSON values will result in a `400 Bad + Request` response. + + HTTP/1.1 400 Bad Request + Content-Length: 40 + + {"message":"Body should be a JSON object"} + +3. Sending invalid fields will result in a `422 Unprocessable Entity` + response. + + HTTP/1.1 422 Unprocessable Entity + Content-Length: 149 + + { + "message": "Validation Failed", + "errors": [ + { + "resource": "Issue", + "field": "title", + "code": "missing_field" + } + ] + } + +All error objects have resource and field properties so that your client +can tell what the problem is. There's also an error code to let you +know what is wrong with the field. These are the possible validation error +codes: + + +Error Name | Description +-----------|-----------| +`missing` | This means a resource does not exist. +`missing_field` | This means a required field on a resource has not been set. +`invalid` | This means the formatting of a field is invalid. The documentation for that resource should be able to give you more specific information. +`already_exists` | This means another resource has the same value as this field. This can happen in resources that must have some unique key (such as Label names). + +Resources may also send custom validation errors (where `code` is `custom`). Custom errors will always have a `message` field describing the error, as well as a `documentation_url` field pointing to some content that might help you resolve the error. + +## HTTP Redirects + +API v3 uses HTTP redirection where appropriate. Clients should assume that any +request may result in a redirection. Receiving an HTTP redirection is *not* an +error and clients should follow that redirect. Redirect responses will have a +`Location` header field which contains the URI of the resource to which the +client should repeat the requests. + +Status Code | Description +-----------|-----------| +`301` | Permanent redirection. The URI you used to make the request has been superseded by the one specified in the `Location` header field. This and all future requests to this resource should be directed to the new URI. +`302`, `307` | Temporary redirection. The request should be repeated verbatim to the URI specified in the `Location` header field but clients should continue to use the original URI for future requests. + +Other redirection status codes may be used in accordance with the HTTP 1.1 spec. + +## HTTP Verbs + +Where possible, API v3 strives to use appropriate HTTP verbs for each +action. + +Verb | Description +-----|----------- +`HEAD` | Can be issued against any resource to get just the HTTP header info. +`GET` | Used for retrieving resources. +`POST` | Used for creating resources. +`PATCH` | Used for updating resources with partial JSON data. For instance, an Issue resource has `title` and `body` attributes. A PATCH request may accept one or more of the attributes to update the resource. PATCH is a relatively new and uncommon HTTP verb, so resource endpoints also accept `POST` requests. +`PUT` | Used for replacing resources or collections. For `PUT` requests with no `body` attribute, be sure to set the `Content-Length` header to zero. +`DELETE` |Used for deleting resources. + +## Authentication + +There are three ways to authenticate through GitHub API v3. Requests that +require authentication will return `404 Not Found`, instead of +`403 Forbidden`, in some places. This is to prevent the accidental leakage +of private repositories to unauthorized users. + +### Basic Authentication + +
+$ curl -u "username" https://api.github.com
+
+ +### OAuth2 Token (sent in a header) + +
+$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
+
+ +### OAuth2 Token (sent as a parameter) + +
+$ curl https://api.github.com/?access_token=OAUTH-TOKEN
+
+ +Read [more about OAuth2](/v3/oauth/). Note that OAuth2 tokens can be [acquired +programmatically](/v3/oauth_authorizations/#create-a-new-authorization), for applications that +are not websites. + +### OAuth2 Key/Secret + +
+$ curl 'https://api.github.com/users/whatever?client_id=xxxx&client_secret=yyyy'
+
+ +This should only be used in server to server scenarios. Don't leak your +OAuth application's client secret to your users. Read [more about +unauthenticated rate limiting](#increasing-the-unauthenticated-rate-limit-for-oauth-applications). + +### Failed login limit + +Authenticating with invalid credentials will return `401 Unauthorized`: + +
+$ curl -i https://api.github.com -u foo:bar
+
+HTTP/1.1 401 Unauthorized
+
+{
+  "message": "Bad credentials",
+  "documentation_url": "https://developer.github.com/v3"
+}
+
+ +After detecting several requests with invalid credentials within a short period, +the API will temporarily reject all authentication attempts for that user +(including ones with valid credentials) with `403 Forbidden`: + +
+$ curl -i https://api.github.com -u valid_username:valid_password
+
+HTTP/1.1 403 Forbidden
+
+{
+  "message": "Maximum number of login attempts exceeded. Please try again later.",
+  "documentation_url": "https://developer.github.com/v3"
+}
+
+ +## Hypermedia + +All resources may have one or more `*_url` properties linking to other +resources. These are meant to provide explicit URLs so that proper API clients +don't need to construct URLs on their own. It is highly recommended that API +clients use these. Doing so will make future upgrades of the API easier for +developers. All URLs are expected to be proper [RFC 6570][rfc] URI templates. + +You can then expand these templates using something like the [uri_template][uri] +gem: + + >> tmpl = URITemplate.new('/notifications{?since,all,participating}') + >> tmpl.expand + => "/notifications" + + >> tmpl.expand :all => 1 + => "/notifications?all=1" + + >> tmpl.expand :all => 1, :participating => 1 + => "/notifications?all=1&participating=1" + +[rfc]: http://tools.ietf.org/html/rfc6570 +[uri]: https://github.com/hannesg/uri_template + +## Pagination + +Requests that return multiple items will be paginated to 30 items by +default. You can specify further pages with the `?page` parameter. For some +resources, you can also set a custom page size up to 100 with the `?per_page` parameter. +Note that for technical reasons not all endpoints respect the `?per_page` parameter, +see [events](https://developer.github.com/v3/activity/events/) for example. + +
+$ curl 'https://api.github.com/user/repos?page=2&per_page=100'
+
+ +Note that page numbering is 1-based and that omitting the `?page` +parameter will return the first page. + +For more information on pagination, check out our guide on [Traversing with Pagination][pagination-guide]. + +### Link Header + +The pagination info is included in [the Link +header](http://tools.ietf.org/html/rfc5988). It is important to +follow these Link header values instead of constructing your own URLs. In some +instances, such as in the [Commits +API](/v3/repos/commits/), pagination is based on +SHA1 and not on page number. + + Link: ; rel="next", + ; rel="last" + +_Linebreak is included for readability._ + +The possible `rel` values are: + +Name | Description +-----------|-----------| +`next` |Shows the URL of the immediate next page of results. +`last` |Shows the URL of the last page of results. +`first` |Shows the URL of the first page of results. +`prev` |Shows the URL of the immediate previous page of results. + +## Rate Limiting + +For requests using Basic Authentication or OAuth, you can make up to 5,000 +requests per hour. For unauthenticated requests, the rate limit allows you to +make up to 60 requests per hour. Unauthenticated requests are associated with your IP address, +and not the user making requests. Note that [the Search API has custom rate limit +rules](/v3/search/#rate-limit). + +You can check the returned HTTP headers of any API request to see your current +rate limit status: + +
+$ curl -i https://api.github.com/users/whatever
+
+HTTP/1.1 200 OK
+Date: Mon, 01 Jul 2013 17:27:06 GMT
+Status: 200 OK
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 56
+X-RateLimit-Reset: 1372700873
+
+ +The headers tell you everything you need to know about your current rate limit status: + +Header Name | Description +-----------|-----------| +`X-RateLimit-Limit` | The maximum number of requests that the consumer is permitted to make per hour. +`X-RateLimit-Remaining` | The number of requests remaining in the current rate limit window. +`X-RateLimit-Reset` | The time at which the current rate limit window resets in [UTC epoch seconds](http://en.wikipedia.org/wiki/Unix_time). + +If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object. + +

+new Date(1372700873 * 1000)
+// => Mon Jul 01 2013 13:47:53 GMT-0400 (EDT)
+
+ +Once you go over the rate limit you will receive an error response: + +
+HTTP/1.1 403 Forbidden
+Date: Tue, 20 Aug 2013 14:50:41 GMT
+Status: 403 Forbidden
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 0
+X-RateLimit-Reset: 1377013266
+
+{
+    "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
+    "documentation_url": "https://developer.github.com/v3/#rate-limiting"
+}
+
+ +You can also [check your rate limit status](/v3/rate_limit) without incurring an +API hit. +
+ +### Increasing the unauthenticated rate limit for OAuth applications + +If your OAuth application needs to make unauthenticated calls with a higher rate limit, you can pass your app's client ID and secret as part of the query string. + +
+$ curl -i 'https://api.github.com/users/whatever?client_id=xxxx&client_secret=yyyy'
+
+HTTP/1.1 200 OK
+Date: Mon, 01 Jul 2013 17:27:06 GMT
+Status: 200 OK
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4966
+X-RateLimit-Reset: 1372700873
+
+ +This method should only be used for server-to-server calls. You should never +share your client secret with anyone or include it in client-side browser code. + +### Staying within the rate limit + +If you are using Basic Authentication or OAuth, and you are exceeding +your rate limit, you can likely fix the issue by caching API responses +and using [conditional requests](#conditional-requests). + +If you're using conditional requests and still exceeding your rate +limit, please [contact us][support] to request a +higher rate limit for your OAuth application. + +### Abuse Rate Limits + +To prevent abuse, additional rate limits apply to some endpoints that +create content. This rate limit applies to the creation of new content +over a period of time. These rate limits do not apply to private repositories +or GitHub Enterprise installations. + +It is not intended for this rate limit to interfere with any legitimate use of +the API. Your normal [rate limits](/v3/#rate-limiting) should be the only +limit you target. Please [contact support][abuse-support] if your use is affected by +this rate limit. + +If your application triggers this rate limit, you'll receive an informative +response: + +
+HTTP/1.1 403 Forbidden
+Content-Type: application/json; charset=utf-8
+Connection: close
+
+{
+  "message": "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.",
+  "documentation_url": "https://developer.github.com/v3#abuse-rate-limits"
+}
+
+ +## User Agent Required + +All API requests MUST include a valid `User-Agent` header. Requests with no `User-Agent` +header will be rejected. We request that you use your GitHub username, or the name of your +application, for the `User-Agent` header value. This allows us to contact you if there are problems. + +Here's an example: + +
+User-Agent: Awesome-Octocat-App
+
+ +If you provide an invalid `User-Agent` header, you will receive a `403 Forbidden` response: + +
+$ curl -iH 'User-Agent: ' https://api.github.com/meta
+HTTP/1.0 403 Forbidden
+Connection: close
+Content-Type: text/html
+
+Request forbidden by administrative rules.
+Please make sure your request has a User-Agent header.
+Check https://developer.github.com for other possible causes.
+
+ +## Conditional requests + +Most responses return an `ETag` header. Many responses also return a `Last-Modified` header. You can use the values +of these headers to make subsequent requests to those resources using the +`If-None-Match` and `If-Modified-Since` headers, respectively. If the resource +has not changed, the server will return a `304 Not Modified`. Also note: making +a conditional request and receiving a 304 response does not count against your +[Rate Limit](#rate-limiting), so we encourage you to use it whenever possible. + +
+$ curl -i https://api.github.com/user
+HTTP/1.1 200 OK
+Cache-Control: private, max-age=60
+ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 200 OK
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+X-RateLimit-Reset: 1372700873
+
+$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
+HTTP/1.1 304 Not Modified
+Cache-Control: private, max-age=60
+ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 304 Not Modified
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+X-RateLimit-Reset: 1372700873
+
+$ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
+HTTP/1.1 304 Not Modified
+Cache-Control: private, max-age=60
+Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
+Status: 304 Not Modified
+Vary: Accept, Authorization, Cookie
+X-RateLimit-Limit: 5000
+X-RateLimit-Remaining: 4996
+X-RateLimit-Reset: 1372700873
+
+ +## Cross Origin Resource Sharing + +The API supports Cross Origin Resource Sharing (CORS) for AJAX requests from +any origin. +You can read the [CORS W3C Recommendation](http://www.w3.org/TR/cors), or +[this intro](http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from the +HTML 5 Security Guide. + +Here's a sample request sent from a browser hitting +`http://example.com`: + +
+$ curl -i https://api.github.com -H "Origin: http://example.com"
+HTTP/1.1 302 Found
+Access-Control-Allow-Origin: *
+Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
+Access-Control-Allow-Credentials: true
+
+ +This is what the CORS preflight request looks like: + +
+$ curl -i https://api.github.com -H "Origin: http://example.com" -X OPTIONS
+HTTP/1.1 204 No Content
+Access-Control-Allow-Origin: *
+Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-GitHub-OTP, X-Requested-With
+Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
+Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
+Access-Control-Max-Age: 86400
+Access-Control-Allow-Credentials: true
+
+ +## JSON-P Callbacks + +You can send a `?callback` parameter to any GET call to have the results +wrapped in a JSON function. This is typically used when browsers want +to embed GitHub content in web pages by getting around cross domain +issues. The response includes the same data output as the regular API, +plus the relevant HTTP Header information. + +
+$ curl https://api.github.com?callback=foo
+
+/**/foo({
+  "meta": {
+    "status": 200,
+    "X-RateLimit-Limit": "5000",
+    "X-RateLimit-Remaining": "4966",
+    "X-RateLimit-Reset": "1372700873",
+    "Link": [ // pagination headers and other links
+      ["https://api.github.com?page=2", {"rel": "next"}]
+    ]
+  },
+  "data": {
+    // the data
+  }
+})
+
+ +You can write a JavaScript handler to process the callback. Here's a minimal example you can try out: + + + + + + + +

Open up your browser's console.

+ + + +All of the headers are the same String value as the HTTP Headers with one +notable exception: Link. Link headers are pre-parsed for you and come +through as an array of `[url, options]` tuples. + +A link that looks like this: + + Link: ; rel="next", ; rel="foo"; bar="baz" + +... will look like this in the Callback output: + +<%= json "Link" => [ + ["url1", {:rel => "next"}], + ["url2", {:rel => "foo", :bar => "baz"}]] %> + +## Timezones + +Some requests allow for specifying timestamps or generate timestamps with time +zone information. We apply the following rules, in order of priority, to +determine timezone information for API calls. + +#### Explicitly provide an ISO 8601 timestamp with timezone information + +For API calls that allow for a timestamp to be specified, we use that exact +timestamp. An example of this is the [Commits API](/v3/git/commits). + +These timestamps look something like `2014-02-27T15:05:06+01:00`. Also see +[this example](https://developer.github.com/v3/git/commits/#example-input) for +how these timestamps can be specified. + +#### Using the `Time-Zone` header + +It is possible to supply a `Time-Zone` header which defines a timezone according +to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + + $ curl -H "Time-Zone: Europe/Amsterdam" -X POST https://api.github.com/repos/github/linguist/contents/new_file.md + +This means that we generate a timestamp for the moment your API call is made in +the timezone this header defines. For example, the [Contents API](/v3/repos/contents/) +generates a git commit for each addition or change and uses the current time +as the timestamp. This header will determine the timezone used for generating +that current timestamp. + +#### Using the last known timezone for the user + +If no `Time-Zone` header is specified and you make an authenticated call to the +API, we use the last known timezone for the authenticated user. The last known +timezone is updated whenever you browse the GitHub.com website. + +#### UTC + +If the steps above don't result in any information, we use UTC as the timezone +to create the git commit. + +[support]: https://github.com/contact?form[subject]=APIv3 +[abuse-support]: https://github.com/contact?form[subject]=API+Abuse+Rate+Limits +[pagination-guide]: /guides/traversing-with-pagination diff --git a/content/v3/activity.md b/content/v3/activity.md new file mode 100644 index 0000000000..cc3a00d02f --- /dev/null +++ b/content/v3/activity.md @@ -0,0 +1,39 @@ +--- +title: Activity | GitHub API +--- +# Activity + +Serving up the 'social' in Social Coding, the Activity APIs provide access to +notifications, subscriptions, and timelines. + +## [Events][] + +The [Events API][Events] is a read-only interface to all the [event +types][types] that power the various activity streams on GitHub. + +## [Feeds][] + +List of [Atom feeds][Feeds] available for the authenticating user. + +## [Notifications][] + +Notifications of new comments are delivered to users. [The Notifications +API][Notifications] lets you view these notifications and mark them as read. + +## [Starring][] + +[Repository Starring][Starring] is a feature that lets users bookmark repositories. Stars +are shown next to repositories to show an approximate level of interest. Stars +have no effect on notifications or the activity feed. + +## [Watching][] + +[Watching a Repository][Watching] registers the user to receive notifications on new +discussions, as well as events in the user's activity feed. + +[Events]: /v3/activity/events/ +[types]: /v3/activity/events/types/ +[Feeds]: /v3/activity/feeds/ +[Notifications]: /v3/activity/notifications/ +[Starring]: /v3/activity/starring/ +[Watching]: /v3/activity/watching/ diff --git a/content/v3/activity/events.md b/content/v3/activity/events.md new file mode 100644 index 0000000000..d038c63d23 --- /dev/null +++ b/content/v3/activity/events.md @@ -0,0 +1,94 @@ +--- +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. + +* TOC +{:toc} + +Events are optimized for polling with the "ETag" header. If no new events have +been triggered, you will see a "304 Not Modified" response, and your current +rate limit will be untouched. There is also an "X-Poll-Interval" header that +specifies how often (in seconds) you are allowed to poll. In times of high +server load, the time may increase. Please obey the header. + + $ curl -I https://api.github.com/users/tater/events + HTTP/1.1 200 OK + X-Poll-Interval: 60 + ETag: "a18c3bded88eb5dbb5c849a489412bf3" + + # The quotes around the ETag value are important + $ curl -I https://api.github.com/users/tater/events \ + -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"' + HTTP/1.1 304 Not Modified + X-Poll-Interval: 60 + +Events support [pagination](/v3/#pagination), +however the `per_page` option is unsupported. The fixed page size is 30 items. +Fetching up to ten pages is supported, for a total of 300 events. + +Only events created within the past 90 days will be included in timelines. Events +older than 90 days will not be included (even if the total number of events +in the timeline is less than 300). + +All Events have the same response format: + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:event) { |h| [h] } %> + +## List public events + + GET /events + +## List repository events + + GET /repos/:owner/:repo/events + +## List issue events for a repository + +Repository issue events have a different format than other events, +as documented in the [Issue Events API](https://developer.github.com/v3/issues/events/). + + GET /repos/:owner/:repo/issues/events + +## List public events for a network of repositories + + GET /networks/:owner/: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/:username/received_events + +## List public events that a user has received + + GET /users/:username/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/:username/events + +## List public events performed by a user + + GET /users/:username/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/:username/events/orgs/:org diff --git a/content/v3/activity/events/types.md b/content/v3/activity/events/types.md new file mode 100644 index 0000000000..c1f1f89b10 --- /dev/null +++ b/content/v3/activity/events/types.md @@ -0,0 +1,494 @@ +--- +title: Event Types & Payloads | GitHub API +--- + +# Event Types & Payloads + +Each event has a similar JSON schema, but a unique `payload` object that is +determined by its event type. + +Event names are used by [repository webhooks](/v3/repos/hooks/) to specify +which events the webhook should receive. The included payloads below are from webhook deliveries but +match events returned by the [Events API](/v3/activity/events/) (except where noted). + + +**Note:** Some of these events may not be rendered in timelines, they're only +created for various internal and webhook purposes. + +* TOC +{:toc} + +## CommitCommentEvent + +Triggered when a [commit comment](/v3/repos/comments/#list-commit-comments-for-a-repository) is created. + +### Event name + +`commit_comment` + +### Payload + +Key | Type | Description +----|------|------------- +`comment`|`object` | The [comment](/v3/repos/comments/#list-commit-comments-for-a-repository) itself. + + +<%= webhook_payload "commit_comment" %> + +## CreateEvent + +Represents a created repository, branch, or tag. + +Note: webhooks will not receive this event for created repositories. + +### Event name + +`create` + +### Payload + +Key | Type | Description +----|------|------------- +`ref_type`|`string` | The object that was created. Can be one of "repository", "branch", or "tag" +`ref`|`string` | The git ref (or `null` if only a repository was created). +`master_branch`|`string` | The name of the repository's default branch (usually `master`). +`description`|`string` | The repository's current description. + +<%= webhook_payload "create" %> + +## DeleteEvent + +Represents a [deleted branch or tag](/v3/git/refs/#delete-a-reference). + +### Event name + +`delete` + +### Payload + +Key | Type | Description +----|------|------------- +`ref_type`|`string` | The object that was deleted. Can be "branch" or "tag". +`ref`|`string` | The full git ref. + +<%= webhook_payload "delete" %> + +## DeploymentEvent + +Represents a [deployment](/v3/repos/deployments/#list-deployments). + +Events of this type are not visible in timelines, they are only used to trigger hooks. + +### Event name + +`deployment` + +### Payload + +Key | Type | Description +----|------|------------- +`sha` |`string` | The commit SHA for which this deployment was created. +`name` |`string` | Name of repository for this deployment, formatted as `:owner/:repo`. +`payload` |`string` | The optional extra information for this deployment. +`environment`|`string` | The optional environment to deploy to. Default: `"production"` +`description`|`string` | The optional human-readable description added to the deployment. + + +<%= webhook_payload "deployment" %> + +## DeploymentStatusEvent + +Represents a [deployment status](/v3/repos/deployments/#list-deployment-statuses). + +Events of this type are not visible in timelines, they are only used to trigger hooks. + +### Event name + +`deployment_status` + +### Payload + +Key | Type | Description +----|------|------------- +`state` |`string` | The new state. Can be `pending`, `success`, `failure`, or `error`. +`target_url` |`string` | The optional link added to the status. +`deployment` |`object` | The deployment that this status is associated with. +`description`|`string` | The optional human-readable description added to the status. + +<%= webhook_payload "deployment_status" %> + +## DownloadEvent + +Triggered when a new [download](/v3/repos/downloads/) is created. + +Events of this type are **no longer created**, but it's possible that they exist in timelines of some users. + +### Event name + +`download` + +### Payload + +Key | Type | Description +----|------|------------- +`download`|`object` | The [download](/v3/repos/downloads/) that was just created. + + +## FollowEvent + +Triggered when a user [follows another user](/v3/users/followers/#follow-a-user). + +Events of this type are **no longer created**, but it's possible that they exist in timelines of some users. + +### Event name + +`follow` + +### Payload + +Key | Type | Description +----|------|------------- +`target`|`object` | The [user](/v3/users) that was just followed. + + +## ForkEvent + +Triggered when a user [forks a repository](/v3/repos/forks/#create-a-fork). + +### Event name + +`fork` + +### Payload + +Key | Type | Description +----|------|------------- +`forkee`|`object` | The created [repository](/v3/repos/). + +<%= webhook_payload "fork" %> + +## ForkApplyEvent + +Triggered when a patch is applied in the Fork Queue. + +Events of this type are **no longer created**, but it's possible that they exist in timelines of some users. + +### Event name + +`fork_apply` + +### Payload + +Key | Type | Description +----|------|------------- +`head`|`string` | The branch name the patch is applied to. +`before`|`string` | SHA of the repository state before the patch. +`after`|`string` | SHA of the repository state after the patch. + + +## GistEvent + +Triggered when a [Gist](/v3/gists/) is created or updated. + +Events of this type are **no longer created**, but it's possible that they exist in timelines of some users. + +### Event name + +`gist` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed. Can be "create" or "update" +`gist`|`object` | The [gist](/v3/gists/) itself. + + +## GollumEvent + +Triggered when a Wiki page is created or updated. + +### Event name + +`gollum` + +### Payload + +Key | Type | Description +----|------|------------- +`pages`|`array` | The pages that were updated. +`pages[][page_name]`|`string` | The name of the page. +`pages[][title]`|`string` | The current page title. +`pages[][action]`|`string` | The action that was performed on the page. Can be "created" or "edited". +`pages[][sha]`|`string` | The latest commit SHA of the page. +`pages[][html_url]`|`string` | Points to the HTML wiki page. + +<%= webhook_payload "gollum" %> + +## IssueCommentEvent + +Triggered when an [issue comment](/v3/issues/comments/) is created. + +### Event name + +`issue_comment` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed on the comment. Currently, can only be "created". +`issue`|`object` | The [issue](/v3/issues/) the comment belongs to. +`comment`|`object` | The [comment](/v3/issues/comments/) itself. + +<%= webhook_payload "issue_comment" %> + +## IssuesEvent + +Triggered when an [issue](/v3/issues) is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened. + +### Event name + +`issues` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", "closed", or "reopened". +`issue`|`object` | The [issue](/v3/issues) itself. +`assignee`|`object` | The optional user who was assigned or unassigned from the issue. +`label`|`object` | The optional label that was added or removed from the issue. + +<%= webhook_payload "issues" %> + +## MemberEvent + +Triggered when a user is [added as a collaborator](/v3/repos/collaborators/#add-collaborator) to a repository. + +### Event name + +`member` + +### Payload + +Key | Type | Description +----|------|------------- +`member`|`object` | The [user](/v3/users/) that was added. +`action`|`string` | The action that was performed. Currently, can only be "added". + +<%= webhook_payload "member" %> + +## MembershipEvent + +Triggered when a user is added or removed from a team. + +Events of this type are not visible in timelines, they are only used to trigger organization webhooks. + +### Event name + +`membership` + +### Payload + +Key | Type | Description +----|------|------------- +`action` |`string` | The action that was performed. Can be "added" or "removed". +`scope` |`string` | The scope of the membership. Currently, can only be "team". +`member` |`object` | The [user](/v3/users/) that was added or removed. +`team` |`object` | The [team](/v3/orgs/teams/) for the membership. + +<%= webhook_payload "membership" %> + +## PageBuildEvent + +Represents an attempted build of a GitHub Pages site, whether successful or not. + +Triggered on push to a GitHub Pages enabled branch (`gh-pages` for project pages, `master` for user and organization pages). + +Events of this type are not visible in timelines, they are only used to trigger hooks. + +### Hook Name + +`page_build` + +### Payload + +Key | Type | Description +----|------|------------ +`build` | `object` | The [page build](https://developer.github.com/v3/repos/pages/#list-pages-builds) itself. + +<%= webhook_payload "page_build" %> + +## PublicEvent + +Triggered when a private repository is [open sourced](/v3/repos/#edit). Without a doubt: the best GitHub event. + +### Event name + +`public` + +### Payload + +<%= webhook_payload "public" %> + +## PullRequestEvent + +Triggered when a [pull request](/v3/pulls) is assigned, unassigned, labeled, unlabeled, opened, closed, reopened, or synchronized. + +### Event name + +`pull_request` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed. Can be one of "assigned", "unassigned", "labeled", "unlabeled", "opened", "closed", or "reopened", or "synchronize". If the action is "closed" and the `merged` key is `false`, the pull request was closed with unmerged commits. If the action is "closed" and the `merged` key is `true`, the pull request was merged. +`number`|`integer` | The pull request number. +`pull_request`|`object` | The [pull request](/v3/pulls) itself. + +<%= webhook_payload "pull_request" %> + +## PullRequestReviewCommentEvent + +Triggered when a [comment is created on a portion of the unified diff](/v3/pulls/comments) of a pull request. + +### Event name + +`pull_request_review_comment` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed on the comment. Currently, can only be "created". +`pull_request`|`object` | The [pull request](/v3/pulls/) the comment belongs to. +`comment`|`object` | The [comment](/v3/pulls/comments) itself. + +<%= webhook_payload "pull_request_review_comment" %> + +## PushEvent + +Triggered when a repository branch is pushed to. + +Note: the example payload below is from a webhook delivery. The Event API `PushEvent` payload will differ. + +### Event name + +`push` + +### Payload + +Key | Type | Description +----|------|------------- +`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` | An array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the [Commits API](/v3/repos/commits/) to fetch additional commits. This limit is applied to timeline events only and isn't applied to webhook deliveries.) +`commits[][sha]`|`string` | The SHA of the commit. +`commits[][message]`|`string` | 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. +`commits[][distinct]`|`boolean` | Whether this commit is distinct from any that have been pushed before. + +<%= webhook_payload "push" %> + +## ReleaseEvent + +Triggered when a [release](/v3/repos/releases/#get-a-single-release) is published. + +### Event name + +`release` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed. Currently, can only be "published". +`release`|`object` | The [release](/v3/repos/releases/#get-a-single-release) itself. + +<%= webhook_payload "release" %> + +## RepositoryEvent + +Triggered when a repository is created. + +Events of this type are not visible in timelines, they are only used to trigger organization webhooks. + +### Event name + +`repository` + +### Payload + +Key | Type | Description +----|------|------------- +`action` |`string` | The action that was performed. Currently, can only be "created". +`repository`|`object` | The [repository](/v3/repos/) that was created. + +<%= webhook_payload "repository" %> + +## StatusEvent + +Triggered when the status of a Git commit changes. + +Events of this type are not visible in timelines, they are only used to trigger hooks. + +### Event name + +`status` + +### Payload + +Key | Type | Description +----|------|------------- +`sha`|`string` | The Commit SHA. +`state`|`string` | The new state. Can be `pending`, `success`, `failure`, or `error`. +`description`|`string` | The optional human-readable description added to the status. +`target_url`|`string` | The optional link added to the status. +`branches`|`array` | An array of branch objects containing the status' SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches. + +<%= webhook_payload "status" %> + +## TeamAddEvent + +Triggered when a [repository is added to a team](/v3/orgs/teams/#add-team-repo). + +Events of this type are not visible in timelines. These events are only used to trigger hooks. + +### Event name + +`team_add` + +### Payload + +Key | Type | Description +----|------|------------- +`team`|`object` | The [team](/v3/orgs/teams/) that was modified. Note: older events may not include this in the payload. +`repository`|`object` | The [repository](/v3/repos/) that was added to this team. + +<%= webhook_payload "team_add" %> + +## WatchEvent + +The WatchEvent is related to [starring a repository](/v3/activity/starring/#star-a-repository), not [watching](/v3/activity/watching/). +See [this API blog post](/changes/2012-9-5-watcher-api/) for an explanation. + +The event’s actor is the [user](/v3/users/) who starred a repository, and the +event’s repository is the [repository](/v3/repos/) that was starred. + +### Event name + +`watch` + +### Payload + +Key | Type | Description +----|------|------------- +`action`|`string` | The action that was performed. Currently, can only be `started`. + +<%= webhook_payload "watch" %> diff --git a/content/v3/activity/feeds.md b/content/v3/activity/feeds.md new file mode 100644 index 0000000000..10f9cfda30 --- /dev/null +++ b/content/v3/activity/feeds.md @@ -0,0 +1,35 @@ +--- +title: Feeds | GitHub API +--- + +# Feeds + +* TOC +{:toc} + +## List Feeds + +GitHub provides several timeline resources in [Atom][] format. The Feeds API +lists all the feeds available to the authenticating user: + +* **Timeline**: The GitHub global public timeline +* **User**: The public timeline for any user, using [URI template][] +* **Current user public**: The public timeline for the authenticated user +* **Current user**: The private timeline for the authenticated user +* **Current user actor**: The private timeline for activity created by the authenticated user +* **Current user organizations**: The private timeline for the organizations the authenticated user is a member of. + +**Note**: Private feeds are only returned when [authenticating via Basic +Auth][authenticating] since current feed URIs use the older, non revokable auth +tokens. + + GET /feeds + +### Response + +<%= headers 200 %> +<%= json :feeds %> + +[Atom]: http://en.wikipedia.org/wiki/Atom_(standard) +[authenticating]: /v3/#basic-authentication +[URI template]: https://developer.github.com/v3/#hypermedia diff --git a/content/v3/activity/notifications.md b/content/v3/activity/notifications.md new file mode 100644 index 0000000000..8d439d29ae --- /dev/null +++ b/content/v3/activity/notifications.md @@ -0,0 +1,213 @@ +--- +title: Notifications | GitHub API +--- + +# Notifications + +* TOC +{:toc} + +Users receive notifications for conversations in repositories they watch +including: + +* Issues and their comments +* Pull Requests and their comments +* Comments on any commits + +Notifications are also sent for conversations in unwatched repositories when the +user is involved including: + +* **@mentions** +* Issue assignments +* Commits the user authors or commits +* Any discussion in which the user actively participates + +All Notification API calls require the `notifications` or +`repo` API scopes. Doing this will give read-only access to +some Issue/Commit content. You will still need the "repo" scope to access +Issues and Commits from their respective endpoints. + +Notifications come back as "threads". A Thread contains information about the +current discussion of an Issue/PullRequest/Commit. + +Notifications are optimized for polling with the "Last-Modified" header. If +there are no new notifications, you will see a "304 Not Modified" response, +leaving your current rate limit untouched. There is an "X-Poll-Interval" +header that specifies how often (in seconds) you are allowed to poll. In times +of high server load, the time may increase. Please obey the header. + + # Add authentication to your requests + $ curl -I https://api.github.com/notifications + HTTP/1.1 200 OK + Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT + X-Poll-Interval: 60 + + # Pass the Last-Modified header exactly + $ curl -I https://api.github.com/notifications + -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT" + HTTP/1.1 304 Not Modified + X-Poll-Interval: 60 + +## Notification Reasons + +When retrieving responses from the Notifications API, each payload has a key titled +`reason`. These correspond to events that trigger a notification. + +Here's a list of potential `reason`s for receiving a notification: + +Reason Name | Description +------------|------------ +`subscribed` | The notification arrived because you're watching the repository +`manual` | The notification arrived because you've specifically decided to subscribe to the thread (via an Issue or Pull Request) +`author` | The notification arrived because you've created the thread +`comment` | The notification arrived because you've commented on the thread +`mention` | The notification arrived because you were specifically **@mentioned** in the content +`team_mention` | The notification arrived because you were on a team that was mentioned (like @org/team) +`state_change` | The notification arrived because you changed the thread state (like closing an Issue or merging a Pull Request) +`assign` | The notification arrived because you were assigned to the Issue + +Note that the `reason` is modified on a per-thread basis, and can change, if the +`reason` on a later notification is different. + +For example, if you are the author of an issue, subsequent notifications on that +issue will have a `reason` of `author`. If you're then **@mentioned** on the same +issue, the notifications you fetch thereafter will have a `reason` of `mention`. +The `reason` remains as `mention`, regardless of whether you're ever mentioned again. + +## List your notifications + +List all notifications for the current user, grouped by repository. + + GET /notifications + +### Parameters + +Name | Type | Description +-----|------|-------------- +`all`|`boolean` | If `true`, show notifications marked as read. Default: `false` +`participating`|`boolean` | If `true`, only shows notifications in which the user is directly participating or mentioned. Default: `false` +`since`|`string` | Filters out any notifications updated before the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now` + + +### Response + +<%= headers 200 %> +<%= json(:thread) { |h| [h] } %> + +## List your notifications in a repository + +List all notifications for the current user. + + GET /repos/:owner/:repo/notifications + +### Parameters + +Name | Type | Description +-----|------|-------------- +`all`|`boolean` | If `true`, show notifications marked as read. Default: `false` +`participating`|`boolean` | If `true`, only shows notifications in which the user is directly participating or mentioned. Default: `false` +`since`|`string` | Filters out any notifications updated before the given time. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now` + + +### Response + +<%= headers 200 %> +<%= json(:thread) { |h| [h] } %> + +## Mark as read + +Marking a notification as "read" removes it from the [default view +on GitHub.com](https://github.com/notifications). + + PUT /notifications + +### Parameters + +Name | Type | Description +-----|------|-------------- +`last_read_at`|`string` | Describes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now` + + +### Response + +<%= headers 205 %> + +## Mark notifications as read in a repository + +Marking all notifications in a repository as "read" removes them +from the [default view on GitHub.com](https://github.com/notifications). + + PUT /repos/:owner/:repo/notifications + +### Parameters + +Name | Type | Description +-----|------|-------------- +`last_read_at`|`string` | Describes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Default: `Time.now` + + +### Response + +<%= headers 205 %> + +## View a single thread + + GET /notifications/threads/:id + +### Response + +<%= headers 200 %> +<%= json(:thread) %> + +## Mark a thread as read + + PATCH /notifications/threads/:id + +### Response + +<%= headers 205 %> + +## Get a Thread Subscription + +This checks to see if the current user is subscribed to a thread. You can also +[get a Repository subscription](/v3/activity/watching/#get-a-repository-subscription). + +{{#tip}} + +Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mention**ed, or manually subscribe to a thread. + +{{/tip}} + + GET /notifications/threads/:id/subscription + +### Response + +<%= headers 200 %> +<%= json :subscription %> + +## Set a Thread Subscription + +This lets you subscribe or unsubscribe from a conversation. Unsubscribing from a conversation mutes all future notifications (until you comment or get **@mention**ed once more). + + PUT /notifications/threads/:id/subscription + +### Parameters + +Name | Type | Description +-----|------|-------------- +`subscribed`|`boolean`| Determines if notifications should be received from this thread +`ignored`|`boolean`| Determines if all notifications should be blocked from this thread + + +### Response + +<%= headers 200 %> +<%= json :subscription %> + +## Delete a Thread Subscription + + DELETE /notifications/threads/:id/subscription + +### Response + +<%= headers 204 %> diff --git a/content/v3/activity/starring.md b/content/v3/activity/starring.md new file mode 100644 index 0000000000..f04e2486ef --- /dev/null +++ b/content/v3/activity/starring.md @@ -0,0 +1,99 @@ +--- +title: Starring | GitHub API +--- + +# Starring + +* TOC +{:toc} + +Repository Starring is a feature that lets users bookmark repositories. Stars +are shown next to repositories to show an approximate level of interest. Stars +have no effect on notifications or the activity feed. For that, see [Repository +Watching](/v3/activity/watching). + +### Starring vs. Watching + +In August 2012, we [changed the way watching +works](https://github.com/blog/1204-notifications-stars) on GitHub. Many API +client applications may be using the original "watcher" endpoints for accessing +this data. You can now start using the "star" endpoints instead (described +below). Check out the [Watcher API Change post](/changes/2012-9-5-watcher-api/) +for more details. + +## List Stargazers + + GET /repos/:owner/:repo/stargazers + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## List repositories being starred + +List repositories being starred by a user. + + GET /users/:username/starred + +List repositories being starred by the authenticated user. + + GET /user/starred + +### Parameters + +Name | Type | Description +-----|------|-------------- +`sort`|`string` | One of `created` (when the repository was starred) or `updated` (when it was last pushed to). Default: `created` +`direction`|`string` | One of `asc` (ascending) or `desc` (descending). Default: `desc` + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repo) { |h| [h] } %> + +## List repositories being starred with star creation timestamps + +You can also find out _when_ stars were created by passing the following custom content-type via the `Accept` header. + + Accept: application/vnd.github.v3.star+json + +### Response +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:starred_repo) { |hash| [hash] } %> + +## Check if you are starring a repository + +Requires for the user to be authenticated. + + GET /user/starred/:owner/:repo + +### Response if this repository is starred by you + +<%= headers 204 %> + +### Response if this repository is not starred by you + +<%= headers 404 %> + +## Star a repository + +Requires for the user to be authenticated. + + PUT /user/starred/:owner/:repo + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Unstar a repository + +Requires for the user to be authenticated. + + DELETE /user/starred/:owner/:repo + +### Response + +<%= headers 204 %> diff --git a/content/v3/activity/watching.md b/content/v3/activity/watching.md new file mode 100644 index 0000000000..dbc68e9cdf --- /dev/null +++ b/content/v3/activity/watching.md @@ -0,0 +1,133 @@ +--- +title: Watching | GitHub API +--- + +# Watching + +* TOC +{:toc} + +Watching a Repository registers the user to receive notifications on new +discussions, as well as events in the user's activity feed. See [Repository +Starring](/v3/activity/starring) for simple repository bookmarks. + +### Watching vs. Starring + +In August 2012, we [changed the way watching +works](https://github.com/blog/1204-notifications-stars) on GitHub. At the time +of that change, many API clients were already using the existing "watcher" +endpoints to access starring data. To avoid breaking those applications, the +legacy "watcher" endpoints continue to provide starring data. + +To provide access to watching data, the v3 Watcher API uses the "subscription" +endpoints described below. Check out the [Watcher API Change +post](/changes/2012-9-5-watcher-api/) for more details. + +## List watchers + + GET /repos/:owner/:repo/subscribers + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## List repositories being watched + +List repositories being watched by a user. + + GET /users/:username/subscriptions + +List repositories being watched by the authenticated user. + + GET /user/subscriptions + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repo) { |h| [h] } %> + +## Get a Repository Subscription + + GET /repos/:owner/:repo/subscription + +### Response if you are subscribed to the repository + +<%= headers 200 %> +<%= json :repo_subscription %> + +### Response if you are not subscribed to the repository + +<%= headers 404 %> + +## Set a Repository Subscription + + PUT /repos/:owner/:repo/subscription + +### Parameters + +Name | Type | Description +-----|------|-------------- +`subscribed`|`boolean`| Determines if notifications should be received from this repository. +`ignored`|`boolean`| Determines if all notifications should be blocked from this repository. + +{{#tip}} + +If you would like to watch a repository, set `subscribed` to `true`. If you would like to ignore notifications made within a repository, set `ignored` to `true`. If you would like to stop watching a repository, [delete the repository's subscription](#delete-a-repository-subscription) completely. + +{{/tip}} + +### Response + +<%= headers 200 %> +<%= json :repo_subscription %> + +## Delete a Repository Subscription + +{{#tip}} + +This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, [set the repository's subscription manually](#set-a-repository-subscription). + +{{/tip}} + + DELETE /repos/:owner/:repo/subscription + +### Response + +<%= headers 204 %> + +## Check if you are watching a repository (LEGACY) + +Requires for the user to be authenticated. + + GET /user/subscriptions/:owner/:repo + +### Response if this repository is watched by you + +<%= headers 204 %> + +### Response if this repository is not watched by you + +<%= headers 404 %> + +## Watch a repository (LEGACY) + +Requires the user to be authenticated. + + PUT /user/subscriptions/:owner/:repo + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Stop watching a repository (LEGACY) + +Requires for the user to be authenticated. + + DELETE /user/subscriptions/:owner/:repo + +### Response + +<%= headers 204 %> diff --git a/content/v3/auth.md b/content/v3/auth.md new file mode 100644 index 0000000000..2060438b4e --- /dev/null +++ b/content/v3/auth.md @@ -0,0 +1,77 @@ +--- +title: Other Authentication Methods | GitHub API +--- + +# Other Authentication Methods + +* TOC +{:toc} + +While the API provides multiple methods for authentication, we strongly +recommend using [OAuth](/v3/oauth/) for production applications. The other +methods provided are intended to be used for scripts or testing (i.e., cases +where full OAuth would be overkill). Third party applications that rely on +GitHub for authentication should not ask for or collect GitHub credentials. +Instead, they should use the [OAuth web flow](/v3/oauth). + +## Basic Authentication + +The API supports Basic Authentication as defined in +[RFC2617](http://www.ietf.org/rfc/rfc2617.txt) with a few slight differences. +The main difference is that the RFC requires unauthenticated requests to be +answered with `401 Unauthorized` responses. In many places, this would disclose +the existence of user data. Instead, the GitHub API responds with `404 Not Found`. +This may cause problems for HTTP libraries that assume a `401 Unauthorized` +response. The solution is to manually craft the `Authorization` header. + +### Via Username and Password + +To use Basic Authentication with the GitHub API, simply send the username and +password associated with the account. + +For example, if you're accessing the API via [cURL][curl], the following command +would authenticate you if you replace `` with your GitHub username. +(cURL will prompt you to enter the password.) + +
+$ curl -u <username> https://api.github.com/user
+
+ +### Via OAuth Tokens + +Alternatively, you can authenticate using [personal access +tokens][personal-access-tokens] or OAuth tokens. To do so, provide the token as +the username and provide a blank password or a password of `x-oauth-basic`. If +you're accessing the API via cURL, replace `` with your OAuth token in +the following command: + +
+$ curl -u <token>:x-oauth-basic https://api.github.com/user
+
+ +This approach is useful if your tools only support Basic Authentication but you +want to take advantage of OAuth access token security features. + +## Working with two-factor authentication + +For users with two-factor authentication enabled, Basic Authentication requires +an extra step. When you attempt to authenticate with Basic Authentication, the +server will respond with a `401` and an `X-GitHub-OTP: required; :2fa-type` +header. This indicates that a two-factor authentication code is needed (in +addition to the username and password). The `:2fa-type` in this header indicates +whether the account receives its two-factor authentication codes via SMS or via +an application. + +In addition to the Basic Authentication credentials, you must send the user's +authentication code (i.e., one-time password) in the `X-GitHub-OTP` header. +Because these authentication codes expire quickly, we recommend using the +Authorizations API to [create an access token][create-access] and using that +token to [authenticate via OAuth][oauth-auth] for most API access. + +Alternately, you can create access tokens from the Personal Access Token +section of your [application settings page](https://github.com/settings/applications). + +[create-access]: /v3/oauth_authorizations/#create-a-new-authorization +[curl]: http://curl.haxx.se/ +[oauth-auth]: /v3/#authentication +[personal-access-tokens]: https://github.com/blog/1509-personal-api-tokens diff --git a/content/v3/changelog.md b/content/v3/changelog.md new file mode 100644 index 0000000000..9a102517b7 --- /dev/null +++ b/content/v3/changelog.md @@ -0,0 +1,5 @@ +--- +title: GitHub API Changelog +--- + +The API changelog can now be found [here](/changes). Please update your links. diff --git a/content/v3/emojis.md b/content/v3/emojis.md new file mode 100644 index 0000000000..4f5dc5b3ce --- /dev/null +++ b/content/v3/emojis.md @@ -0,0 +1,14 @@ +--- +title: Emojis | GitHub API +--- + +# Emojis + +Lists all the emojis available to use on GitHub. + + GET /emojis + +### Response + +<%= headers 200 %> +<%= json(:emojis) %> diff --git a/content/v3/enterprise.md b/content/v3/enterprise.md new file mode 100644 index 0000000000..a2ff5c249e --- /dev/null +++ b/content/v3/enterprise.md @@ -0,0 +1,46 @@ +--- +title: Enterprise | GitHub API +--- + +# Enterprise <%= fetch_content(:latest_enterprise_version) %> + +* TOC +{:toc} + +[GitHub Enterprise](https://enterprise.github.com/) supports the same powerful API available on GitHub.com as well as its own set of API endpoints. You can find a list of these endpoints on the sidebar, with the exception of the [User Administration][] API, which is within its own section. + +## Endpoint URLs + +All API endpoints—except [Management Console][] API endpoints—are prefixed with the following URL: + +
+http(s)://hostname/api/v3/
+
+ +[Management Console][] API endpoints are only prefixed with a hostname: + +
+http(s)://hostname/
+
+ +## Authentication + +Your Enterprise installation's API endpoints accept [the same authentication methods](http://developer.github.com/v3/#authentication) as the GitHub.com API. Specifically, you can authenticate yourself with **[OAuth tokens][]** (which can be created using the [Authorizations API][]) or **[basic authentication][]**. + +Every Enterprise API endpoint is only accessible to GitHub Enterprise site administrators, with the exception of the [Management Console][] API, which is only accessible via the [Management Console password][]. + +[Authorizations API]: /v3/oauth_authorizations/#create-a-new-authorization +[OAuth tokens]: /v3/oauth/ +[basic authentication]: /v3/#basic-authentication +[Management Console]: /v3/enterprise/management_console/ +[User Administration]: /v3/users/administration/ +[Management Console password]: https://help.github.com/enterprise/2.0/admin/articles/accessing-the-management-console/ + +## Past Releases + +The latest release for GitHub Enterprise is <%= fetch_content(:latest_enterprise_version) %>. The GitHub APIs available to this release are located at />. + +Documentation for the API that's bundled with your GitHub Enterprise appliance is available for past releases: + +* [API documentation for 2.0](https://developer.github.com/enterprise/2.0/) +* [API documentation for 11.10.340](https://developer.github.com/enterprise/11.10.340/) diff --git a/content/v3/enterprise/admin_stats.md b/content/v3/enterprise/admin_stats.md new file mode 100644 index 0000000000..b79196203b --- /dev/null +++ b/content/v3/enterprise/admin_stats.md @@ -0,0 +1,45 @@ +--- +title: Admin Stats | GitHub API +--- + +# Admin Stats + +* TOC +{:toc} + +The Admin Stats API provides a variety of metrics about your installation. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +
+http(s)://hostname/api/v3
+
+ +## Get statistics + +### Request + + GET /enterprise/stats/:type + +There are a variety of types to choose from: + +Type | Description +-------------|------------------------------------- +`issues` | The number of open and closed issues. +`hooks` | The number of active and inactive hooks. +`milestones` | The number of open and closed milestones. +`orgs` | The number of organizations, teams, team members, and disabled organizations. +`comments` | The number of comments on issues, pull requests, commits, and gists. +`pages` | The number of GitHub Pages sites. +`users` | The number of suspended and admin users. +`gists` | The number of private and public gists. +`pulls` | The number of merged, mergeable, and unmergeable pull requests. +`repos` | The number of organization-owned repositories, root repositories, forks, pushed commits, and wikis. +`all` | All of the statistics listed above. + +These statistics are cached and will be updated approximately every 10 minutes. + +### Response + +<%= headers 200 %> +<%= json(:admin_stats) %> diff --git a/content/v3/enterprise/ldap.md b/content/v3/enterprise/ldap.md new file mode 100644 index 0000000000..1d6494dcff --- /dev/null +++ b/content/v3/enterprise/ldap.md @@ -0,0 +1,78 @@ +--- +title: LDAP +--- + +# LDAP + +* TOC +{:toc} + +You can use the LDAP API to update account relationships between a GitHub Enterprise user and its linked LDAP entry or queue a new synchronization. + +With the LDAP mapping endpoints, you're able to update the Distinguished Name (DN) that a user maps to. Note that the LDAP sync endpoints are only effective if your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap). + +## Update LDAP mapping for a user + + PATCH /admin/ldap/user/:username/mapping + +### Body parameters + +Pass a JSON payload with the new LDAP Distinguished Name. + +#### Example + + #!javascript + "uid=asdf,ou=users,dc=github,dc=com" + +### Response + +<%= headers 200 %> +<%= json :ldap_user_update %> + +## Sync LDAP mapping for a user + +{{#tip}} + +Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready. + +{{/tip}} + + POST /admin/ldap/user/:user_id/sync + +### Response + +<%= headers 201 %> +<%= json :ldap_sync_confirm %> + +## Update LDAP mapping for a team + + PATCH /admin/ldap/teams/:team_id/mapping + +### Body parameters + +Pass a JSON payload with the new LDAP Distinguished Name. + +#### Example + + #!javascript + "cn=Enterprise Ops,ou=teams,dc=github,dc=com" + +### Response + +<%= headers 200 %> +<%= json :ldap_team_update %> + +## Sync LDAP mapping for a team + +{{#tip}} + +Note that this API call does not automatically initiate an LDAP sync. Rather, if a `201` is returned, the sync job is queued successfully, and is performed when the instance is ready. + +{{/tip}} + + POST /admin/ldap/user/:team_id/sync + +### Response + +<%= headers 201 %> +<%= json :ldap_sync_confirm %> diff --git a/content/v3/enterprise/license.md b/content/v3/enterprise/license.md new file mode 100644 index 0000000000..3660c1a089 --- /dev/null +++ b/content/v3/enterprise/license.md @@ -0,0 +1,27 @@ +--- +title: License | GitHub API +--- + +# License + +* TOC +{:toc} + +The License API provides information on your Enterprise license. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +
+http(s)://hostname/api/v3
+
+ +## Get license information + +### Request + + GET /enterprise/settings/license + +### Response + +<%= headers 200 %> +<%= json(:licensing) %> diff --git a/content/v3/enterprise/management_console.md b/content/v3/enterprise/management_console.md new file mode 100644 index 0000000000..8e2779bb70 --- /dev/null +++ b/content/v3/enterprise/management_console.md @@ -0,0 +1,277 @@ +--- +title: Management Console | GitHub API +--- + +# Management Console + +* TOC +{:toc} + +The Management Console API helps you manage your GitHub Enterprise installation. + +## Authentication + +You need to pass your [Management Console password](https://help.github.com/enterprise/2.0/admin/articles/accessing-the-management-console/) as an authentication token to every Management Console API endpoint except [`/setup/api/start`](#upload-a-license-for-the-first-time). + +Use the `api_key` parameter to send this token with each request. For example: + +
+$ curl 'http://hostname/setup/api?api_key=your-amazing-password'
+
+ +You can also use standard HTTP authentication to send this token. For example: + +
+$ curl 'http://api_key:your-amazing-password@hostname/setup/api'
+
+ +## Upload a license for the first time + +When you boot a virtual machine for the first time, you can use the following endpoint to upload a license: + + POST /setup/api/start + +Note that you need to POST to [`/setup/api/configure`](#start-a-configuration-process) to start the actual configuration process. + +{{#warning}} + +When using this endpoint, your Enterprise instance must have a password set. This can be accomplished two ways: + +1. If you're working directly with the API before accessing the web interface, you must pass in the password parameter to set your password. +2. If you set up your instance via the web interface before accessing the API, your calls to this endpoint do not need the password parameter. + +{{/warning}} + +### Parameters + +Name | Type | Description +-----|------|-------------- +`license`|`string` | **Required**. The content of your *.ghl* license file. +`password`|`string` | You **must** provide a password *only if* you are uploading your license for the first time. If you previously set a password through the web interface, you don't need this parameter. +`settings`| `string`| Optional path to a JSON file containing your installation settings. + +For a list of the available settings, see [the `/setup/api/settings` endpoint](#retrieve-settings). + +### Response + +
+HTTP/1.1 202 Created
+Location: http://hostname/setup/api/configcheck
+
+ +### Example + +
+curl -X POST 'http://hostname/setup/api/start' -F license=@/path/to/github-enterprise.ghl -F "password=your-amazing-password" -F settings=</path/to/settings.json
+
+ +## Upgrade a license + +This API upgrades your license and also triggers the configuration process: + + POST /setup/api/upgrade + +### Parameters + +Name | Type | Description +-----|------|-------------- +`license`|`string` | The content of your new *.ghl* license file. + +### Response + +
+HTTP/1.1 202 Accepted
+Location: http://hostname/setup/api/configcheck
+
+ +### Example + +
+curl -X POST 'http://api_key:your-amazing-password@hostname/setup/api/upgrade'
+
+ +## Check configuration status + +This endpoint allows you to check the status of the most recent configuration process: + + GET /setup/api/configcheck + +Note that you may need to wait several seconds after you start a process before you can +check its status. + +### Response + +<%= headers 200 %> +<%= json(:config_statuses) %> + +The different statuses are: + +Status | Description +--------------|---------------------------------- +`PENDING` | The job has not started yet +`CONFIGURING` | The job is running +`DONE` | The job has finished correctly +`FAILED` | The job has finished unexpectedly + +### Example + +
+curl 'http://api_key:your-amazing-password@hostname/setup/api/configcheck'
+
+ +## Start a configuration process + +This endpoint allows you to start a configuration process at any time: + + POST /setup/api/configure + +### Response + +
+HTTP/1.1 202 Accepted
+Location: http://hostname/setup/api/configcheck
+
+ +### Example + +
+curl -X POST 'http://api_key:your-amazing-password@hostname/setup/api/configure'
+
+ +## Retrieve settings + + GET /setup/api/settings + +### Response + +<%= headers 200 %> +<%= json(:fetch_settings) %> + +### Example + +
+curl 'http://api_key:your-amazing-password@hostname/setup/api/settings'
+
+ +## Modify settings + + PUT /setup/api/settings + +### Parameters + +Name | Type | Description +-----|------|-------------- +`settings`|`string` | **Required**. A JSON string with the new settings. + +### Response + +
+HTTP/1.1 204 No Content
+
+ +### Example + +
+curl -X PUT 'http://api_key:your-amazing-password@hostname/setup/api/settings' --data-urlencode "settings=`cat /path/to/settings.json`"
+
+ +## Check maintenance status + +Check your installation's maintenance status: + + GET /setup/api/maintenance + +### Response + +<%= headers 200 %> +<%= json(:check_maintenance_status) %> + +### Example + +
+curl 'http://api_key:your-amazing-password@hostname/setup/api/maintenance'
+
+ +## Enable or disable maintenance mode + + POST /setup/api/maintenance + +### Parameters + +Name | Type | Description +-----|------|-------------- +`maintenance`|`string` | **Required**. A JSON string with the attributes `enabled` and `when`. + +The possible values for `enabled` are `true` and `false`. When it's `false`, +the attribute `when` is ignored and the maintenance mode is turned off. `when` defines the time period when the maintenance was enabled. + +The possible values for `when` are `now` or any date parseable by +[mojombo/chronic](https://github.com/mojombo/chronic). + +### Response + +<%= headers 200 %> +<%= json(:set_maintenance_status) %> + +### Example + +
+curl -X POST 'http://api_key:your-amazing-password@hostname/setup/api/maintenance' -d 'maintenance={"enabled":true, "when":"now"}'
+
+ +## Retrieve authorized SSH keys + + GET /setup/api/settings/authorized-keys + +### Response + +<%= headers 200 %> +<%= json(:get_authorized_ssh_keys) %> + +### Example + +
+curl 'http://api_key:your-amazing-password@hostname/setup/api/settings/authorized-keys'
+
+ +## Add a new authorized SSH key + + POST /setup/api/settings/authorized-keys + +### Parameters + +Name | Type | Description +-----|------|-------------- +`authorized_key`|`string` | **Required**. The path to the public SSH key. + +### Response + +<%= headers 201 %> +<%= json(:get_authorized_ssh_keys) { |h| h.push({"key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...", "pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"}); h }%> + +### Example + +
+curl -X POST 'http://api_key:your-amazing-password@hostname/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub
+
+ +## Remove an authorized SSH key + + DELETE /setup/api/settings/authorized-keys + +### Parameters + +Name | Type | Description +-----|------|-------------- +`authorized_key`|`string` | **Required**. The path to the public SSH key. + +### Response + +<%= headers 200 %> +<%= json(:get_authorized_ssh_keys) { |h| h.shift; h } %> + +### Example + +
+curl -X DELETE 'http://api_key:your-amazing-password@hostname/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub
+
diff --git a/content/v3/enterprise/search_indexing.md b/content/v3/enterprise/search_indexing.md new file mode 100644 index 0000000000..1054d598be --- /dev/null +++ b/content/v3/enterprise/search_indexing.md @@ -0,0 +1,52 @@ +--- +title: Search Indexing | GitHub API +--- + +# Search Indexing + +* TOC +{:toc} + +The Search Indexing API allows you to queue up a variety of search indexing tasks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +
+http(s)://hostname/api/v3
+
+ +## Queue an indexing job + + POST /staff/indexing_jobs + +### Parameters + +Name | Type | Description +--------|---------|-------------- +`target`|`string` | **Required**. A string representing the item to index. + +You can index the following targets (replace `:owner` with the name of a user or organization account and `:repository` with the name of a repository): + +Target | Description +----------------------------|--------------------------------------------------------------------- +`:owner` | A user or organization account. +`:owner/:repository` | A repository. +`:owner/*` | All of a user or organization's repositories. +`:owner/:repository/issues` | All the issues in a repository. +`:owner/*/issues` | All the issues in all of a user or organization's repositories. +`:owner/:repository/code` | All the source code in a repository. +`:owner/*/code` | All the source code in all of a user or organization's repositories. + +### Response + +<%= headers 202 %> +<%= json(:indexing_success) %> + +### Example + +
+$ curl -u jwatson -X POST "http://hostname/api/v3/staff/indexing_jobs?target=jwatson%2Flaughing-robot"
+{
+  "message": "Repository \"jwatson/laughing-robot\" has been added to the indexing queue"
+}
+
diff --git a/content/v3/gists.md b/content/v3/gists.md new file mode 100644 index 0000000000..8257bb83b4 --- /dev/null +++ b/content/v3/gists.md @@ -0,0 +1,221 @@ +--- +title: Gists | GitHub API +--- + +# Gists + +* TOC +{:toc} + +## Authentication + +You can read public gists and create them for anonymous users without a token; however, to read or write gists on a user's behalf the **gist** [OAuth scope][1] is required. + + + +## Truncation + +The Gist API provides up to one megabyte of content for each file in the gist. Every call to retrieve a gist through the API has a key called `truncated`. If `truncated` is `true`, the file is too large and only a portion of the contents were returned in `content`. + +If you need the full contents of the file, you can make a `GET` request to the URL specified by `raw_url`. Be aware that for files larger than ten megabytes, you'll need to clone the gist via the URL provided by `git_pull_url`. + +## List gists + +List a user's gists: + + GET /users/:username/gists + +List the authenticated user's gists or if called anonymously, this will +return all public gists: + + GET /gists + +List all public gists: + + GET /gists/public + +List the authenticated user's starred gists: + + GET /gists/starred + +### Parameters + +Name | Type | Description +-----|------|-------------- +`since`|`string` | A timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. Only gists updated at or after this time are returned. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:gist) { |h| [h] } %> + +## Get a single gist + + GET /gists/:id + +### Response {#detailed-gist-representation} + +<%= headers 200 %> +<%= json :full_gist %> + +## Get a specific revision of a gist + + GET /gists/:id/:sha + +### Response + +<%= headers 200 %> +<%= json :full_gist_version %> + +## Create a gist + + POST /gists + +### Input + +Name | Type | Description +-----|------|-------------- +`files`|`object` | **Required**. Files that make up this gist. +`description`|`string` | A description of the gist. +`public`|`boolean` | Indicates whether the gist is public. Default: `false` + +The keys in the `files` object are the `string` filename, and the value is another `object` with a key of `content`, and a value of the file contents. For example: + +<%= json \ + :description => "the description for this gist", + :public => true, + :files => { + "file1.txt" => {"content" => "String file contents"} + } +%> + +
+

+ Note: Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally. +

+
+ +### Response + +<%= headers 201, :Location => get_resource(:full_gist)['url'] %> +<%= json :full_gist %> + +## Edit a gist + + PATCH /gists/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`description`|`string` | A description of the gist. +`files`|`object` | Files that make up this gist. +`content`|`string` | Updated file contents. +`filename`|`string` | New name for this file. + +The keys in the `files` object are the `string` filename. The value is another `object` with a key of `content` (indicating the new contents), or `filename` (indicating the new filename). For example: + +<%= json \ + :description => "the description for this gist", + :files => { + "file1.txt" => {"content" => "updated file contents"}, + "old_name.txt" => {"filename" => "new_name.txt", "content" => "modified contents"}, + "new_file.txt" => {"content" => "a new file"}, + "delete_this_file.txt" => nil, + } %> + +
+

+ Note: All files from the previous version of the gist are carried over by default if not included in the object. Deletes can be performed by including the filename with a null object. +

+
+ + +### Response + +<%= headers 200 %> +<%= json :full_gist %> + + +## List gist commits + + GET /gists/:id/commits + +### Response + +<%= headers 200, :pagination => { :next => 'https://api.github.com/resource?page=2' } %> +<%= json(:gist_history) %> + +## Star a gist + + PUT /gists/:id/star + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Unstar a gist + + DELETE /gists/:id/star + +### Response + +<%= headers 204 %> + +## Check if a gist is starred + + GET /gists/:id/star + +### Response if gist is starred + +<%= headers 204 %> + +### Response if gist is not starred + +<%= headers 404 %> + +## Fork a gist + + POST /gists/:id/forks + +
+

+ Note: This was previously /gists/:id/fork +

+
+ +### Response + +<%= headers 201, :Location => get_resource(:gist)['url'] %> +<%= json(:gist) %> + +## List gist forks + + GET /gists/:id/forks + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:gist_forks) %> + +## Delete a gist + + DELETE /gists/:id + +### Response + +<%= headers 204 %> + +[1]: /v3/oauth/#scopes + +## Custom media types + +The following media types are supported when fetching gist contents. You can read more about the +use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw + application/vnd.github.VERSION.base64 diff --git a/content/v3/gists/comments.md b/content/v3/gists/comments.md new file mode 100644 index 0000000000..cf061c82e3 --- /dev/null +++ b/content/v3/gists/comments.md @@ -0,0 +1,84 @@ +--- +title: Gist Comments | GitHub API +--- + +# Comments + +* TOC +{:toc} + +Gist Comments use [these custom media types](#custom-media-types). +You can read more about the use of media types in the API +[here](/v3/media/). + +## List comments on a gist + + GET /gists/:gist_id/comments + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:gist_comment) { |h| [h] } %> + +## Get a single comment + + GET /gists/:gist_id/comments/:id + +### Response + +<%= headers 200 %> +<%= json :gist_comment %> + +## Create a comment + + POST /gists/:gist_id/comments + +### Parameters + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The comment text. + + +<%= json :body => 'Just commenting for the sake of commenting' %> + +### Response + +<%= headers 201, :Location => get_resource(:gist_comment)['url'] %> +<%= json :gist_comment %> + +## Edit a comment + + PATCH /gists/:gist_id/comments/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The comment text. + + +<%= json :body => 'Just commenting for the sake of commenting' %> + +### Response + +<%= headers 200 %> +<%= json :gist_comment %> + +## Delete a comment + + DELETE /gists/:gist_id/comments/:id + +### Response + +<%= headers 204 %> + +## Custom media types + +These are the supported media types for gist comments. You can read more about the +use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw+json + application/vnd.github.VERSION.text+json + application/vnd.github.VERSION.html+json + application/vnd.github.VERSION.full+json diff --git a/content/v3/git.md b/content/v3/git.md new file mode 100644 index 0000000000..8259eeda3d --- /dev/null +++ b/content/v3/git.md @@ -0,0 +1,38 @@ +--- +title: Git Data | GitHub API +--- + +# Git Data + +The Git Database API gives you access to read and write raw Git objects +to your Git database on GitHub and to list and update your references +(branch heads and tags). + +This basically allows you to reimplement a lot of Git functionality over +our API - by creating raw objects directly into the database and updating +branch references you could technically do just about anything that Git +can do without having Git installed. + +Git DB API functions will return a `409 Conflict` if the git repository for a Repository is empty +or unavailable. This typically means it is being created still. [Contact +Support](https://github.com/contact?form[subject]=Commits API) if this response status persists. + +![git db](http://git-scm.com/figures/18333fig0904-tn.png) + +For more information on the Git object database, please read the +[Git Internals](http://git-scm.com/book/en/Git-Internals) chapter of +the Pro Git book. + +As an example, if you wanted to commit a change to a file in your +repository, you would: + +* get the current commit object +* retrieve the tree it points to +* retrieve the content of the blob object that tree has for that particular file path +* change the content somehow and post a new blob object with that new content, getting a blob SHA back +* post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back +* create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back +* update the reference of your branch to point to the new commit SHA + +It might seem complex, but it's actually pretty simple when you understand +the model and it opens up a ton of things you could potentially do with the API. diff --git a/content/v3/git/blobs.md b/content/v3/git/blobs.md new file mode 100644 index 0000000000..f7d005deaa --- /dev/null +++ b/content/v3/git/blobs.md @@ -0,0 +1,48 @@ +--- +title: Git Blobs | GitHub API +--- + +# Blobs + +* TOC +{:toc} + +Since blobs can be any arbitrary binary data, the input and responses +for the blob API takes an encoding parameter that can be either `utf-8` +or `base64`. If your data cannot be losslessly sent as a UTF-8 string, +you can base64 encode it. + +Blobs leverage [these custom media types](#custom-media-types). You can +read more about the use of media types in the API [here](/v3/media/). + +## Get a Blob + + GET /repos/:owner/:repo/git/blobs/:sha + +*Note*: This API supports blobs up to 100 megabytes in size. + +### Response + +<%= headers 200 %> +<%= json(:blob) %> + +## Create a Blob + + POST /repos/:owner/:repo/git/blobs + +### Input + +<%= json :content => "Content of the blob", :encoding => "utf-8" %> + +### Response + +<%= headers 201, :Location => get_resource(:blob_after_create)['url'] %> +<%= json :blob_after_create %> + +## Custom media types + +These are the supported media types for blobs. You can read more about the +use of media types in the API [here](/v3/media/). + + application/json + application/vnd.github.VERSION.raw diff --git a/content/v3/git/commits.md b/content/v3/git/commits.md new file mode 100644 index 0000000000..566450d992 --- /dev/null +++ b/content/v3/git/commits.md @@ -0,0 +1,62 @@ +--- +title: Git Commits | GitHub API +--- + +# Commits + +* TOC +{:toc} + +## Get a Commit + + GET /repos/:owner/:repo/git/commits/:sha + +### Response + +<%= headers 200 %> +<%= json :git_commit %> + +## Create a Commit + + POST /repos/:owner/:repo/git/commits + +### Parameters + +Name | Type | Description +-----|------|-------------- +`message`|`string` | **Required**. The commit message +`tree`|`string` | **Required**. The SHA of the tree object this commit points to +`parents`|`array` of `string`s| **Required**. The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided. + + +### Optional Parameters + +You can provide an additional `committer` parameter, which is an object containing +information about the committer. Or, you can provide an `author` parameter, which +is an object containing information about the author. + +The `committer` section is optional and will be filled with the `author` +data if omitted. If the `author` section is omitted, it will be filled +in with the authenticated user's information and the current date. + +Both the `author` and `committer` parameters have the same keys: + +Name | Type | Description +-----|------|------------- +`name`|`string` | The name of the author (or committer) of the commit +`email`|`string` | The email of the author (or committer) of the commit +`date`|`string` | Indicates when this commit was authored (or committed). This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + +### Example Input + +<%= json "message"=> "my commit message", \ + "author"=> \ + {"name" => "Scott Chacon", "email" => "schacon@gmail.com", \ + "date" => "2008-07-09T16:13:30+12:00"}, \ + "parents"=>["7d1b31e74ee336d15cbd21741bc88a537ed063a0"], \ + "tree"=>"827efc6d56897b048c772eb4087f854f46256132" %> + +### Response + +<%= headers 201, :Location => get_resource(:new_commit)['url'] %> +<%= json :new_commit %> diff --git a/content/v3/git/refs.md b/content/v3/git/refs.md new file mode 100644 index 0000000000..1d1313c449 --- /dev/null +++ b/content/v3/git/refs.md @@ -0,0 +1,101 @@ +--- +title: Git Refs | GitHub API +--- + +# References + +* TOC +{:toc} + +## Get a Reference + + GET /repos/:owner/:repo/git/refs/:ref + +The `ref` in the URL must be formatted as `heads/branch`, not just `branch`. For example, the call to get the data for a branch named `skunkworkz/featureA` would be: + + GET /repos/:owner/:repo/git/refs/heads/skunkworkz/featureA + +### Response + +<%= headers 200 %> +<%= json :ref %> + +## Get all References + + GET /repos/:owner/:repo/git/refs + +This will return an array of all the references on the system, including +things like notes and stashes if they exist on the server. Anything in +the namespace, not just `heads` and `tags`, though that would be the +most common. + +You can also request a sub-namespace. For example, to get all the tag +references, you can call: + + GET /repos/:owner/:repo/git/refs/tags + +For a full refs listing, you'll get something that looks like: + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :refs %> + + +## Create a Reference + + POST /repos/:owner/:repo/git/refs + +### Parameters + +Name | Type | Description +-----|------|-------------- +`ref`|`type`| The name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected. +`sha`|`type`| The SHA1 value to set this reference to + + +### Input + +<%= json "ref"=>"refs/heads/featureA",\ + "sha"=>"aa218f56b14c9653891f9e74264a383fa43fefbd" %> + +### Response + +<%= headers 201, :Location => get_resource(:ref)['url'] %> +<%= json :ref %> + +## Update a Reference + + PATCH /repos/:owner/:repo/git/refs/:ref + +### Parameters + +Name | Type | Description +-----|------|-------------- +`sha`|`type`| The SHA1 value to set this reference to +`force`|`boolean`| Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. Default: `false` + + +### Input + +<%= json "sha"=>"aa218f56b14c9653891f9e74264a383fa43fefbd",\ + "force"=>true %> + +### Response + +<%= headers 200 %> +<%= json :ref %> + +## Delete a Reference + + DELETE /repos/:owner/:repo/git/refs/:ref + +Example: Deleting a branch: + + DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a + +Example: Deleting a tag: + + DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 + +### Response + +<%= headers 204 %> diff --git a/content/v3/git/tags.md b/content/v3/git/tags.md new file mode 100644 index 0000000000..f6130f9cc8 --- /dev/null +++ b/content/v3/git/tags.md @@ -0,0 +1,66 @@ +--- +title: Git Tags | GitHub API +--- + +# Tags + +* TOC +{:toc} + +This tags API only deals with tag objects - so only annotated tags, not +lightweight tags. + +## Get a Tag + + GET /repos/:owner/:repo/git/tags/:sha + +### Response + +<%= headers 200 %> +<%= json :gittag %> + +## Create a Tag Object + +Note that creating a tag object does not create the reference that +makes a tag in Git. If you want to create an annotated tag in Git, +you have to do this call to create the tag object, and then +[create](/v3/git/refs/#create-a-reference) the `refs/tags/[tag]` reference. +If you want to create a lightweight tag, you only have to +[create](/v3/git/refs/#create-a-reference) the tag reference - this call +would be unnecessary. + + POST /repos/:owner/:repo/git/tags + +### Parameters + +Name | Type | Description +-----|------|-------------- +`tag`|`string`| The tag +`message`|`string`| The tag message +`object`|`string`| The SHA of the git object this is tagging +`type`|`string`| The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`. +`tagger`|`object`| An object with information about the individual creating the tag. + +The `tagger` object contains the following keys: + +Name | Type | Description +-----|------|-------------- +`name`|`string`| The name of the author of the tag +`email`|`string`| The email of the author of the tag +`date`|`string`| When this object was tagged. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + + +### Example Input + +<%= json "tag"=> "v0.0.1", \ + "message" => "initial version\n", \ + "object" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", \ + "type" => "commit", \ + "tagger"=> \ + {"name" => "Scott Chacon", "email" => "schacon@gmail.com", \ + "date" => "2011-06-17T14:53:35-07:00"} %> + +### Response + +<%= headers 201, :Location => get_resource(:gittag)['url'] %> +<%= json :gittag %> diff --git a/content/v3/git/trees.md b/content/v3/git/trees.md new file mode 100644 index 0000000000..dfad337e28 --- /dev/null +++ b/content/v3/git/trees.md @@ -0,0 +1,81 @@ +--- +title: Git Trees | GitHub API +--- + +# Trees + +* TOC +{:toc} + +## Get a Tree + + GET /repos/:owner/:repo/git/trees/:sha + +### Response + +<%= headers 200 %> +<%= json :tree %> + +{{#tip}} + +If `truncated` is `true`, the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, you can clone the repository and iterate over the Git data locally. + +{{/tip}} + +## Get a Tree Recursively + + GET /repos/:owner/:repo/git/trees/:sha?recursive=1 + +### Response + +<%= headers 200 %> +<%= json :tree_extra %> + + +{{#tip}} + +If `truncated` is `true`, the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. + +{{/tip}} + +## Create a Tree + +The tree creation API will take nested entries as well. If both a +tree and a nested path modifying that tree are specified, it will +overwrite the contents of that tree with the new path contents and write +a new tree out. + + POST /repos/:owner/:repo/git/trees + +### Parameters + +Name | Type | Description +-----|------|-------------- +`tree`|`array` of `object`s | **Required**. Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure +`base_tree`| `string` | The SHA1 of the tree you want to update with new data. If you don't set this, the commit will be created on top of everything; however, it will only contain your change, the rest of your files will show up as deleted. + +The `tree` parameter takes the following keys: + +Name | Type | Description +-----|------|-------------- +`path`|`string`| The file referenced in the tree +`mode`|`string`| The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink +`type`| `string`| Either `blob`, `tree`, or `commit` +`sha`|`string`| The SHA1 checksum ID of the object in the tree +`content`|`string` | The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or `tree.sha`. + + +### Input + +<%= json \ + "base_tree" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", \ + "tree"=> \ + [{"path"=>"file.rb", \ + "mode"=>"100644", \ + "type"=>"blob", \ + "sha"=>"44b4fc6d56897b048c772eb4087f854f46256132"}] %> + +### Response + +<%= headers 201, :Location => get_resource(:tree_new)['url'] %> +<%= json :tree_new %> diff --git a/content/v3/gitignore.md b/content/v3/gitignore.md new file mode 100644 index 0000000000..bdd18a6e78 --- /dev/null +++ b/content/v3/gitignore.md @@ -0,0 +1,62 @@ +--- +title: Gitignore | GitHub API +--- + +# Gitignore + +* TOC +{:toc} + +When you create a new GitHub repository via the API, you can specify a +[.gitignore template][what-is] to apply to the repository upon creation. The +.gitignore Templates API lists and fetches templates from the [GitHub .gitignore repository][templates-repo]. + +## Listing available templates + +List all templates available to pass as an option when [creating a repository][create-repo]. + + GET /gitignore/templates + +### Response + +<%= headers 200 %> +<%= json(:templates) %> + +## Get a single template + +The API also allows fetching the source of a single template. + + GET /gitignore/templates/C + +### Response + +<%= headers 200 %> +<%= json(:template) %> + +Use the raw [media type][media-type] to get the raw contents. + +<%= headers 200 %> +
+# Object files
+*.o
+
+# Libraries
+*.lib
+*.a
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+
+ +[what-is]: https://help.github.com/articles/ignoring-files +[templates-repo]: https://github.com/github/gitignore +[create-repo]: /v3/repos/#create +[media-type]: /v3/media/ diff --git a/content/v3/issues.md b/content/v3/issues.md new file mode 100644 index 0000000000..5377ea34fc --- /dev/null +++ b/content/v3/issues.md @@ -0,0 +1,156 @@ +--- +title: Issues | GitHub API +--- + +# Issues + +* TOC +{:toc} + +Issues use [these custom media types](#custom-media-types). You can +read more about the use of media types in the API [here](/v3/media/). + +## List issues + +List all issues across all the authenticated user's visible repositories +including owned repositories, member repositories, and organization +repositories: + + GET /issues + +List all issues across owned and member repositories for the authenticated user: + + GET /user/issues + +List all issues for a given organization for the authenticated user: + + GET /orgs/:org/issues + +### Parameters + +Name | Type | Description +-----|------|-------------- +`filter`|`string`| Indicates which sorts of issues to return. Can be one of:
* `assigned`: Issues assigned to you
* `created`: Issues created by you
* `mentioned`: Issues mentioning you
* `subscribed`: Issues you're subscribed to updates for
* `all`: All issues the authenticated user can see, regardless of participation or creation
Default: `assigned` +`state`|`string`| Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. Default: `open` +`labels`|`string`| A list of comma separated label names. Example: `bug,ui,@high` +`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `comments`. Default: `created` +`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc` +`since`|`string` | Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:issue) { |h| [h] } %> + +## List issues for a repository + + GET /repos/:owner/:repo/issues + +### Parameters + +Name | Type | Description +-----|------|-------------- +`milestone`|`integer` or `string`| If an `integer` is passed, it should refer to a milestone number. If the string `*` is passed, issues with any milestone are accepted. If the string `none` is passed, issues without milestones are returned. +`state`|`string`| Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. Default: `open` +`assignee`|`string`| Can be the name of a user. Pass in `none` for issues with no assigned user, and `*` for issues assigned to any user. +`creator`|`string`| The user that created the issue. +`mentioned`|`string`| A user that's mentioned in the issue. +`labels`|`string`| A list of comma separated label names. Example: `bug,ui,@high` +`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `comments`. Default: `created` +`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc` +`since`|`string` |Only issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:issue) { |h| [h] } %> + +## Get a single issue + +{{#tip}} + +**Note**: Every pull request is an issue, but not every issue is a pull request. If the issue is not a pull request, the response omits the `pull_request` attribute. + +{{/tip}} + + GET /repos/:owner/:repo/issues/:number + +### Response + +<%= headers 200 %> +<%= json :full_issue %> + +## Create an issue + +Any user with pull access to a repository can create an issue. + + POST /repos/:owner/:repo/issues + +### Parameters + +Name | Type | Description +-----|------|-------------- +`title`|`string` | **Required**. The title of the issue. +`body`|`string` | The contents of the issue. +`assignee`|`string` | Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise._ +`milestone`|`number` | Milestone to associate this issue with. _NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise._ +`labels`|`array` of `strings` | Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._ + +#### Example + +<%= json \ + :title => "Found a bug", + :body => "I'm having a problem with this.", + :assignee => "octocat", + :milestone => 1, + :labels => %w(Label1 Label2) +%> + +### Response + +<%= headers 201, :Location => get_resource(:full_issue)['url'] %> +<%= json :full_issue %> + +## Edit an issue + +Issue owners and users with push access can edit an issue. + + PATCH /repos/:owner/:repo/issues/:number + +### Parameters + +Name | Type | Description +-----|------|-------------- +`title`|`string` | The title of the issue. +`body`|`string` | The contents of the issue. +`assignee`|`string` | Login for the user that this issue should be assigned to. +`state`|`string` | State of the issue. Either `open` or `closed`. +`milestone`|`number` | Milestone to associate this issue with. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._ +`labels`|`array` of `strings` | Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (`[]`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._ + + +#### Example + +<%= json \ + :title => "Found a bug", + :body => "I'm having a problem with this.", + :assignee => "octocat", + :milestone => 1, + :state => "open", + :labels => %w(Label1 Label2) +%> + +### Response + +<%= headers 200 %> +<%= json :full_issue %> + +## Custom media types + +These are the supported media types for issues. You can read more about the +use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw+json + application/vnd.github.VERSION.text+json + application/vnd.github.VERSION.html+json + application/vnd.github.VERSION.full+json diff --git a/content/v3/issues/assignees.md b/content/v3/issues/assignees.md new file mode 100644 index 0000000000..d78b455be0 --- /dev/null +++ b/content/v3/issues/assignees.md @@ -0,0 +1,37 @@ +--- +title: Issue Assignees | GitHub API +--- + +# Assignees + +* TOC +{:toc} + +## List assignees + +This call lists all the available assignees (owner + collaborators) to which +issues may be assigned. + + GET /repos/:owner/:repo/assignees + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## Check assignee + +You may also check to see if a particular user is an assignee for a repository. + + GET /repos/:owner/:repo/assignees/:assignee + +### Response + +If the given `assignee` login belongs to an assignee for the repository, a +`204` header with no content is returned. + +<%= headers 204 %> + +Otherwise a `404` status code is returned. + +<%= headers 404 %> diff --git a/content/v3/issues/comments.md b/content/v3/issues/comments.md new file mode 100644 index 0000000000..81d5ff26ac --- /dev/null +++ b/content/v3/issues/comments.md @@ -0,0 +1,107 @@ +--- +title: Issue Comments | GitHub API +--- + +# Comments + +* TOC +{:toc} + +The Issue Comments API supports listing, viewing, editing, and creating +comments on issues and pull requests. + +Issue Comments use [these custom media types](#custom-media-types). +You can read more about the use of media types in the API +[here](/v3/media/). + +## List comments on an issue + + GET /repos/:owner/:repo/issues/:number/comments + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:issue_comment) { |h| [h] } %> + +## List comments in a repository + + GET /repos/:owner/:repo/issues/comments + +By default, Issue Comments are ordered by ascending ID. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`sort`|`string` | Either `created` or `updated`. Default: `created` +`direction`|`string` | Either `asc` or `desc`. Ignored without the `sort` parameter. +`since`|`string` | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + + +### Response + +<%= headers 200 %> +<%= json(:issue_comment) { |h| [h] } %> + +## Get a single comment + + GET /repos/:owner/:repo/issues/comments/:id + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :issue_comment %> + +## Create a comment + + POST /repos/:owner/:repo/issues/:number/comments + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The contents of the comment. + + +<%= json :body => "Me too" %> + +### Response + +<%= headers 201, :Location => get_resource(:issue_comment)['url'] %> +<%= json :issue_comment %> + +## Edit a comment + + PATCH /repos/:owner/:repo/issues/comments/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The contents of the comment. + + +<%= json :body => "Me too" %> + +### Response + +<%= headers 200 %> +<%= json :issue_comment %> + +## Delete a comment + + DELETE /repos/:owner/:repo/issues/comments/:id + +### Response + +<%= headers 204 %> + +## Custom media types + +These are the supported media types for issue comments. You can read more +about the use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw+json + application/vnd.github.VERSION.text+json + application/vnd.github.VERSION.html+json + application/vnd.github.VERSION.full+json diff --git a/content/v3/issues/events.md b/content/v3/issues/events.md new file mode 100644 index 0000000000..256961717e --- /dev/null +++ b/content/v3/issues/events.md @@ -0,0 +1,133 @@ +--- +title: Issue Events | GitHub API +--- + +# Events + +* TOC +{:toc} + +Records various events that occur around an Issue or Pull Request. This is +useful both for display on issue/pull request information pages and also to +determine who should be notified of comments. + +### Attributes + +id +: The Integer ID of the event. + +url +: The API URL for fetching the event. + +actor +: Always the User that generated the event. + +commit_id +: The String SHA of a commit that referenced this Issue + +event +: Identifies the actual type of Event that occurred. + +created_at +: The timestamp indicating when the event occurred. + +label +: The Label object including 'name' and 'color' attributes. Only provided for 'labeled' + and 'unlabeled' events. + +assignee +: The User object which was assigned to (or unassigned from) this Issue. Only provided for 'assigned' + and 'unassigned' events. + +milestone +: The Milestone object including a 'title' attribute. Only provided for 'milestoned' and + 'demilestoned' events. + +rename: +: An object containing rename details including 'from' and 'to' attributes. Only + provided for 'renamed' events. + +### Events + +closed +: The issue was closed by the actor. When the commit_id is present, it + identifies the commit that closed the issue using "closes / fixes #NN" + syntax. + +reopened +: The issue was reopened by the actor. + +subscribed +: The actor subscribed to receive notifications for an issue. + +merged +: The issue was merged by the actor. The `commit_id` attribute is the SHA1 of + the HEAD commit that was merged. + +referenced +: The issue was referenced from a commit message. The `commit_id` attribute is + the commit SHA1 of where that happened. + +mentioned +: The actor was @mentioned in an issue body. + +assigned +: The issue was assigned to the actor. + +unassigned +: The actor was unassigned from the issue. + +labeled +: A label was added to the issue. + +unlabeled +: A label was removed from the issue. + +milestoned +: The issue was added to a milestone. + +demilestoned +: The issue was removed from a milestone. + +renamed +: The issue title was changed. + +locked +: The issue was locked by the actor. + +unlocked +: The issue was unlocked by the actor. + +head_ref_deleted +: The pull request's branch was deleted. + +head_ref_restored +: The pull request's branch was restored. + +## List events for an issue + + GET /repos/:owner/:repo/issues/:issue_number/events + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:issue_event) { |h| [h] } %> + +## List events for a repository + + GET /repos/:owner/:repo/issues/events + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:full_issue_event) { |h| [h] } %> + +## Get a single event + + GET /repos/:owner/:repo/issues/events/:id + +### Response + +<%= headers 200 %> +<%= json :full_issue_event %> + diff --git a/content/v3/issues/labels.md b/content/v3/issues/labels.md new file mode 100644 index 0000000000..5612ed655a --- /dev/null +++ b/content/v3/issues/labels.md @@ -0,0 +1,134 @@ +--- +title: Issue Labels | GitHub API +--- + +# Labels + +* TOC +{:toc} + +## List all labels for this repository + + GET /repos/:owner/:repo/labels + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:label) { |h| [h] } %> + +## Get a single label + + GET /repos/:owner/:repo/labels/:name + +### Response + +<%= headers 200 %> +<%= json :label %> + +## Create a label + + POST /repos/:owner/:repo/labels + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the label. +`color`|`string` |**Required**. A 6 character hex code, without the leading `#`, identifying the color. + + +<%= json :name => "bug", :color => "f29513" %> + +### Response + +<%= headers 201, :Location => get_resource(:label)['url'] %> +<%= json :label %> + +## Update a label + + PATCH /repos/:owner/:repo/labels/:name + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the label. +`color`|`string` |**Required**. A 6 character hex code, without the leading `#`, identifying the color. + + +<%= json :name => "bug", :color => "f29513" %> + +### Response + +<%= headers 200 %> +<%= json :label %> + +## Delete a label + + DELETE /repos/:owner/:repo/labels/:name + +### Response + +<%= headers 204 %> + +## List labels on an issue + + GET /repos/:owner/:repo/issues/:number/labels + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:label) { |h| [h] } %> + +## Add labels to an issue + + POST /repos/:owner/:repo/issues/:number/labels + +### Input + +<%= json({:array => %w(Label1 Label2)}) { |h| h['array'] } %> + +### Response + +<%= headers 200 %> +<%= json(:label) { |h| [h] } %> + +## Remove a label from an issue + + DELETE /repos/:owner/:repo/issues/:number/labels/:name + +### Response + +<%= headers 204 %> + +## Replace all labels for an issue + + PUT /repos/:owner/:repo/issues/:number/labels + +### Input + +<%= json(:array => %w(Label1 Label2)) { |h| h['array'] } %> + +Sending an empty array (`[]`) will remove all Labels from the Issue. + +### Response + +<%= headers 200 %> +<%= json(:label) { |h| [h] } %> + +## Remove all labels from an issue + + DELETE /repos/:owner/:repo/issues/:number/labels + +### Response + +<%= headers 204 %> + +## Get labels for every issue in a milestone + + GET /repos/:owner/:repo/milestones/:number/labels + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:label) { |h| [h] } %> diff --git a/content/v3/issues/milestones.md b/content/v3/issues/milestones.md new file mode 100644 index 0000000000..c3a98d85a3 --- /dev/null +++ b/content/v3/issues/milestones.md @@ -0,0 +1,97 @@ +--- +title: Issue Milestones | GitHub API +--- + +# Milestones + +* TOC +{:toc} + +## List milestones for a repository + + GET /repos/:owner/:repo/milestones + +### Parameters + +Name | Type | Description +-----|------|-------------- +`state`|`string` | The state of the milestone. Either `open`, `closed`, or `all`. Default: `open` +`sort`|`string` | What to sort results by. Either `due_date` or `completeness`. Default: `due_date` +`direction`|`string` | The direction of the sort. Either `asc` or `desc`. Default: `asc` + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:milestone) { |h| [h] } %> + +## Get a single milestone + + GET /repos/:owner/:repo/milestones/:number + +### Response + +<%= headers 200 %> +<%= json :milestone %> + +## Create a milestone + + POST /repos/:owner/:repo/milestones + +### Input + +Name | Type | Description +-----|------|--------------- +`title`|`string` | **Required**. The title of the milestone. +`state`|`string` | The state of the milestone. Either `open` or `closed`. Default: `open` +`description`|`string` | A description of the milestone. +`due_on`|`string` | The milestone due date. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + +#### Example + +<%= json \ + :title => "v1.0", + :state => "open", + :description => "Tracking milestone for version 1.0", + :due_on => "2012-10-09T23:39:01Z" +%> + +### Response + +<%= headers 201, :Location => get_resource(:milestone)['url'] %> +<%= json :milestone %> + +## Update a milestone + + PATCH /repos/:owner/:repo/milestones/:number + +### Input + +Name | Type | Description +-----|------|--------------- +`title`|`string` | The title of the milestone. +`state`|`string` | The state of the milestone. Either `open` or `closed`. Default: `open` +`description`|`string` | A description of the milestone. +`due_on`|`string` | The milestone due date. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + +#### Example + +<%= json \ + :title => "v1.0", + :state => "open", + :description => "Tracking milestone for version 1.0", + :due_on => "2012-10-09T23:39:01Z" +%> + +### Response + +<%= headers 200 %> +<%= json :milestone %> + +## Delete a milestone + + DELETE /repos/:owner/:repo/milestones/:number + +### Response + +<%= headers 204 %> diff --git a/content/v3/licenses.md b/content/v3/licenses.md new file mode 100644 index 0000000000..84468b27c4 --- /dev/null +++ b/content/v3/licenses.md @@ -0,0 +1,63 @@ +--- +title: Licenses | GitHub API +--- + +# Licenses + +* TOC +{:toc} + +{{#tip}} + + + + The Licenses API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](https://github.com/blog/1964-open-source-license-usage-on-github-com) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.drax-preview+json + +{{/tip}} + +The Licenses API returns metadata about popular open source licenses and information about a particular project's license file. The license key and name conforms to the [SPDX specification](https://spdx.org/). + +{{#warning}} + +GitHub is a lot of things, but it’s not a law firm. As such, GitHub does not provide legal advice. Using the Licenses API or sending us an email about it does not constitute legal advice nor does it create an attorney-client relationship. If you have any questions about what you can and can't do with a particular license, you should consult with your own legal counsel before moving forward. In fact, you should always consult with your own lawyer before making any decisions that might have legal ramifications or that may impact your legal rights. + +GitHub created the License API to help users get information about open source licenses and the projects that use them. We hope it helps, but please keep in mind that we’re not lawyers (at least not most of us aren't) and that we make mistakes like everyone else. For that reason, GitHub provides the API on an “as-is” basis and makes no warranties regarding any information or licenses provided on or through it, and disclaims liability for damages resulting from using the API. + +{{/warning}} + +## List all licenses + + GET /licenses + +### Response + +<%= headers 200 %> +<%= json(:licenses) %> + +## Get an individual license + + GET /licenses/mit + +### Response + +<%= headers 200 %> +<%= json(:mit) %> + +## Get a repository's license + +When passed the preview media type, requests to get a repository will also return the repository's license, if it can be detected from the repository's license file. + +It's important to note that the API simply attempts to identity the project's license by the contents of the a `LICENSE` file, if any, and does not take into account the licenses of project dependencies or other means of documenting a project's license such as references in the documentation. + + GET /repos/:owner/:repo + +### Response + +<%= headers 200 %> +<%= json(:licensee) %> diff --git a/content/v3/markdown.md b/content/v3/markdown.md new file mode 100644 index 0000000000..11e74030db --- /dev/null +++ b/content/v3/markdown.md @@ -0,0 +1,48 @@ +--- +title: Markdown | GitHub API +--- + +# Markdown + +* TOC +{:toc} + +## Render an arbitrary Markdown document + + POST /markdown + +### Parameters + +Name | Type | Description +-----|------|--------------- +`text`|`string` | **Required**.The Markdown text to render +`mode`|`string` | The rendering mode. Can be either:
* `markdown` to render a document as plain Markdown, just like README files are rendered.
* `gfm` to render a document as user-content, _e.g._ like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.
Default: `markdown` +`context`|`string` | The repository context. Only taken into account when rendering as `gfm` + +#### Example + +<%= json \ + :text => "Hello world github/linguist#1 **cool**, and #1!", + :mode => "gfm", + :context => "github/gollum" +%> + +### Response + +<%= text_html \ + %(

Hello world github/linguist#1 cool, and #1!

), 200 +%> + +## Render a Markdown document in raw mode + + POST /markdown/raw + +### Parameters + +The raw API is not JSON-based. It takes a Markdown document as plaintext (`text/plain` or `text/x-markdown`) and renders it as plain Markdown without a repository context (just like a README.md file is rendered -- this is the simplest way to preview a readme online). + +### Response + +<%= text_html \ + %(

Hello world github/linguist#1 cool, and #1!

), 200 +%> diff --git a/content/v3/media.md b/content/v3/media.md new file mode 100644 index 0000000000..58adf32c95 --- /dev/null +++ b/content/v3/media.md @@ -0,0 +1,159 @@ +--- +title: Media Types | GitHub API +--- +# Media Types + +* TOC +{:toc} + +Custom media types are used in the API to let consumers choose the format +of the data they wish to receive. This is done by adding one or more of +the following types to the `Accept` header when you make a request. Media types +are specific to resources, allowing them to change independently and support +formats that other resources don't. + +All GitHub media types look like this: + + application/vnd.github[.version].param[+json] + +The most basic media types the API supports are: + + application/json + application/vnd.github+json + +Neither of these specify a [version][versions], so you will always get the +current default JSON representation of resources. + +
+

+ Important: The default version of the API may change in the + future. If you're building an application and care about the stability of + the API, be sure to request a specific version in the Accept + header as shown in the examples below. +

+
+ +You can specify a version like so: + + application/vnd.github.v3+json + +If you're specifying a property (such as full/raw/etc defined below), +put the version before the property: + + application/vnd.github.v3.raw+json + +You can check the current version through every response's headers. Look +for the `X-GitHub-Media-Type` header: + + $ curl https://api.github.com/users/technoweenie -I + HTTP/1.1 200 OK + X-GitHub-Media-Type: github.v3 + + $ curl https://api.github.com/users/technoweenie -I \ + -H "Accept: application/vnd.github.full+json" + HTTP/1.1 200 OK + X-GitHub-Media-Type: github.v3; param=full; format=json + + $ curl https://api.github.com/users/technoweenie -I \ + -H "Accept: application/vnd.github.v3.full+json" + HTTP/1.1 200 OK + X-GitHub-Media-Type: github.v3; param=full; format=json + +## Comment Body Properties + +The body of a comment can be written in [GitHub Flavored Markdown][gfm]. +Issues, Issue Comments, Pull Request Comments, and Gist Comments all +accept these same media types: + +### Raw + + application/vnd.github.VERSION.raw+json + +Return the raw markdown body. Response will include `body`. This is the +default if you do not pass any specific media type. + +### Text + + application/vnd.github.VERSION.text+json + +Return a text only representation of the markdown body. Response will +include `body_text`. + +### HTML + + application/vnd.github.VERSION.html+json + +Return HTML rendered from the body's markdown. Response will include +`body_html`. + +### Full + + application/vnd.github.VERSION.full+json + +Return raw, text and HTML representations. Response will include `body`, +`body_text`, and `body_html`: + +## Git Blob Properties + +The following media types are allowed when getting a blob: + +### JSON + + application/vnd.github.VERSION+json + application/json + +Return JSON representation of the blob with `content` as a base64 +encoded string. This is the default if nothing is passed. + +### Raw + + application/vnd.github.VERSION.raw + +Return the raw blob data. + +## Commits, Commit comparison, and Pull Requests + +The Commit, Commit Comparison, and Pull Request resources support +[diff][git-diff] and [patch][git-patch] formats: + +### diff + + application/vnd.github.VERSION.diff + +### patch + + application/vnd.github.VERSION.patch + +## Repository contents + +### Raw + + application/vnd.github.VERSION.raw + +Return the raw contents of a file. This is the default if you do not pass any specific media type. + +### HTML + + application/vnd.github.VERSION.html + +For markup files such as Markdown or AsciiDoc, you can retrieve the rendered HTML using the `.html` media type. Markup languages are rendered to HTML using our open-source [Markup library](https://github.com/github/markup). + +## Gists + +### Raw + + application/vnd.github.VERSION.raw + +Return the raw contents of a gist. This is the default if you do not pass any specific media type. + +### base64 + + application/vnd.github.VERSION.base64 + +The gist contents are base64-encoded before being sent out. This can be useful if your gist contains any invalid UTF-8 sequences. + +[gfm]:http://github.github.com/github-flavored-markdown/ +[git-diff]: http://git-scm.com/docs/git-diff +[git-patch]: http://git-scm.com/docs/git-format-patch +[hypermedia]: /v3/#hypermedia +[versions]: /v3/versions diff --git a/content/v3/meta.md b/content/v3/meta.md new file mode 100644 index 0000000000..5d8755aa96 --- /dev/null +++ b/content/v3/meta.md @@ -0,0 +1,24 @@ +--- +title: Meta | GitHub API +--- + +# Meta + +This endpoint provides information about GitHub.com, the service. +Or, if you access this endpoint on your organization's [GitHub Enterprise](https://enterprise.github.com/) installation, this endpoint provides information about that installation. + + GET /meta + +### Response + +<%= headers 200 %> +<%= json :meta %> + +### Body + +Name | Type | Description +-----|------|-------------- +`hooks`|`array` of `strings` | An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from on GitHub.com. Subscribe to the [API Changes blog](https://developer.github.com/changes/) or follow [@GitHubAPI](https://twitter.com/GitHubAPI) on Twitter to get updated when this list changes. +`git`|`array` of `strings` | An Array of IP addresses in CIDR format specifying the Git servers for GitHub.com. +`verifiable_password_authentication`|`boolean` | Whether authentication with username and password is supported. (GitHub Enterprise instances using CAS or OAuth for authentication will return `false`. Features like [Basic Authentication with a username and password](/v3/auth/#via-username-and-password), [sudo mode](https://help.github.com/articles/sudo-mode), and [two-factor authentication](https://help.github.com/articles/about-two-factor-authentication) are not supported on these servers.) +`github_services_sha` | `string` | The currently-deployed SHA of [`github-services`](https://github.com/github/github-services). diff --git a/content/v3/misc.md b/content/v3/misc.md new file mode 100644 index 0000000000..27c8a4b1c9 --- /dev/null +++ b/content/v3/misc.md @@ -0,0 +1,42 @@ +--- +title: Miscellaneous | GitHub API +--- + +# Miscellaneous + +This is a miscellaneous set of APIs which provide access to top level GitHub resources and info. + +## [Emojis][] + +The [Emojis API][Emojis] lets you list all the emojis available to use on +GitHub. + +## [Gitignore][] + +The [Gitignore API][Gitignore] gives you access to the available gitignore +templates. + +## [Markdown][] + +The [Markdown API][Markdown] lets you render Markdown documents. + +## [Meta][] + +The [Meta API][Meta] provides information about GitHub.com (the service) or your +organization's [GitHub Enterprise](https://enterprise.github.com/) installation. + +## [Rate Limit][] + +The [Rate Limit API][Rate Limit] lets you check your current rate limit +status at any time. + +## [Licenses][] + +The [Licenses API][Licenses] returns information about open source licenses or under what license, if any a given project is distributed. + +[Emojis]: /v3/emojis +[Gitignore]: /v3/gitignore +[Markdown]: /v3/markdown +[Meta]: /v3/meta +[Rate Limit]: /v3/rate_limit +[Licenses]: /v3/licenses diff --git a/content/v3/oauth.md b/content/v3/oauth.md new file mode 100644 index 0000000000..e393e885a5 --- /dev/null +++ b/content/v3/oauth.md @@ -0,0 +1,328 @@ +--- +title: OAuth | GitHub API +--- + +# OAuth + +* TOC +{:toc} + +OAuth2 is a protocol that lets external apps request authorization to +private details in a user's GitHub account without getting their +password. This is preferred over [Basic Authentication](/v3/auth#basic-authentication) because tokens can +be limited to specific types of data, and can be revoked by users at any +time. + +All developers need to [register their +application](https://github.com/settings/applications/new) before getting +started. A registered OAuth application is assigned a unique Client ID +and Client Secret. The Client Secret should not be shared. + +## Web Application Flow + +This is a description of the OAuth2 flow from 3rd party web sites. + +### 1. Redirect users to request GitHub access + + GET https://github.com/login/oauth/authorize + +### Parameters + +Name | Type | Description +-----|------|-------------- +`client_id`|`string` | **Required**. The client ID you received from GitHub when you [registered](https://github.com/settings/applications/new). +`redirect_uri`|`string` | The URL in your app where users will be sent after authorization. See details below about [redirect urls](#redirect-urls). +`scope`|`string` | A comma separated list of [scopes](#scopes). If not provided, `scope` defaults to an empty list of scopes for users that don't have a valid token for the app. For users who do already have a valid token for the app, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the same scopes that were used last time the user completed the flow. +`state`|`string` | An unguessable random string. It is used to protect against cross-site request forgery attacks. + +### 2. GitHub redirects back to your site + +If the user accepts your request, GitHub redirects back to your site +with a temporary code in a `code` parameter as well as the state you provided in +the previous step in a `state` parameter. If the states don't match, the request +has been created by a third party and the process should be aborted. + +Exchange this for an access token: + + POST https://github.com/login/oauth/access_token + +### Parameters + +Name | Type | Description +-----|------|--------------- +`client_id`|`string` | **Required**. The client ID you received from GitHub when you [registered](https://github.com/settings/applications/new). +`client_secret`|`string` | **Required**. The client secret you received from GitHub when you [registered](https://github.com/settings/applications/new). +`code`|`string` | **Required**. The code you received as a response to [Step 1](#redirect-users-to-request-github-access). +`redirect_uri`|`string` | The URL in your app where users will be sent after authorization. See details below about [redirect urls](#redirect-urls). + +### Response + +By default, the response will take the following form: + + access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer + +You can also receive the content in different formats depending on the Accept +header: + + Accept: application/json + {"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a", "scope":"repo,gist", "token_type":"bearer"} + + Accept: application/xml + + bearer + repo,gist + e72e16c7e42f292c6912e7710c838347ae178b4a + + + +#### Requested scopes vs. granted scopes + +The `scope` attribute lists scopes attached to the token that were granted by +the user. Normally, these scopes will be identical to what you requested. +However, users [will soon be able to edit their scopes][oauth changes blog], effectively +granting your application less access than you originally requested. Also, users +will also be able to edit token scopes after the OAuth flow completed. +You should be aware of this possibility and adjust your application's behavior +accordingly. + +It is important to handle error cases where a user chooses to grant you +less access than you originally requested. For example, applications can warn +or otherwise communicate with their users that they will see reduced +functionality or be unable to perform some actions. + +Also, applications can always send users back through the flow again to get +additional permission, but don’t forget that users can always say no. + +Check out the [Basics of Authentication guide][basics auth guide] which +provides tips on handling modifiable token scopes. + +#### Normalized scopes + +When requesting multiple scopes, the token will be saved with a normalized list +of scopes, discarding those that are implicitly included by another requested +scope. For example, requesting `user,gist,user:email` will result in a +token with `user` and `gist` scopes only since the access granted with +`user:email` scope [is included](#scopes) in the `user` scope. + +### 3. Use the access token to access the API + +The access token allows you to make requests to the API on a behalf of a user. + + GET https://api.github.com/user?access_token=... + +You can pass the token in the query params like shown above, but a +cleaner approach is to include it in the Authorization header + + Authorization: token OAUTH-TOKEN + +For example, in curl you can set the Authorization header like this: + + curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/user + +## Non-Web Application Flow + +Use [Basic Authentication](/v3/auth#basic-authentication) to create an OAuth2 +token using the [interface below](/v3/oauth_authorizations/#create-a-new-authorization). With +this technique, a username and password need not be stored permanently, and the +user can revoke access at any time. (Make sure to understand how to [work with +two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if +you or your users have two-factor authentication enabled.) + +## Redirect URLs + +The `redirect_uri` parameter is optional. If left out, GitHub will +redirect users to the callback URL configured in the OAuth Application +settings. If provided, the redirect URL's host and port must exactly +match the callback URL. The redirect URL's path must reference a +subdirectory of the callback URL. + + CALLBACK: http://example.com/path + + GOOD: http://example.com/path + GOOD: http://example.com/path/subdir/other + BAD: http://example.com/bar + BAD: http://example.com/ + BAD: http://example.com:8080/path + BAD: http://oauth.example.com:8080/path + BAD: http://example.org + +## Scopes + +Scopes let you specify exactly what type of access you need. Scopes _limit_ +access for OAuth tokens. They do not grant any additional permission beyond +that which the user already has. + +For the web flow, requested scopes will be displayed to the user on the +authorize form. + +Check headers to see what OAuth scopes you have, and what the API action +accepts. + + $ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/users/technoweenie -I + HTTP/1.1 200 OK + X-OAuth-Scopes: repo, user + X-Accepted-OAuth-Scopes: user + +`X-OAuth-Scopes` lists the scopes your token has authorized. +`X-Accepted-OAuth-Scopes` lists the scopes that the action checks for. + + +Name | Description +-----|-----------| +`(no scope)`| Grants read-only access to public information (includes public user profile info, public repository info, and gists) +`user` | Grants read/write access to profile info only. Note that this scope includes `user:email` and `user:follow`. +`user:email`| Grants read access to a user's email addresses. +`user:follow`| Grants access to follow or unfollow other users. +`public_repo`| Grants read/write access to code, commit statuses, and deployment statuses for public repositories and organizations. Also required for starring public repositories. +`repo`| Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations. +`repo_deployment`| Grants access to [deployment statuses][deployments] for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, *without* granting access to the code. +`repo:status`| Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses *without* granting access to the code. +`delete_repo`| Grants access to delete adminable repositories. +`notifications`| Grants read access to a user's notifications. `repo` also provides this access. +`gist`| Grants write access to gists. +`read:repo_hook`| Grants read and ping access to hooks in public or private repositories. +`write:repo_hook`| Grants read, write, and ping access to hooks in public or private repositories. +`admin:repo_hook`| Grants read, write, ping, and delete access to hooks in public or private repositories. +`admin:org_hook`| Grants read, write, ping, and delete access to organization hooks. **Note:** OAuth tokens will only be able to perform these actions on organization hooks which were created by the OAuth application. Personal access tokens will only be able to perform these actions on organization hooks created by a user. +`read:org`| Read-only access to organization, teams, and membership. +`write:org`| Publicize and unpublicize organization membership. +`admin:org`| Fully manage organization, teams, and memberships. +`read:public_key`| List and view details for public keys. +`write:public_key`| Create, list, and view details for public keys. +`admin:public_key`| Fully manage public keys. + +NOTE: Your application can request the scopes in the initial redirection. You +can specify multiple scopes by separating them with a comma: + + https://github.com/login/oauth/authorize? + client_id=...& + scope=user,public_repo + +## Common errors for the authorization request + +There are a few things that can go wrong in the process of obtaining an +OAuth token for a user. In the initial authorization request phase, +these are some errors you might see: + +### Application Suspended + +If the OAuth application you set up has been suspended (due to reported +abuse, spam, or a mis-use of the API), GitHub will redirect to the +registered callback URL with the following parameters summarizing the +error: + + http://your-application.com/callback?error=application_suspended + &error_description=Your+application+has+been+suspended.+Contact+support@github.com. + &error_uri=https://developer.github.com/v3/oauth/%23application-suspended + &state=xyz + +Please contact [support](https://github.com/contact) to solve issues +with suspended applications. + +### Redirect URI mismatch + +If you provide a redirect_uri that doesn't match what you've registered +with your application, GitHub will redirect to the registered callback +URL with the following parameters summarizing the error: + + http://your-application.com/callback?error=redirect_uri_mismatch + &error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application. + &error_uri=https://developer.github.com/v3/oauth/%23redirect-uri-mismatch + &state=xyz + +To correct this error, either provide a redirect_uri that matches what +you registered or leave out this parameter to use the default one +registered with your application. + +### Access denied + +If the user rejects access to your application, GitHub will redirect to +the registered callback URL with the following parameters summarizing +the error: + + http://your-application.com/callback?error=access_denied + &error_description=The+user+has+denied+your+application+access. + &error_uri=https://developer.github.com/v3/oauth/%23access-denied + &state=xyz + +There's nothing you can do here as users are free to choose not to use +your application. More often than not, users will just close the window +or press back in their browser, so it is likely that you'll never see +this error. + +## Common errors for the access token request + +In the second phase of exchanging a code for an access token, there are +an additional set of errors that can occur. The format of these +responses is determined by the accept header you pass. The following +examples only show JSON responses. + +### Incorrect client credentials + +If the client\_id and or client\_secret you pass are incorrect you will +receive this error response. + +<%= json :error => :incorrect_client_credentials, + :error_description => "The client_id and/or client_secret passed are incorrect.", + :error_uri => "https://developer.github.com/v3/oauth/#incorrect-client-credentials" +%> + +To solve this error, go back and make sure you have the correct +credentials for your oauth application. Double check the `client_id` and +`client_secret` to make sure they are correct and being passed correctly +to GitHub. + +### Redirect URI mismatch(2) + +If you provide a redirect_uri that doesn't match what you've registered +with your application, you will receive this error message: + +<%= json :error => :redirect_uri_mismatch, + :error_description => "The redirect_uri MUST match the registered callback URL for this application.", + :error_uri => "https://developer.github.com/v3/oauth/#redirect-uri-mismatch(2)" +%> + +To correct this error, either provide a redirect_uri that matches what +you registered or leave out this parameter to use the default one +registered with your application. + +### Bad verification code + +<%= json :add_scopes => ['repo'], :note => 'admin script' %> + +If the verification code you pass is incorrect, expired, or doesn't +match what you received in the first request for authorization you will +receive this error. + +<%= json :error => :bad_verification_code, + :error_description => "The code passed is incorrect or expired.", + :error_uri => "https://developer.github.com/v3/oauth/#bad-verification-code" +%> + +To solve this error, start the [OAuth process over from the beginning](#redirect-users-to-request-github-access) +and get a new code. + +## Directing users to review their access for an application + +Users can review and revoke their application authorizations from the [settings +screen within GitHub][authorized-apps]. A user's organizations [control whether +an application can access organization data][org-app-policies]. Integrators can +deep link to the authorization information for their particular app to let their +end users review these details. + +To build this link, you'll need your OAuth application's `client_id` you +received from GitHub when you [registered the application][owned-apps]. + + https://github.com/settings/connections/applications/:client_id + +For tips on discovering the resources that your application can access for a +user, be sure to check out our [guide][resource-discovery-guide]. + +[oauth changes blog]: /changes/2013-10-04-oauth-changes-coming/ +[basics auth guide]: /guides/basics-of-authentication/ +[deployments]: /v3/repos/deployments +[public keys]: /v3/users/keys/ +[authorized-apps]: https://github.com/settings/applications#authorized +[owned-apps]: https://github.com/settings/applications +[org-app-policies]: /changes/2015-01-19-an-integrators-guide-to-organization-application-policies/ +[resource-discovery-guide]: /guides/discovering-resources-for-a-user/ diff --git a/content/v3/oauth_authorizations.md b/content/v3/oauth_authorizations.md new file mode 100644 index 0000000000..d4e5731e45 --- /dev/null +++ b/content/v3/oauth_authorizations.md @@ -0,0 +1,278 @@ +--- +title: Authorizations | GitHub API +--- + +# OAuth Authorizations API + +* TOC +{:toc} + +You can use this API to manage your OAuth applications. You can only access this API via [Basic Authentication](/v3/auth#basic-authentication) using your username and password, not tokens. + +Make sure you understand how to [work with two-factor authentication](/v3/auth/#working-with-two-factor-authentication) if you or your users have two-factor authentication enabled. + +
+

Deprecation Notice

+ +

+ The token attribute is deprecated in all + of the following OAuth Authorizations API responses: +

+ + + +

+ We're currently offering a migration period allowing applications to opt in to the new Authorization API behavior. This functionality will apply to all API consumers beginning April 20, 2015. Please see the blog post for full details. +

+ +

+ In order to reduce the impact of removing the token attribute, + the OAuth Authorizations API has added a new request attribute + (fingerprint), added three new response attributes + (token_last_eight, hashed_token, and + fingerprint), and added + one new API. +

+ +

+ To access the new API functionality during the migration period, you must + provide a custom media type in the + Accept header: +

application/vnd.github.mirage-preview+json
+

+
+ +## List your authorizations + + GET /authorizations + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:oauth_access) { |h| [h.merge("token" => "")] } %> + +## Get a single authorization + + GET /authorizations/:id + +### Response + +<%= headers 200 %> +<%= json(:oauth_access) { |h| h.merge("token" => "") } %> + +## Create a new authorization + +If you need a small number of tokens, implementing the [web flow](/v3/oauth/#web-application-flow) +can be cumbersome. Instead, tokens can be created using the OAuth Authorizations API using +[Basic Authentication](/v3/auth#basic-authentication). To create tokens for a particular OAuth application, you +must provide its client ID and secret, found on the OAuth application settings +page, linked from your [OAuth applications listing on GitHub][app-listing]. If your OAuth application intends to create multiple tokens for one user you should use `fingerprint` to differentiate between them. OAuth tokens +can also be created through the web UI via the [Application settings page][app-listing]. +Read more about these tokens on the [GitHub Help page](https://help.github.com/articles/creating-an-access-token-for-command-line-use). + + POST /authorizations + +### Parameters + +Name | Type | Description +-----|------|-------------- +`scopes`|`array` | A list of scopes that this authorization is in. +`note`|`string` | **Required**. A note to remind you what the OAuth token is for. +`note_url`|`string` | A URL to remind you what app the OAuth token is for. +`client_id`|`string` | The 20 character OAuth app client key for which to create the token. +`client_secret`|`string` | The 40 character OAuth app client secret for which to create the token. +`fingerprint`|`string` | **This attribute is only available when using the [mirage-preview](#deprecation-notice) media type.** A unique string to distinguish an authorization from others created for the same client ID and user. + + +<%= json :scopes => ["public_repo"], :note => 'admin script' %> + +### Response + +<%= headers 201, :Location => get_resource(:oauth_access)['url'] %> +<%= json(:oauth_access) { |h| h.merge("fingerprint" => "") } %> + +## Get-or-create an authorization for a specific app + +This method will create a new authorization for the specified OAuth application, +only if an authorization for that application doesn't already exist for the +user. The URL includes the 20 character client ID for the OAuth app that is +requesting the token. It returns the user's existing authorization for the +application if one is present. Otherwise, it creates and returns a new one. + + PUT /authorizations/clients/:client_id + +### Parameters + +Name | Type | Description +-----|------|-------------- +`client_secret`|`string`| **Required**. The 40 character OAuth app client secret associated with the client ID specified in the URL. +`scopes`|`array` | A list of scopes that this authorization is in. +`note`|`string` | A note to remind you what the OAuth token is for. +`note_url`|`string` | A URL to remind you what app the OAuth token is for. +`fingerprint`|`string` | **This attribute is only available when using the [mirage-preview](#deprecation-notice) media type.** A unique string to distinguish an authorization from others created for the same client and user. If provided, this API is functionally equivalent to [Get-or-create an authorization for a specific app and fingerprint](/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app-and-fingerprint). + + +<%= json :client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", :scopes => ["public_repo"], :note => 'admin script' %> + +### Response if returning a new token + +<%= headers 201, :Location => get_resource(:oauth_access)['url'] %> +<%= json(:oauth_access) { |h| h.merge("fingerprint" => "") } %> + +### Response if returning an existing token + +<%= headers 200, :Location => get_resource(:oauth_access)['url'] %> +<%= json(:oauth_access) { |h| h.merge("token" => "", "fingerprint" => "") } %> + +## Get-or-create an authorization for a specific app and fingerprint + +**This API method is only available when using the +[mirage-preview](#deprecation-notice) media type.** +This method will create a new authorization for the specified OAuth application, +only if an authorization for that application and fingerprint do not already +exist for the user. The URL includes the 20 character client ID for the OAuth +app that is requesting the token. `fingerprint` is a unique string to +distinguish an authorization from others created for the same client ID and +user. It returns the user's existing authorization for the application if one +is present. Otherwise, it creates and returns a new one. + + PUT /authorizations/clients/:client_id/:fingerprint + +### Parameters + +Name | Type | Description +-----|------|-------------- +`client_secret`|`string`| **Required**. The 40 character OAuth app client secret associated with the client ID specified in the URL. +`scopes`|`array` | A list of scopes that this authorization is in. +`note`|`string` | A note to remind you what the OAuth token is for. +`note_url`|`string` | A URL to remind you what app the OAuth token is for. + + +<%= json :client_secret => "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd", :scopes => ["public_repo"], :note => 'admin script' %> + +### Response if returning a new token + +<%= headers 201, :Location => get_resource(:oauth_access)['url'] %> +<%= json :oauth_access %> + +### Response if returning an existing token + +<%= headers 200, :Location => get_resource(:oauth_access)['url'] %> +<%= json(:oauth_access) { |h| h.merge("token" => "") } %> + +## Update an existing authorization + + PATCH /authorizations/:id + +### Parameters + +Name | Type | Description +-----|------|-------------- +`scopes`|`array` | Replaces the authorization scopes with these. +`add_scopes`|`array` | A list of scopes to add to this authorization. +`remove_scopes`|`array` | A list of scopes to remove from this authorization. +`note`|`string` | A note to remind you what the OAuth token is for. +`note_url`|`string` | A URL to remind you what app the OAuth token is for. +`fingerprint`|`string` | **This attribute is only available when using the [mirage-preview](#deprecation-notice) media type.** A unique string to distinguish an authorization from others created for the same client ID and user. + + +You can only send one of these scope keys at a time. + +<%= json :add_scopes => ['repo'], :note => 'admin script' %> + +### Response + +<%= headers 200 %> +<%= json(:oauth_access) { |h| h.merge("token" => "") } %> + +## Delete an authorization + + DELETE /authorizations/:id + +### Response + +<%= headers 204 %> + +## Check an authorization + +OAuth applications can use a special API method for checking OAuth token +validity without running afoul of normal rate limits for failed login attempts. +Authentication works differently with this particular endpoint. You must use +[Basic Authentication](/v3/auth#basic-authentication) when accessing it, where the username is the OAuth +application `client_id` and the password is its `client_secret`. Invalid tokens +will return `404 NOT FOUND`. + + GET /applications/:client_id/tokens/:access_token + +### Response + +<%= headers 200 %> +<%= json(:oauth_access_with_user) %> + +## Reset an authorization + +OAuth applications can use this API method to reset a valid OAuth token without +end user involvement. Applications must save the "token" property in the +response, because changes take effect immediately. You must use +[Basic Authentication](/v3/auth#basic-authentication) when accessing it, where +the username is the OAuth application `client_id` and the password is its +`client_secret`. Invalid tokens will return `404 NOT FOUND`. + + POST /applications/:client_id/tokens/:access_token + +### Response + +<%= headers 200 %> +<%= json(:oauth_access_with_user) %> + +## Revoke all authorizations for an application + +OAuth application owners can revoke every token for an OAuth application. You +must use [Basic Authentication](/v3/auth#basic-authentication) when calling +this method. The username is the OAuth application `client_id` and the password +is its `client_secret`. Tokens are revoked via a background job, and it might +take a few minutes for the process to complete. + + DELETE /applications/:client_id/tokens + +### Response + +<%= headers 204 %> + +## Revoke an authorization for an application + +OAuth application owners can also revoke a single token for an OAuth +application. You must use [Basic Authentication](/v3/auth#basic-authentication) +for this method, where the username is the OAuth application `client_id` and + the password is its `client_secret`. + + DELETE /applications/:client_id/tokens/:access_token + +### Response + +<%= headers 204 %> + +## More Information + + +It can be a little tricky to get started with OAuth. Here are a few +links that might be of help: + +* [OAuth 2 spec](http://tools.ietf.org/html/rfc6749) +* [Facebook Login API](http://developers.facebook.com/docs/technical-guides/login/) +* [Ruby OAuth2 lib](https://github.com/intridea/oauth2) +* [Simple Ruby/Sinatra example](https://gist.github.com/9fd1a6199da0465ec87c) +* [Python Flask example](https://gist.github.com/ib-lundgren/6507798) using [requests-oauthlib](https://github.com/requests/requests-oauthlib) +* [Simple Python example](https://gist.github.com/e3fbd47fbb7ee3c626bb) using [python-oauth2](https://github.com/dgouldin/python-oauth2) +* [Ruby OmniAuth example](https://github.com/intridea/omniauth) +* [Ruby Sinatra extension](https://github.com/atmos/sinatra_auth_github) +* [Ruby Warden strategy](https://github.com/atmos/warden-github) + +[app-listing]: https://github.com/settings/applications +[basics auth guide]: /guides/basics-of-authentication/ diff --git a/content/v3/orgs.md b/content/v3/orgs.md new file mode 100644 index 0000000000..5ee7710f2f --- /dev/null +++ b/content/v3/orgs.md @@ -0,0 +1,103 @@ +--- +title: Organizations | GitHub API +--- + +# Organizations + +* TOC +{:toc} + +## List your organizations + +List organizations for the authenticated user. + +### OAuth scope requirements + +Currently, [OAuth](/v3/oauth/#scopes) requests always receive the user's [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership), regardless of the OAuth scopes associated with the request. If the OAuth authorization has `user` or `read:org` scope, the response also includes private organization memberships. + +With the new Organization Permissions API (described below), this method will only return organizations that your authorization allows you to operate on in some way (e.g., you can list teams with `read:org` scope, you can publicize your organization membership with `user` scope, etc.). Therefore, this API will require at least `user` or `read:org` scope. OAuth requests with insufficient scope will receive a `403 Forbidden` response. + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. This functionality will apply to all API consumers beginning February 24, 2015. Please see the blog post for full details. +

+ +

+ To access the API during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ + GET /user/orgs + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:org) { |h| [h] } %> + +## List user organizations + +List [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership) for the specified user. + +Currently, if you make an authenticated call, you can also list your private memberships in organizations (but only for the currently authenticated user). + +With the new Organization Permissions API (described below), this method will only list *public* memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the [List your organizations](#list-your-organizations) API instead. + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. This functionality will apply to all API consumers beginning February 24, 2015. Please see the blog post for full details. +

+ +

+ To access the API during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ + GET /users/:username/orgs + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:org) { |h| [h] } %> + +## Get an organization + + GET /orgs/:org + +### Response + +<%= headers 200 %> +<%= json(:full_org) %> + +## Edit an organization + + PATCH /orgs/:org + +### Input + +Name | Type | Description +-----|------|-------------- +`billing_email`|`string` | Billing email address. This address is not publicized. +`company`|`string` | The company name. +`email`|`string` | The publicly visible email address. +`location`|`string` | The location. +`name`|`string` | The shorthand name of the company. +`description`|`string` | The description of the company. + +### Example + +<%= json \ + :billing_email => "support@github.com", + :blog => "https://github.com/blog", + :company => "GitHub", + :email => "support@github.com", + :location => "San Francisco", + :name => "github", + :description => "GitHub, the company." + %> + +### Response + +<%= headers 200 %> +<%= json(:private_org) %> diff --git a/content/v3/orgs/hooks.md b/content/v3/orgs/hooks.md new file mode 100644 index 0000000000..0893109ebf --- /dev/null +++ b/content/v3/orgs/hooks.md @@ -0,0 +1,168 @@ +--- +title: Organization Webhooks | GitHub API +--- + +# Webhooks + +* TOC +{:toc} + +{{#tip}} + + + + The Organization Webhooks API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post][developer-blog-post] for full details. + + To access the API during the preview period, you must provide a custom [media type][media-type] in the `Accept` header: + + application/vnd.github.sersi-preview+json + +{{/tip}} + + +Organization webhooks allow you to receive HTTP `POST` payloads whenever certain events happen within the organization. Subscribing to these events makes it possible to build integrations that react to actions on GitHub.com. For more information on actions you can subscribe to, check out our [Events documentation][webhook-events]. + +## Scopes & Restrictions + +All actions against organization webhooks require the authenticated user to be an admin of the organization being managed. Additionally, OAuth tokens require [the `admin:org_hook` scope](/v3/oauth/#scopes). + +In order to protect sensitive data which may be present in webhook configurations, we also enforce the following access control rules: + +- OAuth applications cannot list, view, or edit webhooks which they did not create. +- Users cannot list, view, or edit webhooks which were created by OAuth applications. + +## List hooks + + GET /orgs/:org/hooks + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:org_hook) { |h| [h] } %> + + +## Get single hook + + GET /orgs/:org/hooks/:id + +### Response + +<%= headers 200 %> +<%= json :org_hook %> + + +## Create a hook + + POST /orgs/:org/hooks + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. Must be passed as "web". +`config`|`object` | **Required**. Key/value pairs to provide settings for this webhook. [These are defined below](#create-hook-config-params). +`events`|`array` | Determines what [events][event-types] the hook is triggered for. Default: `["push"]`. +`active`|`boolean` | Determines whether the hook is actually triggered on pushes. + + +The `config` object can accept the following keys: + +<%= fetch_content(:org_hook_config_hash) %> + +#### Example + +Here's how you can create a hook that posts payloads in JSON format: + +<%= json \ + :name => "web", + :active => true, + :events => ['push', 'pull_request'], + :config => { + :url => 'http://example.com/webhook', + :content_type => 'json'} +%> + +### Response + +<%= headers 201, :Location => get_resource(:org_hook)['url'] %> +<%= json :org_hook %> + + +## Edit a hook + + PATCH /orgs/:org/hooks/:id + +### Parameters + +Name | Type | Description +-----|------|-------------- +`config`|`object` | **Required**. Key/value pairs to provide settings for this webhook. [These are defined below](#update-hook-config-params). +`events`|`array` | Determines what [events][event-types] the hook is triggered for. Default: `["push"]`. +`active`|`boolean` | Determines whether the hook is actually triggered on pushes. + + +The `config` object can accept the following keys: + +<%= fetch_content(:org_hook_config_hash) %> + + +#### Example + +<%= json \ + :active => true, + :events => ['pull_request'] +%> + +### Response + +<%= headers 200 %> +<%= json(:org_hook) { |h| h.merge "events" => %w(pull_request) } %> + + +## Ping a hook + +This will trigger a [ping event][ping-event-url] to be sent to the hook. + + POST /orgs/:org/hooks/:id/pings + +### Response + +<%= headers 204 %> + + +## Delete a hook + + DELETE /orgs/:org/hooks/:id + +### Response + +<%= headers 204 %> + + +## Receiving Webhooks + +In order for GitHub to send webhook payloads, your server needs to be accessible from the Internet. We also highly suggest using SSL so that we can send encrypted payloads over HTTPS. + +For more best practices, [see our guide][best-integration-practices]. + +### Webhook Headers + +GitHub will send along several HTTP headers to differentiate between event types and payload identifiers. + +Name | Description +-----|-----------| +`X-GitHub-Event` | The [event type](/v3/activity/events/types/) that was triggered. +`X-GitHub-Delivery` | A [guid][guid] to identify the payload and event being sent. +`X-Hub-Signature` | The value of this header is computed as the HMAC hex digest of the body, using the `secret` config option as the key. + + +[guid]: http://en.wikipedia.org/wiki/Globally_unique_identifier +[hub-signature]: https://github.com/github/github-services/blob/f3bb3dd780feb6318c42b2db064ed6d481b70a1f/lib/service/http_helper.rb#L77 +[ping-event-url]: /webhooks/#ping-event +[webhook-events]: /webhooks/#events +[event-types]: /v3/activity/events/types/ +[media-type]: /v3/media +[best-integration-practices]: /guides/best-practices-for-integrators/ +[developer-blog-post]: /changes/2014-12-03-preview-the-new-organization-webhooks-api/ diff --git a/content/v3/orgs/members.md b/content/v3/orgs/members.md new file mode 100644 index 0000000000..25abccfbcb --- /dev/null +++ b/content/v3/orgs/members.md @@ -0,0 +1,262 @@ +--- +title: Organization Members | GitHub API +--- + +# Members + +* TOC +{:toc} + +## Members list + +List all users who are members of an organization. A member is a user that +belongs to at least 1 team in the organization. If the authenticated user is +also an owner of this organization then both concealed and public members will +be returned. + + GET /orgs/:org/members + +### Parameters {#audit-two-factor-auth} + +Name | Type | Description +--------|---------|-------------- +`filter`|`string` | Filter members returned in the list. Can be one of:
* `2fa_disabled`: Members without [two-factor authentication][2fa-blog] enabled. Available for organization admins.
* `all`: All members the authenticated user can see.

Default: `all` +`role` |`string` | Filter members returned by their role. If specified, must be set to `admin`, which will only return users with admin permissions on the org. **This parameter requires a custom media type to be specified. Please see more in the alert below.** + +[2fa-blog]: https://github.com/blog/1614-two-factor-authentication + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. This functionality will apply to all API consumers beginning February 24, 2015. Please see the blog post for full details. +

+ +

+ To access the API during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +### Response if requester is not an organization member + +<%= headers 302, "Location" => "https://api.github.com/orgs/github/public_members" %> + +## Check membership + +Check if a user is, publicly or privately, a member of the organization. + + GET /orgs/:org/members/:username + +### Response if requester is an organization member and user is a member + +<%= headers 204 %> + +### Response if requester is an organization member and user is not a member + +<%= headers 404 %> + +### Response if requester is not an organization member and is inquiring about themselves + +<%= headers 404 %> + +### Response if requester is not an organization member + +<%= headers 302, :Location => "https://api.github.com/orgs/github/public_members/pezra" %> + +## Add a member + +To add someone as a member to an org, you must add them to a +[team](/v3/orgs/teams/#add-team-member). + +## Remove a member + +Removing a user from this list will remove them from all teams and +they will no longer have any access to the organization's repositories. + + DELETE /orgs/:org/members/:username + +### Response + +<%= headers 204 %> + +## Public members list + +Members of an organization can choose to have their membership +publicized or not. + + GET /orgs/:org/public_members + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## Check public membership + + GET /orgs/:org/public_members/:username + +### Response if user is a public member + +<%= headers 204 %> + +### Response if user is not a public member + +<%= headers 404 %> + +## Publicize a user's membership + +The user can publicize their own membership. +(A user cannot publicize the membership for another user.) + + PUT /orgs/:org/public_members/:username + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Conceal a user's membership + + DELETE /orgs/:org/public_members/:username + +### Response + +<%= headers 204 %> + +## Get organization membership + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. Please see the blog post for full details. +

+ +

+ To access this API method during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ +In order to get a user's membership with an organization, the authenticated user must be an organization admin. + + GET /orgs/:org/memberships/:username + +### Response if user has an active admin membership with organization + +<%= headers 200 %> +<%= json(:active_admin_org_membership) %> + +### Response if user has an active membership with organization + +<%= headers 200 %> +<%= json(:active_limited_org_membership) %> + +### Response if user has a pending membership with organization + +<%= headers 200 %> +<%= json(:pending_limited_org_membership) %> + +## Add or update organization membership + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. Please see the blog post for full details. +

+ +

+ To access this API method during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ +In order to create or update a user's membership with an organization, the authenticated user must be an organization admin. + + PUT /orgs/:org/memberships/:username + +### Parameters + +Name | Type | Description +------|--------|-------------- +`role`|`string`| **Required**. The role to give the user in the organization. Can be one of:
* `admin` - The user will become an administrator of the organization.
* `member` - The user will become a non-admin member of the organization. Use this only to demote an existing admin to a non-admin. + +### Response if user was previously unaffiliated with organization + +<%= headers 200 %> +<%= json(:pending_admin_org_membership) %> + +### Response if user already had membership with organization + +<%= headers 200 %> +<%= json(:active_admin_org_membership) %> + +## Remove organization membership + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. Please see the blog post for full details. +

+ +

+ To access this API method during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ +In order to remove a user's membership with an organization, the authenticated user must be an organization admin. + + DELETE /orgs/:org/memberships/:username + +If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. + +### Response + +<%= headers 204 %> + +## List your organization memberships + + GET /user/memberships/orgs + +### Input + +Name | Type | Description +-----|------|-------------- +`state`|`string`| Indicates the state of the memberships to return. Can be either `active` or `pending`. If not specified, both active and pending memberships are returned. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:org_memberships) %> + +## Get your organization membership + + GET /user/memberships/orgs/:org + +### Response + +<%= headers 200 %> +<%= json(:pending_admin_org_membership) %> + +## Edit your organization membership + + PATCH /user/memberships/orgs/:org + +### Input + +Name | Type | Description +-----|------|-------------- +`state`|`string`| **Required**. The state that the membership should be in. Only `"active"` will be accepted. + +### Example + +<%= json \ + :state => "active" + %> + +### Response + +<%= headers 200 %> +<%= json(:active_admin_org_membership) %> diff --git a/content/v3/orgs/teams.md b/content/v3/orgs/teams.md new file mode 100644 index 0000000000..1a15af9f57 --- /dev/null +++ b/content/v3/orgs/teams.md @@ -0,0 +1,373 @@ +--- +title: Organization Teams | GitHub API +--- + +# Teams + +* TOC +{:toc} + +All actions against teams require at a minimum an authenticated user who +is a member of the Owners team in the `:org` being managed. Additionally, +OAuth users require the "read:org" [scope](/v3/oauth/#scopes). + +## List teams + + GET /orgs/:org/teams + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:team) { |h| [h] } %> + +## Get team + + GET /teams/:id + +### Response + +<%= headers 200 %> +<%= json(:full_team) %> + +## Create team + +In order to create a team, the authenticated user must be an owner of +`:org`. + + POST /orgs/:org/teams + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the team. +`description`|`string` | The description of the team. +`repo_names`|`array` of `strings` | The repositories to add the team to. +`permission`|`string` | The permission to grant the team. Can be one of:
* `pull` - team members can pull, but not push to or administer these repositories.
* `push` - team members can pull and push, but not administer these repositories.
* `admin` - team members can pull, push and administer these repositories.
Default: `pull` + +#### Example + +<%= json \ + :name => 'new team', + :description => 'team description', + :permission => 'push', + :repo_names => ['github/dotfiles'] %> + +### Response + +<%= headers 201 %> +<%= json(:full_team) %> + +## Edit team + +In order to edit a team, the authenticated user must be an owner of +the org that the team is associated with. + + PATCH /teams/:id + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the team. +`description`|`string` | The description of the team. +`permission`|`string` | The permission to grant the team. Can be one of:
* `pull` - team members can pull, but not push to or administer these repositories.
* `push` - team members can pull and push, but not administer these repositories.
* `admin` - team members can pull, push and administer these repositories. Default: `pull` + +#### Example + +<%= json \ + :name => 'new team name', + :name => 'new team description', + :permission => 'push' %> + +### Response + +<%= headers 200 %> +<%= json(:full_team) %> + +## Delete team + +In order to delete a team, the authenticated user must be an owner of +the org that the team is associated with. + + DELETE /teams/:id + +### Response + +<%= headers 204 %> + +## List team members + +In order to list members in a team, the authenticated user must be a +member of the team. + + GET /teams/:id/members + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## Get team member + +### Deprecation notice + +
+

+ The "Get team member" API (described below) is + deprecated and is scheduled for + removal in the next major version of the API. + + We recommend using the + Get team membership API + instead. It allows you to get both active and pending memberships. +

+
+ +In order to get if a user is a member of a team, the authenticated user +must be a member of the team. + + GET /teams/:id/members/:username + +### Response if user is a member + +<%= headers 204 %> + +### Response if user is not a member + +<%= headers 404 %> + +## Add team member + +### Deprecation notice + +
+

+ The "Add team member" API (described below) is + deprecated and is scheduled for + removal in the next major version of the API. + + We recommend using the + Add team membership API + instead. It allows you to invite new organization members to your teams. +

+
+ +In order to add a user to a team, the authenticated user must have +'admin' permissions to the team or be an owner of the organization that the team +is associated with, and the user being added must already be a member of at +least one other team on the same organization. + + PUT /teams/:id/members/:username + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +If you attempt to add an organization to a team, you will get this: + +<%= headers 422 %> +<%= + json :message => "Cannot add an organization as a member.", + :errors => [{ + :code => "org", + :field => :user, + :resource => :TeamMember + }] +%> + +If you attempt to add a user to a team and that user is not a member of at least +one other team on the same organization, you will get this: + +<%= headers 422 %> +<%= + json :message => "User isn't a member of this organization. Please invite them first.", + :errors => [{ + :code => "unaffiliated", + :field => :user, + :resource => :TeamMember + }] +%> + +## Remove team member + +### Deprecation notice + +
+

+ The "Remove team member" API (described below) is + deprecated and is scheduled for + removal in the next major version of the API. + + We recommend using the + Remove team membership API + instead. It allows you to remove both active and pending memberships. +

+
+ +In order to remove a user from a team, the authenticated user must have +'admin' permissions to the team or be an owner of the org that the team +is associated with. +NOTE: This does not delete the user, it just removes them from the team. + + DELETE /teams/:id/members/:username + +### Response + +<%= headers 204 %> + +## Get team membership + +In order to get a user's membership with a team, the authenticated user must be +a member of the team or an owner of the team's organization. + + GET /teams/:id/memberships/:username + +### Response if user has an active membership with team + +<%= headers 200 %> +<%= json(:active_team_membership) %> + +### Response if user has a pending membership with team + +<%= headers 200 %> +<%= json(:pending_team_membership) %> + +### Response if user has no membership with team + +<%= headers 404 %> + +## Add team membership + +In order to add a membership between a user and a team, the authenticated user +must have 'admin' permissions to the team or be an owner of the organization +that the team is associated with. + +If the user is already a part of the team's organization (meaning they're on at +least one other team in the organization), this endpoint will add the user to +the team. + +If the user is completely unaffiliated with the team's organization (meaning +they're on none of the organization's teams), this endpoint will send an +invitation to the user via email. This newly-created membership will be in the +"pending" state until the user accepts the invitation, at which point the +membership will transition to the "active" state and the user will be added as a +member of the team. + + PUT /teams/:id/memberships/:username + +### Response if user's membership with team is now active + +<%= headers 200 %> +<%= json(:active_team_membership) %> + +### Response if user's membership with team is now pending + +<%= headers 200 %> +<%= json(:pending_team_membership) %> + +If you attempt to add an organization to a team, you will get this: + +<%= headers 422 %> +<%= + json :message => "Cannot add an organization as a member.", + :errors => [{ + :code => "org", + :field => :user, + :resource => :TeamMember + }] +%> + +## Remove team membership + +In order to remove a membership between a user and a team, the authenticated +user must have 'admin' permissions to the team or be an owner of the +organization that the team is associated with. +NOTE: This does not delete the user, it just removes their membership from the +team. + + DELETE /teams/:id/memberships/:username + +### Response + +<%= headers 204 %> + +## List team repos + + GET /teams/:id/repos + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repo) { |h| [h] } %> + +## Check if a team manages a repository {#get-team-repo} + + GET /teams/:id/repos/:owner/:repo + +### Response if repository is managed by this team + +<%= headers 204 %> + +### Response if repository is not managed by this team + +<%= headers 404 %> + +## Add team repository {#add-team-repo} + +In order to add a repository to a team, the authenticated user must be an +owner of the org that the team is associated with. Also, the repository must +be owned by the organization, or a direct fork of a repository owned by the +organization. + + PUT /teams/:id/repos/:org/:repo + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +If you attempt to add a repository to a team that is not owned by the +organization, you get: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :code => "not_owned", + :field => :repository, + :resource => :TeamMember}] +%> + +## Remove team repository {#remove-team-repo} + +In order to remove a repository from a team, the authenticated user must be an +owner of the org that the team is associated with. Also, since the Owners team +always has access to all repositories in the organization, repositories cannot +be removed from the Owners team. +NOTE: This does not delete the repository, it just removes it from the team. + + DELETE /teams/:id/repos/:owner/:repo + +### Response + +<%= headers 204 %> + +## List user teams + +List all of the teams across all of the organizations to which the +authenticated user belongs. This method requires `user` or `repo` +[scope][] when authenticating via [OAuth][]. + + GET /user/teams + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:full_team) { |h| [h] } %> + +[OAuth]: /v3/oauth/ +[scope]: /v3/oauth/#scopes diff --git a/content/v3/pulls.md b/content/v3/pulls.md new file mode 100644 index 0000000000..072d085e10 --- /dev/null +++ b/content/v3/pulls.md @@ -0,0 +1,218 @@ +--- +title: Pull Requests | GitHub API +--- + +# Pull Requests + +* TOC +{:toc} + +The Pull Request API allows you to list, view, edit, create, and even merge +pull requests. Comments on pull requests can be managed via the [Issue +Comments API](/v3/issues/comments/). + +Pull Requests use [these custom media types](#custom-media-types). You +can read more about the use of media types in the API +[here](/v3/media/). + +## Link Relations + +Pull Requests have these possible link relations: + +Name | Description +-----|-----------| +`self`| The API location of this Pull Request. +`html`| The HTML location of this Pull Request. +`issue`| The API location of this Pull Request's [Issue](/v3/issues/). +`comments`| The API location of this Pull Request's [Issue comments](/v3/issues/comments/). +`review_comments`| The API location of this Pull Request's [Review comments](/v3/pulls/comments/). +`review_comment`| The [URL template](/v3/#hypermedia) to construct the API location for a [Review comment](/v3/pulls/comments/) in this Pull Request's repository. +`commits`|The API location of this Pull Request's [commits](#list-commits-on-a-pull-request). +`statuses`| The API location of this Pull Request's [commit statuses](/v3/repos/statuses/), which are the statuses of its `head` branch. + +## List pull requests + + GET /repos/:owner/:repo/pulls + +### Parameters + +Name | Type | Description +-----|------|-------------- +`state`|`string` | Either `open`, `closed`, or `all` to filter by state. Default: `open` +`head`|`string` | Filter pulls by head user and branch name in the format of `user:ref-name`. Example: `github:new-script-format`. +`base`|`string` | Filter pulls by base branch name. Example: `gh-pages`. +`sort`|`string`| What to sort results by. Can be either `created`, `updated`, `popularity` (comment count) or `long-running` (age, filtering by pulls updated in the last month). Default: `created` +`direction`|`string`| The direction of the sort. Can be either `asc` or `desc`. Default: `desc` when sort is `created` or sort is not specified, otherwise `asc`. + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:pull) { |h| [h] } %> + +## Get a single pull request + + GET /repos/:owner/:repo/pulls/:number + +### Response + +<%= headers 200 %> +<%= json :full_pull %> + +### Mergability + +Each time the pull request receives new commits, GitHub creates a merge commit +to _test_ whether the pull request can be automatically merged into the base +branch. (This _test_ commit is not added to the base branch or the head branch.) +The `merge_commit_sha` attribute holds the SHA of the _test_ merge commit; +however, this attribute is [deprecated](/v3/versions/#v3-deprecations) and is scheduled for +removal in the next version of the API. The Boolean `mergeable` attribute will +remain to indicate whether the pull request can be automatically merged. + +### Alternative Response Formats + +Pass the appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. + +## Create a pull request + + POST /repos/:owner/:repo/pulls + +### Input + +Name | Type | Description +-----|------|------------- +`title`|`string` | **Required**. The title of the pull request. +`head`|`string` | **Required**. The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head` with a user like this: `username:branch`. +`base`|`string` | **Required**. The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. +`body`|`string` | The contents of the pull request. + + +#### Example + +<%= json \ + :title => "Amazing new feature", + :body => "Please pull this in!", + :head => "octocat:new-feature", + :base => "master" +%> + +### Alternative Input + +You can also create a Pull Request from an existing Issue by passing an +Issue number instead of `title` and `body`. + +Name | Type | Description +-----|------|-------------- +`issue`|`number` | **Required**. The issue number in this repository to turn into a Pull Request. + +#### Example + +<%= json \ + :issue => "5", + :head => "octocat:new-feature", + :base => "master" +%> + +### Response + +<%= headers 201, :Location => get_resource(:pull)['url'] %> +<%= json :pull %> + +## Update a pull request + + PATCH /repos/:owner/:repo/pulls/:number + +### Input + +Name | Type | Description +-----|------|-------------- +`title`|`string` | The title of the pull request. +`body`|`string` | The contents of the pull request. +`state`|`string` | State of this Pull Request. Either `open` or `closed`. + +#### Example + +<%= json \ + :title => "new title", + :body => "updated body", + :state => "open" +%> + +### Response + +<%= headers 200 %> +<%= json :pull %> + +## List commits on a pull request + + GET /repos/:owner/:repo/pulls/:number/commits + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:commit) { |h| [h] } %> + +Note: The response includes a maximum of 250 commits. If you are working with a pull request larger than that, you can use the [Commit List API](/v3/repos/commits/#list-commits-on-a-repository) to enumerate all commits in the pull request. + +## List pull requests files + + GET /repos/:owner/:repo/pulls/:number/files + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:file) { |h| [h] } %> + +## Get if a pull request has been merged + + GET /repos/:owner/:repo/pulls/:number/merge + +### Response if pull request has been merged + +<%= headers 204 %> + +### Response if pull request has not been merged + +<%= headers 404 %> + +## Merge a pull request (Merge Button) + + PUT /repos/:owner/:repo/pulls/:number/merge + +### Input + +Name | Type | Description +-----|------|------------- +`commit_message`|`string`| The message that will be used for the merge commit + + +### Response if merge was successful + +<%= headers 200 %> +<%= json \ + :sha => '6dcb09b5b57875f334f61aebed695e2e4193db5e', + :merged => true, + :message => 'Pull Request successfully merged' +%> + +### Response if merge cannot be performed + +<%= headers 405 %> +<%= json \ + :message => "Pull Request is not mergeable", + :documentation_url => "https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button" +%> + +### Labels, assignees, and milestones + +Every pull request is an issue, but not every issue is a pull request. For this reason, "shared" actions for both features, like manipulating assignees, labels and milestones, are provided within [the Issues API](/v3/issues). + +## Custom media types + +These are the supported media types for pull requests. You can read more about the +use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw+json + application/vnd.github.VERSION.text+json + application/vnd.github.VERSION.html+json + application/vnd.github.VERSION.full+json diff --git a/content/v3/pulls/comments.md b/content/v3/pulls/comments.md new file mode 100644 index 0000000000..691628ca13 --- /dev/null +++ b/content/v3/pulls/comments.md @@ -0,0 +1,141 @@ +--- +title: Review Comments | GitHub API +--- + +# Review Comments + +* TOC +{:toc} + +Pull Request Review Comments are comments on a portion of the unified +diff. These are separate from Commit Comments (which are applied +directly to a commit, outside of the Pull Request view), and Issue +Comments (which do not reference a portion of the unified diff). + +Pull Request Review Comments use [these custom media +types](#custom-media-types). You can read more about the use of media types in the API +[here](/v3/media/). + +## List comments on a pull request + + GET /repos/:owner/:repo/pulls/:number/comments + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:pull_comment) { |h| [h] } %> + +## List comments in a repository + + GET /repos/:owner/:repo/pulls/comments + +By default, Review Comments are ordered by ascending ID. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`sort`|`string` | Can be either `created` or `updated`. Default: `created` +`direction`|`string` | Can be either `asc` or `desc`. Ignored without `sort` parameter. +`since`|`string` | Only comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:pull_comment) { |h| [h] } %> + +## Get a single comment + + GET /repos/:owner/:repo/pulls/comments/:number + +### Response + +<%= headers 200 %> +<%= json :pull_comment %> + +## Create a comment + + POST /repos/:owner/:repo/pulls/:number/comments + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The text of the comment +`commit_id`|`string` | **Required**. The SHA of the commit to comment on. +`path`|`string` | **Required**. The relative path of the file to comment on. +`position`|`number` | **Required**. The line index in the diff to comment on. + + +#### Example + +<%= json \ + :body => 'Nice change', + :commit_id => '6dcb09b5b57875f334f61aebed695e2e4193db5e', + :path => 'file1.txt', + :position => 4 +%> + +### Alternative Input + +Instead of passing `commit_id`, `path`, and `position` you can reply to +an existing Pull Request Comment like this: + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The text of the comment +`in_reply_to`|`number` | **Required**. The comment id to reply to. + + +#### Example + +<%= json \ + :body => 'Nice change', + :in_reply_to => 4 +%> + +### Response + +<%= headers 201, :Location => get_resource(:pull_comment)['url'] %> +<%= json :pull_comment %> + +## Edit a comment + + PATCH /repos/:owner/:repo/pulls/comments/:number + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The text of the comment + + +#### Example + +<%= json \ + :body => 'Nice change' +%> + +### Response + +<%= headers 200 %> +<%= json :pull_comment %> + +## Delete a comment + + DELETE /repos/:owner/:repo/pulls/comments/:number + +### Response + +<%= headers 204 %> + +## Custom media types + +These are the supported media types for pull request review comments. You can +read more about the use of media types in the API [here](/v3/media/). + + application/vnd.github.VERSION.raw+json + application/vnd.github.VERSION.text+json + application/vnd.github.VERSION.html+json + application/vnd.github.VERSION.full+json diff --git a/content/v3/rate_limit.md b/content/v3/rate_limit.md new file mode 100644 index 0000000000..32126554ef --- /dev/null +++ b/content/v3/rate_limit.md @@ -0,0 +1,51 @@ +--- +title: Rate Limit | GitHub API +--- + +# Rate Limit + +The overview documentation describes the [rate limit rules](/v3/#rate-limiting). +You can check your current rate limit status at any time using the Rate Limit +API described below. + +## Get your current rate limit status + +Note: Accessing this endpoint does not count against your rate limit. + + GET /rate_limit + +### Response + +<%= + headers 200, + 'X-RateLimit-Limit' => 5000, + 'X-RateLimit-Remaining' => 4999, + 'X-RateLimit-Reset' => 1372700873 +%> +<%= + json :resources => { + :core => {:limit => 5000, :remaining => 4999, :reset => 1372700873}, + :search => {:limit => 20, :remaining => 18, :reset => 1372697452}, + }, + :rate => {:limit => 5000, :remaining => 4999, :reset => 1372700873} +%> +
+ +#### Understanding Your Rate Limit Status + +The Search API has a [custom rate limit](/v3/search/#rate-limit), separate from +the rate limit governing the rest of the API. For that reason, the response +(shown above) categorizes your rate limit by resource. Within the `"resources"` +object, the `"search"` object provides your rate limit status for the +[Search API](/v3/search). The `"core"` object provides your rate limit status for +all the _rest_ of the API. + +#### Deprecation Notice + +The `"rate"` object (shown at the bottom of the response above) is +[deprecated](/v3/versions/#v3-deprecations) and is scheduled for removal in the next +version of the API. + +If you're writing new API client code (or updating your existing code), you +should use the `"core"` object instead of the `"rate"` object. The `"core"` object +contains the same information that is present in the `"rate"` object. diff --git a/content/v3/repos.md b/content/v3/repos.md new file mode 100644 index 0000000000..66f58ebe8e --- /dev/null +++ b/content/v3/repos.md @@ -0,0 +1,277 @@ +--- +title: Repositories | GitHub API +--- + +# Repositories + +* TOC +{:toc} + +## List your repositories + +List repositories for the authenticated user. + +Note that this currently does not include repositories owned by organizations +which the user can access. You can +[list your organizations](/v3/orgs/#list-your-organizations) and +[list organization repositories](/v3/repos/#list-organization-repositories) +separately. + +With the new Organization Permissions API (described below), this *will* include +repositories owned by organizations which the user can access. If you provide +the custom media type (described below), you won't need to use other APIs to +list the authenticated user's organization-owned repositories. + +
+

+ We're currently offering a migration period allowing applications to opt in to the Organization Permissions API. This functionality will apply to all API consumers beginning February 24, 2015. Please see the blog post for full details. +

+ +

+ To access the API during the migration period, you must provide a custom media type in the Accept header: +

application/vnd.github.moondragon+json
+

+
+ + GET /user/repos + +### Parameters + +Name | Type | Description +-----|------|-------------- +`type`|`string` | Can be one of `all`, `owner`, `public`, `private`, `member`. Default: `all` +`sort`|`string` | Can be one of `created`, `updated`, `pushed`, `full_name`. Default: `full_name` +`direction`|`string` | Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`; otherwise `desc` + + +## List user repositories + +List public repositories for the specified user. + + GET /users/:username/repos + +### Parameters + +Name | Type | Description +-----|------|------------- +`type`|`string` | Can be one of `all`, `owner`, `member`. Default: `owner` +`sort`|`string` | Can be one of `created`, `updated`, `pushed`, `full_name`. Default: `full_name` +`direction`|`string` | Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc` + + +## List organization repositories + +List repositories for the specified org. + + GET /orgs/:org/repos + +### Parameters + +Name | Type | Description +-----|------|-------------- +`type`|`string` | Can be one of `all`, `public`, `private`, `forks`, `sources`, `member`. Default: `all` + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repo) { |h| [h] } %> + +## List all public repositories + +This provides a dump of every public repository, in the order that they were created. + +Note: Pagination is powered exclusively by the `since` parameter. +Use the [Link header](/v3/#link-header) to get the URL for the next page of +repositories. + + GET /repositories + +### Parameters + +Name | Type | Description +-----|------|-------------- +`since`|`string`| The integer ID of the last Repository that you've seen. + + +### Response + +<%= headers 200, :pagination => { :next => 'https://api.github.com/repositories?since=364' } %> +<%= json(:simple_repo) { |h| [h] } %> + +## Create + +Create a new repository for the authenticated user. + + POST /user/repos + +Create a new repository in this organization. The authenticated user must +be a member of the specified organization. + + POST /orgs/:org/repos + +### OAuth scope requirements + +When using [OAuth](/v3/oauth/#scopes), authorizations must include: + +- `public_repo` scope or `repo` scope to create a public repository +- `repo` scope to create a private repository + +### Input + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the repository +`description`|`string` | A short description of the repository +`homepage`|`string` | A URL with more information about the repository +`private`|`boolean` | Either `true` to create a private repository, or `false` to create a public one. Creating private repositories requires a paid GitHub account. Default: `false` +`has_issues`|`boolean` | Either `true` to enable issues for this repository, `false` to disable them. Default: `true` +`has_wiki`|`boolean` | Either `true` to enable the wiki for this repository, `false` to disable it. Default: `true` +`has_downloads`|`boolean` | Either `true` to enable downloads for this repository, `false` to disable them. Default: `true` +`team_id`|`number` | The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization. +`auto_init`|`boolean` | Pass `true` to create an initial commit with empty README. Default: `false` +`gitignore_template`|`string` | Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, "Haskell". +`license_template`|`string` | Desired [LICENSE template](https://github.com/github/choosealicense.com) to apply. Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mozilla". + +#### Example + +<%= json \ + :name => "Hello-World", + :description => "This is your first repository", + :homepage => "https://github.com", + :private => false, + :has_issues => true, + :has_wiki => true, + :has_downloads => true +%> + +### Response + +<%= headers 201, :Location => get_resource(:repo)['url'] %> +<%= json :repo %> + +## Get + + GET /repos/:owner/:repo + +### Response + +The `parent` and `source` objects are present when the repository is a fork. +`parent` is the repository this repository was forked from, +`source` is the ultimate source for the network. + +<%= headers 200 %> +<%= json :full_repo %> + +## Edit + + PATCH /repos/:owner/:repo + +### Input + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the repository +`description`|`string` | A short description of the repository +`homepage`|`string` | A URL with more information about the repository +`private`|`boolean` | Either `true` to make the repository private, or `false` to make it public. Creating private repositories requires a paid GitHub account. Default: `false` +`has_issues`|`boolean` | Either `true` to enable issues for this repository, `false` to disable them. Default: `true` +`has_wiki`|`boolean` | Either `true` to enable the wiki for this repository, `false` to disable it. Default: `true` +`has_downloads`|`boolean` | Either `true` to enable downloads for this repository, `false` to disable them. Default: `true` +`default_branch`|`String` | Updates the default branch for this repository. + +#### Example + +<%= json \ + :name => "Hello-World", + :description => "This is your first repository", + :homepage => "https://github.com", + :private => true, + :has_issues => true, + :has_wiki => true, + :has_downloads => true +%> + +### Response + +<%= headers 200 %> +<%= json :full_repo %> + +## List contributors + +List contributors to the specified repository, sorted by the number of commits per contributor in descending order. + + GET /repos/:owner/:repo/contributors + +### Parameters + +Name | Type | Description +-----|------|------------- +`anon`|`string` | Set to `1` or `true` to include anonymous contributors in results. + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:contributor) { |h| [h] } %> + +## List languages + +List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. + + GET /repos/:owner/:repo/languages + +### Response + +<%= headers 200 %> +<%= json \ + "C" => 78769, + "Python" => 7769 +%> + +## List Teams + + GET /repos/:owner/:repo/teams + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:team) { |h| [h] } %> + +## List Tags + + GET /repos/:owner/:repo/tags + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:tag) { |h| [h] } %> + +## List Branches + + GET /repos/:owner/:repo/branches + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:branches) %> + +## Get Branch + + GET /repos/:owner/:repo/branches/:branch + +### Response + +<%= headers 200 %> +<%= json(:branch) %> + +## Delete a Repository + +Deleting a repository requires admin access. If OAuth is used, the +`delete_repo` scope is required. + + DELETE /repos/:owner/:repo + +### Response + +<%= headers 204 %> diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md new file mode 100644 index 0000000000..ce35992fe5 --- /dev/null +++ b/content/v3/repos/collaborators.md @@ -0,0 +1,52 @@ +--- +title: Collaborators | GitHub API +--- + +# Collaborators + +* TOC +{:toc} + +## List collaborators {#list} + + GET /repos/:owner/:repo/collaborators + +When authenticating as an organization owner of an organization-owned +repository, all organization owners are included in the list of collaborators. +Otherwise, only users with access to the repository are returned in the +collaborators list. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## Check if a user is a collaborator {#get} + + GET /repos/:owner/:repo/collaborators/:username + +### Response if user is a collaborator + +<%= headers 204 %> + +### Response if user is not a collaborator + +<%= headers 404 %> + +## Add user as a collaborator {#add-collaborator} + + PUT /repos/:owner/:repo/collaborators/:username + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Remove user as a collaborator {#remove-collaborator} + + DELETE /repos/:owner/:repo/collaborators/:username + +### Response + +<%= headers 204 %> diff --git a/content/v3/repos/comments.md b/content/v3/repos/comments.md new file mode 100644 index 0000000000..4ed12aebd0 --- /dev/null +++ b/content/v3/repos/comments.md @@ -0,0 +1,108 @@ +--- +title: Comments | GitHub API +--- + +# Comments + +* TOC +{:toc} + +## List commit comments for a repository + +Commit Comments use [these custom media types](#custom-media-types). You can +read more about the use of media types in the API [here](/v3/media/). + +Comments are ordered by ascending ID. + + GET /repos/:owner/:repo/comments + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:commit_comment) { |h| [h] } %> + +## List comments for a single commit + + GET /repos/:owner/:repo/commits/:ref/comments + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:commit_comment) { |h| [h] } %> + +## Create a commit comment + + POST /repos/:owner/:repo/commits/:sha/comments + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The contents of the comment. +`path`|`string` | Relative path of the file to comment on. +`position`|`number` | Line index in the diff to comment on. +`line`|`number` | **Deprecated**. Use **position** parameter instead. Line number in the file to comment on. + + +#### Example + +<%= json \ + :body => 'Nice change', + :path => 'file1.txt', + :position => 4, + :line => nil +%> + +### Response + +<%= headers 201, :Location => get_resource(:commit_comment)['url'] %> +<%= json :commit_comment %> + +## Get a single commit comment + + GET /repos/:owner/:repo/comments/:id + +### Response + +<%= headers 200 %> +<%= json :commit_comment %> + +## Update a commit comment + + PATCH /repos/:owner/:repo/comments/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`body`|`string` | **Required**. The contents of the comment + + +#### Example + +<%= json \ + :body => 'Nice change' +%> + +### Response + +<%= headers 200 %> +<%= json :commit_comment %> + +## Delete a commit comment + + DELETE /repos/:owner/:repo/comments/:id + +### Response + +<%= headers 204 %> + +## Custom media types + +These are the supported media types for commit comments. You can read more +about the use of media types in the API [here](/v3/media/). + + application/vnd.github-commitcomment.raw+json + application/vnd.github-commitcomment.text+json + application/vnd.github-commitcomment.html+json + application/vnd.github-commitcomment.full+json diff --git a/content/v3/repos/commits.md b/content/v3/repos/commits.md new file mode 100644 index 0000000000..3bf4a4af0a --- /dev/null +++ b/content/v3/repos/commits.md @@ -0,0 +1,65 @@ +--- +title: Commits | GitHub API +--- + +# Commits + +* TOC +{:toc} + +The Repo Commits API supports listing, viewing, and comparing commits in a repository. + +## List commits on a repository + + GET /repos/:owner/:repo/commits + +### Parameters + +Name | Type | Description +-----|------|-------------- +`sha`|`string` | SHA or branch to start listing commits from. Default: the repository’s default branch (usually `master`). +`path`|`string` | Only commits containing this file path will be returned. +`author`|`string` | GitHub login or email address by which to filter by commit author. +`since`|`string` | Only commits after this date will be returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. +`until`|`string` | Only commits before this date will be returned. This is a timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. + + +### Response + +<%= + headers 200, :pagination => { :next => 'https://api.github.com/resource?page=2' } +%> +<%= json(:commit) { |h| [h] } %> + +## Get a single commit + + GET /repos/:owner/:repo/commits/:sha + +### Response + +<%= headers 200 %> +<%= json(:full_commit) %> + +Note: Diffs with binary data will have no 'patch' property. Pass the +appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and +patch formats. + +## Compare two commits + + GET /repos/:owner/:repo/compare/:base...:head + +Note: Both `:base` and `:head` can be either branch names in `:repo` or branch names in other repositories in the same network as `:repo`. For the latter case, use the format `user:branch`: + + GET /repos/:owner/:repo/compare/user1:branchname...user2:branchname + +### Response + +<%= json :commit_comparison %> + +Pass the appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. + +### Working with large comparisons + +The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the [Commit List API](/v3/repos/commits/#list-commits-on-a-repository) to enumerate all commits in the range. + +For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range. diff --git a/content/v3/repos/contents.md b/content/v3/repos/contents.md new file mode 100644 index 0000000000..06491c5f5d --- /dev/null +++ b/content/v3/repos/contents.md @@ -0,0 +1,287 @@ +--- +title: Contents | GitHub API +--- + +# Contents + +* TOC +{:toc} + +These API methods let you retrieve the contents of files within a repository as +Base64 encoded content. See [media types](#custom-media-types) for requesting the raw format or rendered HTML (when supported). + +## Get the README + +This method returns the preferred README for a repository. + + GET /repos/:owner/:repo/readme + +READMEs support [custom media types](#custom-media-types) for retrieving the raw content or rendered HTML. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`ref`|`string` | The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`) + +### Response + +<%= headers 200 %> +<%= json :readme_content %> + +## Get contents + +This method returns the contents of a file or directory in a repository. + + GET /repos/:owner/:repo/contents/:path + +Files and symlinks support [a custom media type](#custom-media-types) for retrieving the raw content or rendered HTML (when supported). +Directories and submodules do _not_ support custom media types. + +{{#tip}} + +**Note**: + +- To get a repository's contents recursively, you can [recursively get the tree](/v3/git/trees/). +- This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](/v3/git/trees/#get-a-tree). +- This API supports files up to 1 megabyte in size. + +{{/tip}} + +### Parameters + +Name | Type | Description +-----|------|-------------- +`path`|`string` | The content path. +`ref`|`string` | The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`) + +### Response if content is a file + +<%= headers 200 %> +<%= json :readme_content %> + +### Response if content is a directory + +The response will be an array of objects, one object for each item in the directory. + +<%= headers 200 %> +<%= json :directory_content %> + +Note: When listing the contents of a directory, submodules have their "type" +specified as "file". Logically, the value *should* be "submodule". This behavior +exists in API v3 [for backwards compatibility purposes](https://github.com/github/developer.github.com/commit/1b329b04cece9f3087faa7b1e0382317a9b93490). +In the next major version of the API, the type will be returned as "submodule". + +### Response if content is a symlink + +If the requested `:path` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the [format shown above](#response-if-content-is-a-file)). + +Otherwise, the API responds with an object describing the symlink itself: + +<%= headers 200 %> +<%= json :symlink_content %> + +### Response if content is a submodule + +<%= headers 200 %> +<%= json :submodule_content %> + +The `submodule_git_url` identifies the location of the submodule repository, and the `sha` identifies a specific commit within the submodule repository. +Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit. + +If the submodule repository is not hosted on github.com, the Git URLs (`git_url` and `_links["git"]`) and the github.com URLs (`html_url` and `_links["html"]`) will have null values. + +## Create a file + +This method creates a new file in a repository + + PUT /repos/:owner/:repo/contents/:path + +### Parameters + +Name | Type | Description +-----|------|------------- +`path`|`string` | **Required**. The content path. +`message`|`string` | **Required**. The commit message. +`content`|`string` | **Required**. The new file content, Base64 encoded. +`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`) + +### Optional Parameters + +You can provide an additional `committer` parameter, which is an object containing +information about the committer. Or, you can provide an `author` parameter, which +is an object containing information about the author. + +The `author` section is optional and is filled in with the `committer` +information if omitted. If the `committer` information is omitted, the authenticated +user's information is used. + +You must provide values for both `name` and `email`, whether you choose to use +`author` or `committer`. Otherwise, you'll receive a `422` status code. + +Both the `author` and `committer` parameters have the same keys: + +Name | Type | Description +-----|------|-------------- +`name`|`string` | The name of the author (or committer) of the commit +`email`|`string` | The email of the author (or committer) of the commit + +### Example Input + +<%= json "message" => "my commit message", \ + "committer" => \ + {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \ + "content" => "bXkgbmV3IGZpbGUgY29udGVudHM=" %> + +### Response + +<%= headers 201 %> +<%= json :content_crud %> + +## Update a file + +This method updates a file in a repository + + PUT /repos/:owner/:repo/contents/:path + +### Parameters + +Name | Type | Description +-----|------|-------------- +`path`|`string` | **Required**. The content path. +`message`|`string` | **Required**. The commit message. +`content`|`string` | **Required**. The updated file content, Base64 encoded. +`sha` | `string` | **Required**. The blob SHA of the file being replaced. +`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`) + +### Optional Parameters + +You can provide an additional `committer` parameter, which is an object containing +information about the committer. Or, you can provide an `author` parameter, which +is an object containing information about the author. + +The `author` section is optional and is filled in with the `committer` +information if omitted. If the `committer` information is omitted, the authenticated +user's information is used. + +You must provide values for both `name` and `email`, whether you choose to use +`author` or `committer`. Otherwise, you'll receive a `422` status code. + +Both the `author` and `committer` parameters have the same keys: + +Name | Type | Description +-----|------|-------------- +`name`|`string` | The name of the author (or committer) of the commit +`email`|`string` | The email of the author (or committer) of the commit + +### Example Input + +<%= json "message" => "my commit message", \ + "committer" => \ + {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \ + "content" => "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz", \ + "sha" => "329688480d39049927147c162b9d2deaf885005f" %> + +### Response + +<%= headers 200 %> +<%= json :content_crud %> + +## Delete a file + +This method deletes a file in a repository + + DELETE /repos/:owner/:repo/contents/:path + +### Parameters + + +Name | Type | Description +-----|------|-------------- +`path`|`string` | **Required**. The content path. +`message`|`string` | **Required**. The commit message. +`sha` | `string` | **Required**. The blob SHA of the file being replaced. +`branch` | `string` | The branch name. Default: the repository’s default branch (usually `master`) + +### Optional Parameters + +You can provide an additional `committer` parameter, which is an object containing +information about the committer. Or, you can provide an `author` parameter, which +is an object containing information about the author. + +The `author` section is optional and is filled in with the `committer` +information if omitted. If the `committer` information is omitted, the authenticated +user's information is used. + +You must provide values for both `name` and `email`, whether you choose to use +`author` or `committer`. Otherwise, you'll receive a `422` status code. + +Both the `author` and `committer` parameters have the same keys: + +Name | Type | Description +-----|------|-------------- +`name`|`string` | The name of the author (or committer) of the commit +`email`|`string` | The email of the author (or committer) of the commit + +### Example Input + +<%= json "message" => "my commit message", \ + "committer" => \ + {"name" => "Scott Chacon", "email" => "schacon@gmail.com" }, \ + "sha" => "329688480d39049927147c162b9d2deaf885005f" %> + +### Response + +<%= headers 200 %> +<%= + json :content_crud do |response| + response['content'] = nil + response + end +%> + +## Get archive link + +This method will return a `302` to a URL to download a tarball +or zipball archive for a repository. Please make sure your HTTP framework +is configured to follow redirects or you will need to use the `Location` header +to make a second `GET` request. + +*Note*: For private repositories, these links are temporary and expire quickly. + + GET /repos/:owner/:repo/:archive_format/:ref + +### Parameters + +Name | Type | Description +-----|------|-------------- +`archive_format`|`string` | Can be either `tarball` or `zipball`. Default: `tarball` +`ref`| `string` | A valid Git reference. Default: the repository’s default branch (usually `master`) + + +### Response + +<%= headers 302, :Location => 'https://codeload.github.com/me/myprivate/legacy.zip/master?login=me&token=thistokenexpires' %> + +To follow redirects with curl, use the `-L` switch: + +
+curl -L https://api.github.com/repos/octokit/octokit.rb/tarball > octokit.tar.gz
+
+  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
+                                 Dload  Upload   Total   Spent    Left  Speed
+100  206k  100  206k    0     0   146k      0  0:00:01  0:00:01 --:--:--  790k
+
+ +## Custom media types + +[READMEs](#get-the-readme), [files](#get-contents), and [symlinks](#get-contents) support the following custom media types: + + application/vnd.github.VERSION.raw + application/vnd.github.VERSION.html + +Use the `.raw` media type to retrieve the contents of the file. + +For markup files such as Markdown or AsciiDoc, you can retrieve the rendered HTML using the `.html` media type. Markup languages are rendered to HTML using our open-source [Markup library](https://github.com/github/markup). + +You can read more about the use of media types in the API [here](/v3/media/). diff --git a/content/v3/repos/deployments.md b/content/v3/repos/deployments.md new file mode 100644 index 0000000000..c4980ada99 --- /dev/null +++ b/content/v3/repos/deployments.md @@ -0,0 +1,222 @@ +--- +title: Deployments | GitHub API +--- + +# Deployments + +* TOC +{:toc} + +Deployments are a request for a specific ref(branch,sha,tag) to be deployed. +GitHub then dispatches deployment events that external services can listen for +and act on. This enables developers and organizations to build loosely-coupled +tooling around deployments, without having to worry about implementation +details of delivering different types of applications (e.g., web, native). + +Deployment Statuses allow external services to mark deployments with a +'success', 'failure', 'error', or 'pending' state, which can then be consumed +by any system listening for `deployment_status` events. + +Deployment Statuses can also include an optional `description` and `target_url`, and +we highly recommend providing them as they make deployment statuses much more +useful. The `target_url` would be the full URL to the deployment output, and +the `description` would be the high level summary of what happened with the +deployment. + +Deployments and Deployment Statuses both have associated +[repository events](/v3/activity/events/types/#deploymentevent) when +they're created. This allows webhooks and 3rd party integrations to respond to +deployment requests as well as update the status of a deployment as progress is +made. + +Below is a simple sequence diagram for how these interactions would work. + +
++---------+             +--------+            +-----------+        +-------------+
+| Tooling |             | GitHub |            | 3rd Party |        | Your Server |
++---------+             +--------+            +-----------+        +-------------+
+     |                      |                       |                     |
+     |  Create Deployment   |                       |                     |
+     |--------------------->|                       |                     |
+     |                      |                       |                     |
+     |  Deployment Created  |                       |                     |
+     |<---------------------|                       |                     |
+     |                      |                       |                     |
+     |                      |   Deployment Event    |                     |
+     |                      |---------------------->|                     |
+     |                      |                       |     SSH+Deploys     |
+     |                      |                       |-------------------->|
+     |                      |                       |                     |
+     |                      |   Deployment Status   |                     |
+     |                      |<----------------------|                     |
+     |                      |                       |                     |
+     |                      |                       |   Deploy Completed  |
+     |                      |                       |<--------------------|
+     |                      |                       |                     |
+     |                      |   Deployment Status   |                     |
+     |                      |<----------------------|                     |
+     |                      |                       |                     |
+
+ +Keep in mind that GitHub is never actually accessing your servers. It's up to +your 3rd party integration to interact with deployment events. This allows for +[github-services](https://github.com/github/github-services) integrations as +well as running your own systems depending on your use case. Multiple systems +can listen for deployment events, and it's up to each of those systems to +decide whether or not they're responsible for pushing the code out to your +servers, building native code, etc. + +Note that the `repo_deployment` [OAuth scope](/v3/oauth/#scopes) grants +targeted access to Deployments and Deployment Statuses **without** +granting access to repository code, while the `repo` scope grants permission to code +as well. + +## List Deployments + +Simple filtering of deployments is available via query parameters: + + GET /repos/:owner/:repo/deployments + +Name | Type | Description +-----|------|-------------- +`sha`|`string` | The short or long sha that was recorded at creation time. Default: `none` +`ref`|`string` | The name of the ref. This can be a branch, tag, or sha. Default: `none` +`task`|`string` | The name of the task for the deployment. e.g. `deploy` or `deploy:migrations`. Default: `none` +`environment`|`string` | The name of the environment that was deployed to. e.g. `staging` or `production`. Default: `none` + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:deployment) { |h| [h] } %> + +## Create a Deployment + +Deployments offer a few configurable parameters with sane defaults. + +The `ref` parameter can be any named branch, tag, or sha. At GitHub we often +deploy branches and verify them before we merge a pull request. + +The `environment` parameter allows deployments to be issued to different +runtime environments. Teams often have multiple environments for verifying +their applications, like 'production', 'staging', and 'qa'. This allows for +easy tracking of which environments had deployments requested. The default +environment is 'production'. + +The `auto_merge` parameter is used to ensure that the requested ref is not +behind the repository's default branch. If the ref *is* behind the default +branch for the repository, we will attempt to merge it for you. If the merge +succeeds, the API will return a successful merge commit. If merge conflicts +prevent the merge from succeeding, the API will return a failure response. + +By default, [commit statuses](/v3/repos/statuses) for every submitted context +must be in a 'success' state. The `required_contexts` parameter allows you to +specify a subset of contexts that must be "success", or to specify contexts +that have not yet been submitted. You are not required to use commit statuses +to deploy. If you do not require any contexts or create any commit statuses, +the deployment will always succeed. + +The `payload` parameter is available for any extra information that a +deployment system might need. It is a JSON text field that will be passed on +when a deployment event is dispatched. + +The `task` parameter is used by the deployment system to allow different +execution paths. In the web world this might be 'deploy:migrations' to run +schema changes on the system. In the compiled world this could be a flag to +compile an application with debugging enabled. + +Users with `repo` or `repo_deployment` scopes can create a deployment for a given ref: + + POST /repos/:owner/:repo/deployments + +### Parameters + +Name | Type | Description +-----|------|-------------- +`ref`|`string`| **Required**. The ref to deploy. This can be a branch, tag, or sha. +`task`|`string`| Optional parameter to specify a task to execute, e.g. `deploy` or `deploy:migrations`. Default: `deploy` +`auto_merge`|`boolean`| Optional parameter to merge the default branch into the requested ref if it is behind the default branch. Default: `true` +`required_contexts`|`Array`| Optional array of status contexts verified against commit status checks. If this parameter is omitted from the parameters then all unique contexts will be verified before a deployment is created. To bypass checking entirely pass an empty array. Defaults to all unique contexts. +`payload`|`string` | Optional JSON payload with extra information about the deployment. Default: `""` +`environment`|`string` | Optional name for the target deployment environment (e.g., production, staging, qa). Default: `"production"` +`description`|`string` | Optional short description. Default: `""` + +#### Simple Example + +A simple example putting the user and room into the payload to notify back to +chat networks. + +<%= json \ + :ref => "topic-branch", + :payload => "{\"user\":\"atmos\",\"room_id\":123456}", + :description => "Deploying my sweet branch" +%> + +<%= headers 201, :Location => get_resource(:deployment)['url'] %> +<%= json :deployment %> + +#### Advanced Example + +A more advanced example specifying required commit statuses and bypassing auto-merging. + +<%= json \ + :ref => "topic-branch", + :auto_merge => false, + :payload => "{\"user\":\"atmos\",\"room_id\":123456}", + :description => "Deploying my sweet branch", + :required_contexts => ["ci/janky", "security/brakeman"] +%> + +<%= headers 201, :Location => get_resource(:deployment)['url'] %> +<%= json :deployment %> + +## Update a Deployment + +Once a deployment is created, it cannot be updated. Information relating to the +success or failure of a deployment is handled through Deployment Statuses. + +# Deployment Statuses + +## List Deployment Statuses + +Users with pull access can view deployment statuses for a deployment: + + GET /repos/:owner/:repo/deployments/:id/statuses + +### Parameters + +Name | Type | Description +-----|------|-------------- +`id` |`integer`| **Required**. The Deployment ID to list the statuses from. + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:deployment_status) { |h| h.delete("deployment"); [h] } %> + +## Create a Deployment Status + +Users with push access can create deployment statuses for a given deployment: + + POST /repos/:owner/:repo/deployments/:id/statuses + +### Parameters + +Name | Type | Description +-----|------|-------------- +`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, or `failure`. +`target_url`|`string` | The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Default: `""` +`description`|`string` | A short description of the status. Default: `""` + +#### Example + +<%= json \ + :state => "success", + :target_url => "https://example.com/deployment/42/output", + :description => "Deployment finished successfully." +%> + +### Response + +<%= headers 201, :Location => get_resource(:deployment_status)['url'] %> +<%= json :deployment_status %> diff --git a/content/v3/repos/downloads.md b/content/v3/repos/downloads.md new file mode 100644 index 0000000000..4edc78144c --- /dev/null +++ b/content/v3/repos/downloads.md @@ -0,0 +1,50 @@ +--- +title: Downloads | GitHub API +--- + +# Downloads + +* TOC +{:toc} + +### Downloads API is Deprecated + +
+

+ The Downloads API (described below) was + deprecated on December 11, 2012. + It will be removed at a future date. + + We recommend using Releases instead. +

+
+ +The downloads API is for package downloads only. If you want to get +source tarballs you should use [this](/v3/repos/contents/#get-archive-link) +instead. + +## List downloads for a repository + + GET /repos/:owner/:repo/downloads + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:download) { |h| [h] } %> + +## Get a single download + + GET /repos/:owner/:repo/downloads/:id + +### Response + +<%= headers 200 %> +<%= json :download %> + +## Delete a download + + DELETE /repos/:owner/:repo/downloads/:id + +### Response + +<%= headers 204 %> diff --git a/content/v3/repos/forks.md b/content/v3/repos/forks.md new file mode 100644 index 0000000000..8b5fc4525d --- /dev/null +++ b/content/v3/repos/forks.md @@ -0,0 +1,49 @@ +--- +title: Forks | GitHub API +--- + +# Forks + +* TOC +{:toc} + +## List forks + + GET /repos/:owner/:repo/forks + +### Parameters + +Name | Type | Description +-----|------|------------- +`sort`|`string` | The sort order. Can be either `newest`, `oldest`, or `stargazers`. Default: `newest` + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repo) { |h| h['fork'] = true; [h] } %> + +## Create a fork + +Create a fork for the authenticated user. + + POST /repos/:owner/:repo/forks + +One can either use the `organization` parameter or POST a JSON document with +the field `organization` + +### Parameters + +Name | Type | Description +-----|------|------------- +`organization`|`string` | The organization login. The repository will be forked into this organization. + + +### Response + +Forking a Repository happens asynchronously. Therefore, you may have to wait +a short period before accessing the git objects. If this takes longer than +5 minutes, be sure to [contact Support](https://github.com/contact?form[subject]=APIv3). + +<%= headers 202 %> +<%= json(:repo) { |h| h['fork'] = true; h } %> diff --git a/content/v3/repos/hooks.md b/content/v3/repos/hooks.md new file mode 100644 index 0000000000..0f3f5d2cb9 --- /dev/null +++ b/content/v3/repos/hooks.md @@ -0,0 +1,218 @@ +--- +title: Repository Webhooks | GitHub API +--- + +# Webhooks + +* TOC +{:toc} + +The Repository Webhooks API allows repository admins to manage the post-receive +hooks for a repository. Webhooks can be managed using the JSON HTTP API, +or the [PubSubHubbub API](#pubsubhubbub). + +If you would like to set up a single webhook to receive events from all of your organization's respositories, check out our [API documentation for Organization Webhooks][org-hooks]. + +## List hooks + + GET /repos/:owner/:repo/hooks + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:hook) { |h| [h] } %> + +## Get single hook + + GET /repos/:owner/:repo/hooks/:id + +### Response + +<%= headers 200 %> +<%= json :hook %> + +## Create a hook + + POST /repos/:owner/:repo/hooks + +**Note**: Repository service hooks (like email or Campfire) can have at most one configured at a time. Creating hooks for a service that already has one configured will [update the existing hook](#edit-a-hook). + +Repositories can have multiple webhooks installed. Each webhook should have a unique `config`. Multiple webhooks can share the same `config` as long as those webhooks do not have any `events` that overlap. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The name of the service that is being called. (See /hooks for the list of valid hook names.) +`config`|`object` | **Required**. Key/value pairs to provide settings for this hook. These settings vary between the services and are defined in the [github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON `true`/`false` values will be converted automatically. +`events`|`array` | Determines what events the hook is triggered for. Default: `["push"]` +`active`|`boolean` | Determines whether the hook is actually triggered on pushes. + +#### Example + +To create [a webhook](/webhooks), [the following fields are required](https://github.com/github/github-services/blob/master/lib/services/web.rb#L4-11) by the `config`: + +* `url`: A required string defining the URL to which the payloads will be delivered. +* `content_type`: An optional string defining the media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. +* `secret`: An optional string that's passed with the HTTP requests as an `X-Hub-Signature` header. The value of this header is computed as the [HMAC hex digest of the body, using the `secret` as the key][hub-signature]. +* `insecure_ssl`: An optional string that determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `"0"` (verification is performed) and `"1"` (verification is not performed). The default is `"0"`. + +Here's how you can create a hook that posts payloads in JSON format: + +<%= json \ + :name => "web", + :active => true, + :events => ['push', 'pull_request'], + :config => { + :url => 'http://example.com/webhook', + :content_type => 'json'} +%> + +### Response + +<%= headers 201, :Location => get_resource(:hook)['url'] %> +<%= json :hook %> + +## Edit a hook + + PATCH /repos/:owner/:repo/hooks/:id + +### Parameters + +Name | Type | Description +-----|------|-------------- +`config`|`object` | Key/value pairs to provide settings for this hook. Modifying this will replace the entire config object. These settings vary between the services and are defined in the [github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON `true`/`false` values will be converted automatically. +`events`|`array` | Determines what events the hook is triggered for. This replaces the entire array of events. Default: `["push"]` +`add_events`|`array` | Determines a list of events to be added to the list of events that the Hook triggers for. +`remove_events`|`array` | Determines a list of events to be removed from the list of events that the Hook triggers for. +`active`|`boolean` | Determines whether the hook is actually triggered on pushes. + + +#### Example + +<%= json \ + :active => true, + :add_events => ['pull_request'] +%> + +### Response + +<%= headers 200 %> +<%= json :hook %> + +## Test a `push` hook + +This will trigger the hook with the latest push to the current +repository if the hook is subscribed to `push` events. If the +hook is not subscribed to `push` events, the server will respond +with 204 but no test POST will be generated. + + POST /repos/:owner/:repo/hooks/:id/tests + +**Note**: Previously `/repos/:owner/:repo/hooks/:id/test` + +### Response + +<%= headers 204 %> + +## Ping a hook + +This will trigger a [ping event][ping-event-url] to be sent to the hook. + + POST /repos/:owner/:repo/hooks/:id/pings + +### Response + +<%= headers 204 %> + +## Delete a hook + + DELETE /repos/:owner/:repo/hooks/:id + +### Response + +<%= headers 204 %> + +## Receiving Webhooks + +In order for GitHub to send webhook payloads, your server needs to be accessible from the Internet. We also highly suggest using SSL so that we can send encrypted payloads over HTTPS. + +### Webhook Headers + +GitHub will send along several HTTP headers to differentiate between event types and payload identifiers. + +Name | Description +-----|-----------| +`X-GitHub-Event` | The [event type](/v3/activity/events/types/) that was triggered. +`X-GitHub-Delivery` | A [guid][guid] to identify the payload and event being sent. +`X-Hub-Signature` | The value of this header is computed as the HMAC hex digest of the body, using the `secret` config option as the key. + +## PubSubHubbub + +GitHub can also serve as a [PubSubHubbub][pubsub] hub for all repositories. +PSHB is a simple publish/subscribe protocol +that lets servers register to receive updates when a topic is updated. +The updates are sent with an HTTP POST request to a callback URL. +Topic URLs for a GitHub repository's pushes are in this format: + + https://github.com/:owner/:repo/events/:event + +The event can be any [event][events-url] string that is listed at the top of this +document. + +### Response format + +The default format is what [existing post-receive hooks should +expect][post-receive]: A JSON body sent as the `payload` parameter in a +POST. You can also specify to receive the raw JSON body with either an +`Accept` header, or a `.json` extension. + + Accept: application/json + https://github.com/:owner/:repo/events/push.json + +### Callback URLs + +Callback URLs can use either the `http://` protocol, or `github://`. +`github://` callbacks specify a GitHub service. + + # Send updates to postbin.org + http://postbin.org/123 + + # Send updates to Campfire + github://campfire?subdomain=github&room=Commits&token=abc123 + +### Subscribing + +The GitHub PubSubHubbub endpoint is: https://api.github.com/hub. +(GitHub Enterprise users should use http://yourhost/api/v3/hub as the +PubSubHubbub endpoint, but not change the `hub.topic` URI format.) A +successful request with curl looks like: + + curl -u "user" -i \ + https://api.github.com/hub \ + -F "hub.mode=subscribe" \ + -F "hub.topic=https://github.com/:owner/:repo/events/push" \ + -F "hub.callback=http://postbin.org/123" + +PubSubHubbub requests can be sent multiple times. If the hook already +exists, it will be modified according to the request. + +#### Parameters + +Name | Type | Description +-----|------|-------------- +``hub.mode``|`string` | **Required**. Either `subscribe` or `unsubscribe`. +``hub.topic``|`string` |**Required**. The URI of the GitHub repository to subscribe to. The path must be in the format of `/:owner/:repo/events/:event`. +``hub.callback``|`string` | The URI to receive the updates to the topic. +``hub.secret``|`string` | A shared secret key that generates a SHA1 HMAC of the outgoing body content. You can verify a push came from GitHub by comparing the raw request body with the contents of the `X-Hub-Signature` header. You can see [our Ruby implementation][ruby-secret], or [the PubSubHubbub documentation][pshb-secret] for more details. + + +[guid]: http://en.wikipedia.org/wiki/Globally_unique_identifier +[pubsub]: http://code.google.com/p/pubsubhubbub/ +[post-receive]: http://help.github.com/post-receive-hooks/ +[ruby-secret]: https://github.com/github/github-services/blob/14f4da01ce29bc6a02427a9fbf37b08b141e81d9/lib/services/web.rb#L47-L50 +[hub-signature]: https://github.com/github/github-services/blob/f3bb3dd780feb6318c42b2db064ed6d481b70a1f/lib/service/http_helper.rb#L77 +[pshb-secret]: http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html#authednotify +[events-url]: /webhooks/#events +[ping-event-url]: /webhooks/#ping-event +[org-hooks]: /v3/orgs/hooks/ diff --git a/content/v3/repos/keys.md b/content/v3/repos/keys.md new file mode 100644 index 0000000000..ba314fdb23 --- /dev/null +++ b/content/v3/repos/keys.md @@ -0,0 +1,52 @@ +--- +title: Deploy Keys | GitHub API +--- + +# Deploy Keys + +* TOC +{:toc} + +## List deploy keys {#list} + + GET /repos/:owner/:repo/keys + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:deploy_key) { |h| [h] } %> + +## Get a deploy key {#get} + + GET /repos/:owner/:repo/keys/:id + +### Response + +<%= headers 200 %> +<%= json :deploy_key %> + +## Add a new deploy key {#create} + + POST /repos/:owner/:repo/keys + +### Input + +<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %> + +### Response + +<%= headers 201, :Location => get_resource(:deploy_key)['url'] %> +<%= json :deploy_key %> + +## Edit a deploy key {#edit} + +Deploy keys are immutable. If you need to update a key, [remove the +key](#delete) and [create a new one](#create) instead. + +## Remove a deploy key {#delete} + + DELETE /repos/:owner/:repo/keys/:id + +### Response + +<%= headers 204 %> diff --git a/content/v3/repos/merging.md b/content/v3/repos/merging.md new file mode 100644 index 0000000000..7d4734014a --- /dev/null +++ b/content/v3/repos/merging.md @@ -0,0 +1,59 @@ +--- +title: Merging | GitHub API +--- + +# Merging + +* TOC +{:toc} + +The Repo Merging API supports merging branches in a repository. This accomplishes +essentially the same thing as merging one branch into another in a local repository +and then pushing to GitHub. The benefit is that the merge is done on the server side +and a local repository is not needed. This makes it more appropriate for automation +and other tools where maintaining local repositories would be cumbersome and inefficient. + +The authenticated user will be the author of any merges done through this endpoint. + +## Perform a merge + + POST /repos/:owner/:repo/merges + +### Input + +Name | Type | Description +-----|------|-------------- +`base`|`string` | **Required**. The name of the base branch that the head will be merged into. +`head`|`string` | **Required**. The head to merge. This can be a branch name or a commit SHA1. +`commit_message`|`string` | Commit message to use for the merge commit. If omitted, a default message will be used. + + +<%= json \ + :base => "master", + :head => "cool_feature", + :commit_message => "Shipped cool_feature!" +%> + +### Successful Response *(The resulting merge commit)* + +<%= headers 201 %> +<%= json(:merge_commit) %> + +### No-op response (base already contains the head, nothing to merge) + +<%= headers 204 %> + +### Merge conflict response + +<%= headers 409 %> +<%= json({ :message => "Merge Conflict" }) %> + +### Missing base response + +<%= headers 404 %> +<%= json(:message => "Base does not exist") %> + +### Missing head response + +<%= headers 404 %> +<%= json(:message => "Head does not exist") %> diff --git a/content/v3/repos/pages.md b/content/v3/repos/pages.md new file mode 100644 index 0000000000..d952319a0f --- /dev/null +++ b/content/v3/repos/pages.md @@ -0,0 +1,42 @@ +--- +title: Pages | GitHub API +--- + +# Pages + +* TOC +{:toc} + +The Pages API retrieves information about your GitHub Pages configuration, and +the statuses of your builds. Information about the site and the builds can only be +accessed by authenticated owners, even though the websites are public. + +In JSON responses, `status` can be one of: + +* `null`, which means the site has yet to be built +* `building`, which means the build is in progress +* `built`, which means the site has been built +* `errored`, which indicates an error occurred during the build + +## Get information about a Pages site + + GET /repos/:owner/:repo/pages + +### Response + +<%= headers 200 %> +<%= json(:pages) %> + +## List Pages builds + + GET /repos/:owner/:repo/pages/builds + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:pages_build) { |h| [h] } %> + +## List latest Pages build + + GET /repos/:owner/:repo/pages/builds/latest + +<%= headers 200 %> +<%= json(:pages_build) %> diff --git a/content/v3/repos/releases.md b/content/v3/repos/releases.md new file mode 100644 index 0000000000..2e8bb23398 --- /dev/null +++ b/content/v3/repos/releases.md @@ -0,0 +1,237 @@ +--- +title: Releases | GitHub API +--- + +# Releases + +* TOC +{:toc} + +## List releases for a repository + +Information about published releases are available to everyone. +Only users with push access will receive listings for draft releases. + + GET /repos/:owner/:repo/releases + +**Note:** This returns a list of releases, which does not include regular +Git tags that have not been associated with a release. +(To get a list of Git tags, use the [Repository Tags API][repo tags api].) + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:release) { |h| [h] } %> + +## Get a single release + + GET /repos/:owner/:repo/releases/:id + +### Response + +{{#tip}} + + + +**Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://developer.github.com/v3/#hypermedia). + +{{/tip}} + +<%= headers 200 %> +<%= json :release %> + +## Get the latest release + +View the latest published release for the repository. + + GET /repos/:owner/:repo/releases/latest + +### Response + +<%= headers 200 %> +<%= json :release %> + +## Get a release by tag name + +Get a release with the specified tag. Users must have push access to the repository to view draft releases. + + GET /repos/:owner/:repo/releases/tags/:tag + +### Response + +<%= headers 200 %> +<%= json :release %> + + +## Create a release + +Users with push access to the repository can create a release. + + POST /repos/:owner/:repo/releases + +### Input + +Name | Type | Description +-----|------|-------------- +`tag_name`|`string` | **Required**. The name of the tag. +`target_commitish`|`string` | Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`). +`name`|`string` | The name of the release. +`body`|`string` | Text describing the contents of the tag. +`draft`|`boolean` | `true` to create a draft (unpublished) release, `false` to create a published one. Default: `false` +`prerelease`|`boolean` | `true` to identify the release as a prerelease. `false` to identify the release as a full release. Default: `false` + +#### Example + +<%= json \ + :tag_name => "v1.0.0", + :target_commitish => "master", + :name => "v1.0.0", + :body => "Description of the release", + :draft => false, + :prerelease => false +%> + +### Response + +<%= headers 201, :Location => get_resource(:created_release)['url'] %> +<%= json(:created_release) %> + +## Edit a release + +Users with push access to the repository can edit a release. + + PATCH /repos/:owner/:repo/releases/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`tag_name`|`string` | The name of the tag. +`target_commitish`|`string` | Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`). +`name`|`string` | The name of the release. +`body`|`string` | Text describing the contents of the tag. +`draft`|`boolean` | `true` makes the release a draft, and `false` publishes the release. +`prerelease`|`boolean` | `true` to identify the release as a prerelease, `false` to identify the release as a full release. + +#### Example + +<%= json \ + :tag_name => "v1.0.0", + :target_commitish => "master", + :name => "v1.0.0", + :body => "Description of the release", + :draft => false, + :prerelease => false +%> + +### Response + +<%= headers 200 %> +<%= json :release %> + +## Delete a release + +Users with push access to the repository can delete a release. + + DELETE /repos/:owner/:repo/releases/:id + +### Response + +<%= headers 204 %> + +## List assets for a release + + GET /repos/:owner/:repo/releases/:id/assets + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:release_asset) { |h| [h] } %> + +## Upload a release asset + +This endpoint makes use of [a Hypermedia relation](/v3/#hypermedia) to determine which URL to access. +This endpoint is provided by a URI template in [the release's API response](#get-a-single-release). +You need to use an HTTP client which supports +SNI to make calls to this endpoint. + +The asset data is expected in its raw binary form, rather than JSON. +Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset. + + POST https:///repos/:owner/:repo/releases/:id/assets?name=foo.zip + + +### Input + +The raw file is uploaded to GitHub. Set the content type appropriately, and the +asset's name in a URI query parameter. + +Name | Type | Description +-----|------|-------------- +`Content-Type`|`string` | **Required**. The content type of the asset. This should be set in the Header. Example: `"application/zip"`. For a list of acceptable types, refer this list of [common media types](http://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types). +`name`|`string` | **Required**. The file name of the asset. This should be set in the URI query parameter. + + +Send the raw binary content of the asset as the request body. + +### Response for successful upload + +<%= headers 201 %> +<%= json :release_asset %> + +### Response for upstream failure + +This may leave an empty asset with a state of `"new"`. It can be safely deleted. + +<%= headers 502 %> + +## Get a single release asset + + GET /repos/:owner/:repo/releases/assets/:id + +### Response + +<%= headers 200 %> +<%= json :release_asset %> + +If you want to download the asset's binary content, pass a media type of +`"application/octet-stream"`. The API will either redirect the client to the +location, or stream it directly if possible. API clients should handle both a +`200` or `302` response. + +<%= headers 302 %> + +## Edit a release asset + +Users with push access to the repository can edit a release asset. + + PATCH /repos/:owner/:repo/releases/assets/:id + +### Input + +Name | Type | Description +-----|------|-------------- +`name`|`string` | **Required**. The file name of the asset. +`label`|`string` | An alternate short description of the asset. Used in place of the filename. + +#### Example + +<%= json \ + :name => "foo-1.0.0-osx.zip", + :label => "Mac binary" +%> + +### Response + +<%= headers 200 %> +<%= json :release_asset %> + +## Delete a release asset + + DELETE /repos/:owner/:repo/releases/assets/:id + +### Response + +<%= headers 204 %> + +[repo tags api]: /v3/repos/#list-tags diff --git a/content/v3/repos/statistics.md b/content/v3/repos/statistics.md new file mode 100644 index 0000000000..225aaa9152 --- /dev/null +++ b/content/v3/repos/statistics.md @@ -0,0 +1,99 @@ +--- +title: Statistics | GitHub API +--- + +# Statistics + +* TOC +{:toc} + +The Repository Statistics API allows you to fetch the data that GitHub uses for visualizing different +types of repository activity. + +### A word about caching + +Computing repository statistics is an expensive operation, so we try to return cached +data whenever possible. If the data hasn't been cached when you query a repository's +statistics, you'll receive a `202` response; a background job is also fired to +start compiling these statistics. Give the job a few moments to complete, and +then submit the request again. If the job has completed, that request will receive a +`200` response with the statistics in the response body. + +Repository statistics are cached by the SHA of the repository's default branch, +which is usually master; pushing to the default branch resets the statistics cache. + +## Get contributors list with additions, deletions, and commit counts {#contributors} + + GET /repos/:owner/:repo/stats/contributors + +### Response + +<%= headers 200 %> +<%= json(:repo_stats_contributors) %> + +* `total` - The Total number of commits authored by the contributor. + +**Weekly Hash** + +* `w` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). +* `a` - Number of additions +* `d` - Number of deletions +* `c` - Number of commits + + +## Get the last year of commit activity data {#commit-activity} + +Returns the last year of commit activity grouped by week. The `days` array +is a group of commits per day, starting on `Sunday`. + + GET /repos/:owner/:repo/stats/commit_activity + +### Response + +<%= headers 200 %> +<%= json(:repo_stats_commit_activity) %> + +## Get the number of additions and deletions per week {#code-frequency} + + GET /repos/:owner/:repo/stats/code_frequency + +### Response + +Returns a weekly aggregate of the number of additions and deletions pushed +to a repository. + +<%= headers 200 %> +<%= json(:repo_stats_code_frequency) %> + +## Get the weekly commit count for the repository owner and everyone else {#participation} + + GET /repos/:owner/:repo/stats/participation + +### Response + +Returns the total commit counts for the `owner` and total commit counts in `all`. +`all` is everyone combined, including the `owner` in the last 52 weeks. If you'd like to get the commit +counts for non-owners, you can subtract `owner` from `all`. + +The array order is oldest week (index 0) to most recent week. + +<%= headers 200 %> +<%= json(:repo_stats_participation) %> + +## Get the number of commits per hour in each day {#punch-card} + + GET /repos/:owner/:repo/stats/punch_card + +### Response + +Each array contains the day number, hour number, and number of commits: + +* `0-6`: Sunday - Saturday +* `0-23`: Hour of day +* Number of commits + +For example, `[2, 14, 25]` indicates that there were 25 total commits, during the +2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. + +<%= headers 200 %> +<%= json(:repo_stats_punch_card) %> diff --git a/content/v3/repos/statuses.md b/content/v3/repos/statuses.md new file mode 100644 index 0000000000..8f6a1c9450 --- /dev/null +++ b/content/v3/repos/statuses.md @@ -0,0 +1,117 @@ +--- +title: Statuses | GitHub API +--- + +# Statuses + +* TOC +{:toc} + +The Status API allows external services to mark commits with a success, +failure, error, or pending `state`, which is then reflected in pull requests +involving those commits. + +Statuses can also include an optional `description` and `target_url`, and +we highly recommend providing them as they make statuses much more +useful in the GitHub UI. + +As an example, one common use is for continuous integration +services to mark commits as passing or failing builds using Status. The +`target_url` would be the full URL to the build output, and the +`description` would be the high level summary of what happened with the +build. + +Statuses can include a `context` to indicate what service is providing that status. +For example, you may have your continuous integration service push statuses with a context of `ci`, +and a security audit tool push statuses with a context of `security`. You can +then use the [combined status endpoint](https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref) +to retrieve the whole status for a commit. + +Note that the `repo:status` [OAuth scope](/v3/oauth/#scopes) grants targeted +access to Statuses **without** also granting access to repository code, while the +`repo` scope grants permission to code as well as statuses. + +## Create a Status + +Users with push access can create commit statuses for a given ref: + + POST /repos/:owner/:repo/statuses/:sha + +Note: there is a limit of 1000 statuses per `sha` and `context` within a Repository. +Attempts to create more than 1000 statuses will result in a validation error. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, or `failure`. +`target_url`|`string` | The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the 'source' of the Status.
For example, if your Continuous Integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA:
`http://ci.example.com/user/repo/build/sha`. +`description`|`string` | A short description of the status. +`context`|`string` | A string label to differentiate this status from the status of other systems. Default: `"default"` + +#### Example + +<%= json \ + :state => "success", + :target_url => "https://example.com/build/status", + :description => "The build succeeded!", + :context => "continuous-integration/jenkins" +%> + +### Response + +<%= headers 201, :Location => get_resource(:status)['url'] %> +<%= json :status %> + +## List Statuses for a specific Ref + +Users with pull access can view commit statuses for a given ref: + + GET /repos/:owner/:repo/commits/:ref/statuses + +
+

+ This resource is also available via a legacy route: + GET /repos/:owner/:repo/statuses/:ref. +

+
+ +Statuses are returned in reverse chronological order. The first status in the +list will be the latest one. + +### Parameters + +Name | Type | Description +-----|------|-------------- +`ref`|`string` | **Required**. Ref to list the statuses from. It can be a SHA, a branch name, or a tag name. + + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:status) { |h| [h] } %> + +## Get the combined Status for a specific Ref + +Users with pull access can access a combined view of commit statuses for a given ref. + + GET /repos/:owner/:repo/commits/:ref/status + +The most recent status for each context is returned, up to 100. This field +[paginates](/v3/#pagination) if there are over 100 contexts. + +Additionally, a combined `state` is returned. The `state` is one of: + + * **failure** if any of the contexts report as error or failure + * **pending** if there are no statuses or a context is pending + * **success** if the latest status for all contexts is success + +### Parameters + +Name | Type | Description +-----|------|-------------- +`ref`|`string` | **Required**. Ref to fetch the status for. It can be a SHA, a branch name, or a tag name. + +### Response +<%= headers 200 %> +<%= json(:combined_status) %> diff --git a/content/v3/search.md b/content/v3/search.md new file mode 100644 index 0000000000..7a820d442d --- /dev/null +++ b/content/v3/search.md @@ -0,0 +1,422 @@ +--- +title: Search | GitHub API +--- + +# Search + +* TOC +{:toc} + +### About the Search API + +The Search API is optimized to help you find the specific item you're looking +for (e.g., a specific user, a specific file in a repository, etc.). Think of it +the way you think of performing a search on Google. It's designed to help you +find the one result you're looking for (or maybe the few results you're looking +for). Just like searching on Google, you sometimes want to see a few pages of +search results so that you can find the item that best meets your needs. To +satisfy that need, the GitHub Search API provides **up to 1,000 results for each +search**. + +### Ranking search results + +Unless another sort option is provided as a query parameter, results are sorted +by best match, as indicated by the `score` field for each item returned. This +is a computed value representing the relevance of a item relative to the other +items in the result set. Multiple factors are combined to boost the most +relevant item to the top of the result list. + +### Rate limit + +The Search API has a custom rate limit. For requests using [Basic +Authentication](/v3/#authentication), [OAuth](/v3/#authentication), or [client +ID and secret](/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications), you can make up to +20 requests per minute. For unauthenticated requests, the rate limit allows you +to make up to 5 requests per minute. + +See the [rate limit documentation](/v3/#rate-limiting) for details on +determining your current rate limit status. + +### Timeouts and incomplete results + +To keep the Search API fast for everyone, we limit how long any individual query +can run. For queries that [exceed the time limit](/changes/2014-04-07-understanding-search-results-and-potential-timeouts/), +the API returns the matches that were already found prior to the timeout, and +the response has the `incomplete_results` property set to `true`. + +Reaching a timeout does not necessarily mean that search results are incomplete. +More results might have been found, but also might not. + +## Search repositories + +Find repositories via various criteria. This method returns up to 100 results [per page](/v3/#pagination). + + GET /search/repositories + +### Parameters + +Name | Type | Description +-----|------|-------------- +`q`|`string`| The search keywords, as well as any qualifiers. +`sort`|`string`| The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match. +`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc` + +The `q` search term can also contain any combination of the supported repository search qualifiers: + +* [`in`](https://help.github.com/articles/searching-repositories#scope-the-search-fields) + Qualifies which fields are searched. With this qualifier you can restrict the + search to just the repository name, description, readme, or + any combination of these. +* [`size`](https://help.github.com/articles/searching-repositories#search-based-on-the-size-of-a-repository) + Finds repositories that match a certain size (in kilobytes). +* [`forks`](https://help.github.com/articles/searching-repositories#search-based-on-the-number-of-forks-the-parent-repository-has) + Filters repositories based on the number of forks, and/or whether forked repositories should be included in the results at all. +* [`created` or `pushed`](https://help.github.com/articles/searching-repositories#search-based-on-when-a-repository-was-created-or-last-updated) + Filters repositories based on date of creation, or when they were last updated. +* [`user` or `repo`](https://help.github.com/articles/searching-repositories#search-within-a-users-or-organizations-repositories) + Limits searches to a specific user or repository. +* [`language`](https://help.github.com/articles/searching-repositories#search-based-on-the-main-language-of-a-repository) + Searches repositories based on the language they're written in. +* [`stars`](https://help.github.com/articles/searching-repositories#search-based-on-the-number-of-stars-a-repository-has) + Searches repositories based on the number of stars. + +

Example

+ +Suppose you want to search for popular Tetris repositories written in Assembly. +Your query might look like this. + + https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc + +In this request, we're searching for repositories with the word `tetris` in the +name, the description, or the README. We're limiting the results to only find +repositories where the primary language is Assembly. We're sorting by stars in +descending order, so that the most popular repositories appear first in the +search results. + +<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= json(:repo_search_v3_results) %> + +### Highlighting Repository Search Results + +Some API consumers will want to highlight the matching search terms when +displaying search results. The API offers additional metadata to support this +use case. To get this metadata in your search results, specify the `text-match` +media type in your Accept header. For example, via curl, the above query would +look like this: + + curl -H 'Accept: application/vnd.github.v3.text-match+json' \ + https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc + +This produces the same JSON payload as above, with an extra key called +`text_matches`, an array of objects. These objects provide information such as +the position of your search terms within the text, as well as the property that +included the search term. + +When searching for repositories, you can get text match metadata for the +**name** and **description** fields. (See the section on [text match metadata +](#text-match-metadata) for full details.) + +Here's an example response: + +<%= json(:repo_search_v3_results_highlighting) %> + +## Search code + +Find file contents via various criteria. (This method returns up to 100 results [per page](/v3/#pagination).) + + GET /search/code + +### Considerations for code search + +Due to the complexity of searching code, there are a few restrictions on how searches are performed: + +
    +
  • Only the default branch is considered. In most cases, this will be the master branch.
  • +
  • Only files smaller than 384 KB are searchable.
  • +
  • You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.
  • +
+ +### Parameters + +Name | Type | Description +-----|------|-------------- +`q`|`string`| The search terms. +`sort`|`string`| The sort field. Can only be `indexed`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: results are sorted by best match. +`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc` + +The `q` search term can also contain any combination of the supported code search qualifiers: + +* [`in`](https://help.github.com/articles/searching-code#scope-the-search-fields) + Qualifies which fields are searched. With this qualifier you can restrict the + search to just the file contents, the file path, or both. +* [`language`](https://help.github.com/articles/searching-code#search-by-language) + Searches code based on the language it's written in. +* [`fork`](https://help.github.com/articles/searching-code#search-by-the-number-of-forks-the-parent-repository-has) + Specifies that code from forked repositories should be searched. Repository + forks will not be searchable unless the fork has more stars than the parent + repository. +* [`size`](https://help.github.com/articles/searching-code#search-by-the-size-of-the-parent-repository) + Finds files that match a certain size (in bytes). +* [`path`](https://help.github.com/articles/searching-code#search-by-the-location-of-a-file-within-the-repository) + Specifies the path that the resulting file must be at. +* [`filename`](https://help.github.com/articles/searching-code#search-by-filename) + Matches files by their filename. +* [`extension`](https://help.github.com/articles/searching-code#search-by-the-file-extension) + Matches files with a certain extension. +* [`user` or `repo`](https://help.github.com/articles/searching-code#search-within-a-users-or-organizations-repositories) + Limits searches to a specific user or repository. + +

Example

+ +Suppose you want to find the definition of the `addClass` function inside +[jQuery](https://github.com/jquery/jquery). Your query would look something like +this: + + https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery + +Here, we're searching for the keyword `addClass` within a file's contents. We're +making sure that we're only looking in files where the language is JavaScript. +And we're scoping the search to the `repo:jquery/jquery` repository. + +<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= json(:code_search_v3_results) %> + +### Highlighting Code Search Results + +Some API consumers will want to highlight the matching search terms when +displaying search results. The API offers additional metadata to support this +use case. To get this metadata in your search results, specify the `text-match` +media type in your Accept header. For example, via curl, the above query would +look like this: + + curl -H 'Accept: application/vnd.github.v3.text-match+json' \ + https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery + +This produces the same JSON payload as above, with an extra key called +`text_matches`, an array of objects. These objects provide information such as +the position of your search terms within the text, as well as the property that +included the search term. + +When searching for code, you can get text match metadata for the file +**content** and file **path** fields. (See the section on +[text match metadata](#text-match-metadata) for full details.) + +Here's an example response: + +<%= json(:code_search_v3_results_highlighting) %> + +## Search issues + +Find issues by state and keyword. (This method returns up to 100 results [per page](/v3/#pagination).) + + GET /search/issues + +### Parameters + +Name | Type | Description +-----|------|-------------- +`q`|`string`| The search terms. +`sort`|`string`| The sort field. Can be `comments`, `created`, or `updated`. Default: results are sorted by best match. +`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc` + +The `q` search term can also contain any combination of the supported issue search qualifiers: + + * [`type`](https://help.github.com/articles/searching-issues#search-issues-or-pull-requests) + With this qualifier you can restrict the search to issues or pull request only. + * [`in`](https://help.github.com/articles/searching-issues#scope-the-search-fields) + Qualifies which fields are searched. With this qualifier you can restrict the + search to just the title, body, comments, or any combination of these. + * [`author`](https://help.github.com/articles/searching-issues#search-by-the-author-of-an-issue-or-pull-request) + Finds issues or pull requests created by a certain user. + * [`assignee`](https://help.github.com/articles/searching-issues#search-by-the-assignee-of-an-issue-or-pull-request) + Finds issues or pull requests that are assigned to a certain user. + * [`mentions`](https://help.github.com/articles/searching-issues#search-by-a-mentioned-user-within-an-issue-or-pull-request) + Finds issues or pull requests that mention a certain user. + * [`commenter`](https://help.github.com/articles/searching-issues#search-by-a-commenter-within-an-issue-or-pull-request) + Finds issues or pull requests that a certain user commented on. + * [`involves`](https://help.github.com/articles/searching-issues#search-by-a-user-thats-involved-within-an-issue-or-pull-request) + Finds issues or pull requests that were either created by a certain user, assigned to that + user, mention that user, or were commented on by that user. + * [`team`](https://help.github.com/articles/searching-issues/#search-by-a-team-thats-mentioned-within-an-issue-or-pull-request) + For organizations you're a member of, finds issues or pull requests that @mention a team within the organization. + * [`state`](https://help.github.com/articles/searching-issues#search-based-on-whether-an-issue-or-pull-request-is-open) + Filter issues or pull requests based on whether they're open or closed. + * [`labels`](https://help.github.com/articles/searching-issues#search-by-the-labels-on-an-issue) + Filters issues or pull requests based on their labels. + * [`no`](https://help.github.com/articles/searching-issues#search-by-missing-metadata-on-an-issue-or-pull-request) + Filters items missing certain metadata, such as `label`, `milestone`, or `assignee` + * [`language`](https://help.github.com/articles/searching-issues#search-by-the-main-language-of-a-repository) + Searches for issues or pull requests within repositories that match a certain language. + * [`is`](https://help.github.com/articles/searching-issues#search-based-on-the-state-of-an-issue-or-pull-request) + Searches for items within repositories that match a certain state, such as `open`, `closed`, or `merged` + * [`created` or `updated`](https://help.github.com/articles/searching-issues#search-based-on-when-an-issue-or-pull-request-was-created-or-last-updated) + Filters issues or pull requests based on date of creation, or when they were last updated. + * [`merged`](https://help.github.com/articles/searching-issues#search-based-on-when-a-pull-request-was-merged) + Filters pull requests based on the date when they were merged. + * [`closed`](https://help.github.com/articles/searching-issues#search-based-on-when-an-issue-or-pull-request-was-closed) + Filters issues or pull requests based on the date when they were closed. + * [`comments`](https://help.github.com/articles/searching-issues#search-by-the-number-of-comments-an-issue-or-pull-request-has) + Filters issues or pull requests based on the quantity of comments. + * [`user` or `repo`](https://help.github.com/articles/searching-issues#search-within-a-users-or-organizations-repositories) + Limits searches to a specific user or repository. + + +If you know the specific SHA hash of a commit, you can use also [use it to search for pull requests](https://help.github.com/articles/searching-issues#search-by-the-commit-shas-within-a-pull-request) that contain that SHA. Note that the SHA syntax must be at least seven characters. + +

Example

+ +Let's say you want to find the oldest unresolved Python bugs on Windows. Your +query might look something like this. + + https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc + +In this query, we're searching for the keyword `windows`, within any open issue +that's labeled as `bug`. The search runs across repositories whose primary +language is Python. We’re sorting by creation date in ascending order, so that +the oldest issues appear first in the search results. + +<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= json(:issue_search_v3_results) %> + +### Highlighting Issue Search Results + +Some API consumers will want to highlight the matching search terms when +displaying search results. The API offers additional metadata to support this +use case. To get this metadata in your search results, specify the `text-match` +media type in your Accept header. For example, via curl, the above query would +look like this: + + curl -H 'Accept: application/vnd.github.v3.text-match+json' \ + https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc + +This produces the same JSON payload as above, with an extra key called +`text_matches`, an array of objects. These objects provide information such as +the position of your search terms within the text, as well as the property that +included the search term. + +When searching for issues, you can get text match metadata for the issue +**title**, issue **body**, and issue **comment body** fields. (See the section +on [text match metadata ](#text-match-metadata) for full details.) + +Here's an example response: + +<%= json(:issue_search_v3_results_highlighting) %> + +## Search users + +Find users via various criteria. (This method returns up to 100 results [per page](/v3/#pagination).) + + GET /search/users + +### Parameters + +Name | Type | Description +-----|------|-------------- +`q`|`string`| The search terms. +`sort`|`string`| The sort field. Can be `followers`, `repositories`, or `joined`. Default: results are sorted by best match. +`order`|`string`| The sort order if `sort` parameter is provided. One of `asc` or `desc`. Default: `desc` + +The `q` search term can also contain any combination of the supported user search qualifiers: + + * [`type`](https://help.github.com/articles/searching-users#search-for-users-or-organizations) + With this qualifier you can restrict the search to just personal accounts or + just organization accounts. + * [`in`](https://help.github.com/articles/searching-users#scope-the-search-fields) + Qualifies which fields are searched. With this qualifier you can restrict + the search to just the username, public email, full name, or any + combination of these. + * [`repos`](https://help.github.com/articles/searching-users#search-based-on-the-number-of-repositories-a-user-has) + Filters users based on the number of repositories they have. + * [`location`](https://help.github.com/articles/searching-users#search-based-on-the-location-where-a-user-resides) + Filter users by the location indicated in their profile. + * [`language`](https://help.github.com/articles/searching-users#search-based-on-the-languages-of-a-users-repositories) + Search for users that have repositories that match a certain language. + * [`created`](https://help.github.com/articles/searching-users#search-based-on-when-a-user-joined-github) + Filter users based on when they joined. + * [`followers`](https://help.github.com/articles/searching-users#search-based-on-the-number-of-followers-a-user-has) + Filter users based on the number of followers they have. + +

Example

+ +Imagine you're looking for a list of popular users. You might try out this query: + + https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000 + +Here, we're looking at users with the name Tom. We're only interested in those +with more than 42 repositories, and only if they have over 1,000 followers. + +<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= json(:user_search_v3_results) %> + +### Highlighting User Search Results + +Some API consumers will want to highlight the matching search terms when +displaying search results. The API offers additional metadata to support this +use case. To get this metadata in your search results, specify the `text-match` +media type in your Accept header. For example, via curl, the above query would +look like this: + + curl -H 'Accept: application/vnd.github.v3.text-match+json' \ + https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000 + +This produces the same JSON payload as above, with an extra key called +`text_matches`, an array of objects. These objects provide information such as +the position of your search terms within the text, as well as the property that +included the search term. + +When searching for users, you can get text match metadata for the issue +**login**, **email**, and **name** fields. (See the section on [text match +metadata](#text-match-metadata) for full details.) + +<%= json(:user_search_v3_results_highlighting) %> + +## Text match metadata + +On github.com, we enjoy the context provided by code snippets and highlights in +search results. + +[![code-snippet-highlighting](https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png)](https://f.cloud.github.com/assets/865/819651/959a4826-efb5-11e2-8af8-46c4a3857cdf.png) + +API consumers have access to that information as well. Requests can opt to +receive those text fragments in the response, and every fragment is accompanied +by numeric offsets identifying the exact location of each matching search term. + +To get this metadata in your search results, specify the `text-match` media type +in your Accept header. + + application/vnd.github.v3.text-match+json + +The results will provide the same JSON payloads as shown above, with an extra +key called `text_matches`. Inside the `text_matches` array, each object includes +the following attributes: + + +Name | Description +-----|-----------| +`object_url` | The URL for the resource that contains a string property matching one of the search terms. +`object_type` | The name for the type of resource that exists at the given `object_url`. +`property` | The name of a property of the resource that exists at `object_url`. That property is a string that matches one of the search terms. (In the JSON returned from `object_url`, the full content for the `fragment` will be found in the property with this name.) +`fragment` | A subset of the value of `property`. This is the text fragment that matches one or more of the search terms. +`matches` | An array of one or more search terms that are present in `fragment`. The indices (i.e., "offsets") are relative to the fragment. (They are not relative to the _full_ content of `property`.) + +### Example + +Using curl, and the [example issue search](#issue-search-example) above, our API +request would look like this: + + curl -H 'Accept: application/vnd.github.v3.text-match+json' \ + https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc + +The response will include a `text_matches` array for each search result. In the +JSON below, we have two objects in the `text_matches` array. + +The first text match occurred in the `body` property of the issue. We see a +fragment of text from the issue body. The search term (`windows`) appears twice +within that fragment, and we have the indices for each occurrence. + +The second text match occurred in the `body` property of one of the issue's +comments. We have the URL for the issue comment. And of course, we see a +fragment of text from the comment body. The search term (`windows`) appears once +within that fragment. + +<%= json(:issue_search_v3_results_highlighting) %> diff --git a/content/v3/search/legacy.md b/content/v3/search/legacy.md new file mode 100644 index 0000000000..eb2031b5fc --- /dev/null +++ b/content/v3/search/legacy.md @@ -0,0 +1,100 @@ +--- +title: Legacy Search | GitHub API +--- + +# Legacy Search + +* TOC +{:toc} + +This is a listing of the Legacy Search API features from API v2 that have been ported to API +v3. There should be no changes, other than the new URL and JSON output format. + +### Legacy Search API is Deprecated + +
+

+ The Legacy Search API (described below) is deprecated + and is scheduled for removal in the next major version of the API. + + We recommend using the v3 Search API instead. + It contains new endpoints and much more functionality. +

+
+ +## Search issues + +Find issues by state and keyword. + + GET /legacy/issues/search/:owner/:repository/:state/:keyword + +### Parameters + +Name | Type | Description +-----|------|-------------- +`state`|`string` | Indicates the state of the issues to return. Can be either `open` or `closed`. +`keyword`|`string`| The search term. + + +<%= headers 200 %> +<%= json(:issue_search_results) %> + +## Search repositories + +Find repositories by keyword. Note, this legacy method does not follow the +v3 pagination pattern. This method returns up to 100 results per page and +pages can be fetched using the `start_page` parameter. + + GET /legacy/repos/search/:keyword + +### Parameters + +Name | Type | Description +-----|------|-------------- +`keyword`|`string`| The search term| +`language`|`string` | Filter results by language +`start_page`|`string` | The page number to fetch +`sort`|`string` | The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match. +`order`|`string` | The sort field. if `sort` param is provided. Can be either `asc` or `desc`. + + +<%= headers 200 %> +<%= json(:repo_search_results) %> + +## Search users + +Find users by keyword. + + GET /legacy/user/search/:keyword + +### Parameters + +Name | Type | Description +-----|------|-------------- +`keyword`|`string`| The search term +`start_page`|`string` | The page number to fetch +`sort`|`string`| The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match. +`order`|`string`| The sort field. if `sort` param is provided. Can be either `asc` or `desc`. + + +<%= headers 200 %> +<%= json(:user_search_results) %> + +## Email search + +This API call is added for compatibility reasons only. There's no guarantee +that full email searches will always be available. The `@` character in the +address must be left unencoded. Searches only against public email addresses +(as configured on the user's GitHub profile). + + GET /legacy/user/email/:email + +### Parameters + +Name | Type | Description +-----|------|-------------- +`email`|`string`| The email address + + +<%= headers 200 %> +<%= json(:email_search_results) %> diff --git a/content/v3/troubleshooting.md b/content/v3/troubleshooting.md new file mode 100644 index 0000000000..ff4e3c96a4 --- /dev/null +++ b/content/v3/troubleshooting.md @@ -0,0 +1,44 @@ +--- +title: Troubleshooting | GitHub API +--- + +# Troubleshooting + +* TOC +{:toc} + +If you're encountering some oddities in the API, here's a list of resolutions to +some of the problems you may be experiencing. + +## Why am I getting a `404` error on a repository that exists? + +Typically, we send a `404` error when your client isn't properly authenticated. +You might expect to see a `403 Forbidden` in these cases. However, since we don't +want to provide _any_ information about private repositories, the API returns a +`404` error instead. + +To fix this, you can either ensure that [you're authenticating correctly](/guides/getting-started/), +or [make sure that your scopes are valid](/v3/oauth/#scopes). + +## Why am I not seeing all my results? + +Most API calls accessing a list of resources (_e.g._, users, issues, _e.t.c._) support +pagination. If you're making requests and receiving an incomplete set of results, you're +probably only seeing the first page. You'll need to request the remaining pages +in order to get more results. + +It's important to *not* try and guess the format of the pagination URL. Not every +API call uses the same structure. Instead, extract the pagination information from +[the Link Header](/v3/#pagination), which is sent with every request. + +## Can I get my rate limits bumped? + +The GitHub API has a pretty lenient quota for rate limits, for your enjoyment and +our safety. You can read more about it [here](/v3/#rate-limiting). + +If you're using OAuth or Basic Authentication and are hitting your rate limits, +you might be able to fix the issue by either caching our results, or [using conditional requests](/v3/#conditional-requests). + +In certain exceptional cases, we may temporarily bump your rate limit higher. You +should be prepared to answer technical questions about your goal and your planned usage of the API. We may still choose not to bump your limit if we feel that you can achieve your wildest +dreams with the current rate limit (but don't worry, we'll help you out). diff --git a/content/v3/users.md b/content/v3/users.md new file mode 100644 index 0000000000..9635358b9f --- /dev/null +++ b/content/v3/users.md @@ -0,0 +1,91 @@ +--- +title: Users | GitHub API +--- + +# Users + +* TOC +{:toc} + +Many of the resources on the users API provide a shortcut for getting +information about the currently authenticated user. If a request URL +does not include a `:username` parameter then the response will be for the +logged in user (and you must pass [authentication +information](/v3/#authentication) with your request). + +## Get a single user + + GET /users/:username + +### Response + +<%= headers 200 %> +<%= json :full_user %> + +Note: The returned email is the user's publicly visible email address +(or `null` if the user has not [specified a public email address in their profile](https://github.com/settings/profile)). + +## Get the authenticated user + + GET /user + +### Response + +<%= headers 200 %> +<%= json :private_user %> + +## Update the authenticated user + + PATCH /user + +### Parameters + +Name | Type | Description +-----|------|-------------- +`name`|`string` | The new name of the user +`email`|`string` | Publicly visible email address. +`blog`|`string` | The new blog URL of the user. +`company`|`string` | The new company of the user. +`location`|`string` | The new location of the user. +`hireable`|`boolean` | The new hiring availability of the user. +`bio`|`string` | The new short biography of the user. + +#### Example + +<%= json \ + :name => "monalisa octocat", + :email => "octocat@github.com", + :blog => "https://github.com/blog", + :company => "GitHub", + :location => "San Francisco", + :hireable => true, + :bio => "There once..." +%> + +### Response + +<%= headers 200 %> +<%= json :private_user %> + +## Get all users + +This provides a dump of every user, in the order that they signed up for +GitHub. + +Note: Pagination is powered exclusively by the `since` parameter. +Use the [Link header](/v3/#link-header) to get the URL for the next page of +users. + + GET /users + +### Parameters + +Name | Type | Description +-----|------|-------------- +`since`|`string`| The integer ID of the last User that you've seen. + + +### Response + +<%= headers 200, :pagination => { :next => 'https://api.github.com/users?since=135' } %> +<%= json(:user) { |h| [h] } %> diff --git a/content/v3/users/administration.md b/content/v3/users/administration.md new file mode 100644 index 0000000000..68c8b93646 --- /dev/null +++ b/content/v3/users/administration.md @@ -0,0 +1,68 @@ +--- +title: User Administration | GitHub API +--- + +# Administration (Enterprise) + +* TOC +{:toc} + +The User Administration API allows you to promote, demote, suspend, and unsuspend users on a GitHub Enterprise appliance. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `403` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +
+http(s)://hostname/api/v3
+
+ +## Promote an ordinary user to a site administrator + + PUT /users/:username/site_admin + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Demote a site administrator to an ordinary user + + DELETE /users/:username/site_admin + +You can demote any user account except your own. + +### Response + +<%= headers 204 %> + +## Suspend a user + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be suspended via the API. + +{{/warning}} + + PUT /users/:username/suspended + +You can suspend any user account except your own. + +<%= fetch_content(:put_content_length) %> + +### Response + +<%= headers 204 %> + +## Unsuspend a user + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync with Active Directory LDAP servers](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap), this API is disabled and will return a `403` response. Users managed by an external account cannot be unsuspended via the API. + +{{/warning}} + + DELETE /users/:username/suspended + +### Response + +<%= headers 204 %> diff --git a/content/v3/users/emails.md b/content/v3/users/emails.md new file mode 100644 index 0000000000..fd7aab4211 --- /dev/null +++ b/content/v3/users/emails.md @@ -0,0 +1,85 @@ +--- +title: User Emails | GitHub API +--- + +# Emails + +* TOC +{:toc} + +Management of email addresses via the API requires that you are +authenticated through basic auth or OAuth with the user scope. + +## List email addresses for a user + + GET /user/emails + +This endpoint is accessible with the user:email scope. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user_email) {|e| [e]} %> + +## Add email address(es) + +{{#enterprise-only}} + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an email address via the API with these options enabled. + +{{/warning}} + +{{/enterprise-only}} + + POST /user/emails + +### Input + +You can post a single email address or an array of addresses: + +<%= json ["octocat@github.com", "support@github.com"] %> + +### Response + +<%= headers 201 %> +<%= json [ + { + "email" => "octocat@github.com", + "primary" => false, + "verified" => false + }, + { + "email" => "support@github.com", + "primary" => false, + "verified" => false + }, +] %> + +## Delete email address(es) + +{{#enterprise-only}} + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize emails enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an email address via the API with these options enabled. + +{{/warning}} + +{{/enterprise-only}} + + DELETE /user/emails + +### Input + +You can include a single email address or an array of addresses: + +<%= json ["octocat@github.com", "support@github.com"] %> + +### Response + +<%= headers 204 %> + + +[media-types]: /v3/media diff --git a/content/v3/users/followers.md b/content/v3/users/followers.md new file mode 100644 index 0000000000..7989914107 --- /dev/null +++ b/content/v3/users/followers.md @@ -0,0 +1,86 @@ +--- +title: User Followers | GitHub API +--- + +# Followers + +* TOC +{:toc} + +## List followers of a user + +List a user's followers: + + GET /users/:username/followers + +List the authenticated user's followers: + + GET /user/followers + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## List users followed by another user + +List who a user is following: + + GET /users/:username/following + +List who the authenticated user is following: + + GET /user/following + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:user) { |h| [h] } %> + +## Check if you are following a user + + GET /user/following/:username + +### Response if you are following this user + +<%= headers 204 %> + +### Response if you are not following this user + +<%= headers 404 %> + +## Check if one user follows another + + GET /users/:username/following/:target_user + +### Response if user follows target user + +<%= headers 204 %> + +### Response if user does not follow target user + +<%= headers 404 %> + +## Follow a user + + PUT /user/following/:username + +<%= fetch_content(:put_content_length) %> + +Following a user requires the user to be logged in and authenticated with basic +auth or OAuth with the `user:follow` scope. + +### Response + +<%= headers 204 %> + +## Unfollow a user + + DELETE /user/following/:username + +Unfollowing a user requires the user to be logged in and authenticated with basic +auth or OAuth with the `user:follow` scope. + +### Response + +<%= headers 204 %> diff --git a/content/v3/users/keys.md b/content/v3/users/keys.md new file mode 100644 index 0000000000..c376ce1567 --- /dev/null +++ b/content/v3/users/keys.md @@ -0,0 +1,99 @@ +--- +title: User Public Keys | GitHub API +--- + +# Public Keys + +* TOC +{:toc} + +## List public keys for a user + + GET /users/:username/keys + +Lists the _verified_ public keys for a user. This is accessible by anyone. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:simple_public_key) { |h| [h] } %> + + +## List your public keys + + GET /user/keys + +Lists the current user's keys. Requires that you are authenticated via +Basic Auth or via OAuth with at least `read:public_key` +[scope](/v3/oauth/#scopes). + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:public_key) { |h| [h] } %> + +## Get a single public key + +View extended details for a single public key. Requires that you are +authenticated via Basic Auth or via OAuth with at least `read:public_key` +[scope](/v3/oauth/#scopes). + + GET /user/keys/:id + +### Response + +<%= headers 200 %> +<%= json :public_key %> + +## Create a public key + +Creates a public key. Requires that you are authenticated via Basic Auth, +or OAuth with at least `write:public_key` [scope](/v3/oauth/#scopes). + +{{#enterprise-only}} + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to add an SSH key address via the API with these options enabled. + +{{/warning}} + +{{/enterprise-only}} + + POST /user/keys + +### Input + +<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %> + +### Response + +<%= headers 201, :Location => get_resource(:public_key)['url'] %> +<%= json :public_key %> + +## Update a public key + +Public keys are immutable. If you need to update a public key, [remove the +key](#delete-a-public-key) and [create a new one](#create-a-public-key) +instead. + +## Delete a public key + +Removes a public key. Requires that you are authenticated via Basic Auth +or via OAuth with at least `admin:public_key` [scope](/v3/oauth/#scopes). + +{{#enterprise-only}} + +{{#warning}} + +If your GitHub Enterprise appliance has [LDAP Sync enabled](https://help.github.com/enterprise/2.1/admin/guides/user-management/using-ldap) and the option to synchronize SSH keys enabled, this API is disabled and will return a `403` response. Users managed in LDAP won't be able to remove an SSH key address via the API with these options enabled. + +{{/warning}} + +{{/enterprise-only}} + + DELETE /user/keys/:id + +### Response + +<%= headers 204 %> diff --git a/content/v3/versions.md b/content/v3/versions.md new file mode 100644 index 0000000000..1b7a6217ca --- /dev/null +++ b/content/v3/versions.md @@ -0,0 +1,172 @@ +--- +title: Versions | GitHub API +--- +# Versions + +There are two stable versions of the GitHub API: the [v3](#v3) version and the deprecated [beta](#beta) version. There are just a few [differences between these two versions](#differences-from-beta-version). + +By default, all requests receive the v3 version. We encourage you to [request a specific version via the `Accept` header](/v3/media/#request-specific-version). + +# v3 + +The [v3 API](/v3) is stable and unchangeable. Please [file a support issue][support] if you have problems. + +Some v3 functionality is [deprecated](#v3-deprecations) and will be removed in the next major version of the API. + +## Differences from beta version + +The v3 media type differs from the beta media type in just a few places: + +### Gist JSON + +For [Gists](/v3/gists/#get-a-single-gist), the v3 media type renames the `user` attribute to `owner`. + +### Issue JSON + +When an [issue](/v3/issues/#get-a-single-issue) is not a pull request, the v3 media type omits the `pull_request` attribute. + +### Repository JSON + +For [Repositories](/v3/repos/#get), the v3 media type omits the `master_branch` attribute. API clients should use the `default_branch` attribute to obtain the repository's default branch. + +### User Emails JSON + +For [User Emails](/v3/users/emails/#list-email-addresses-for-a-user), the v3 media type returns an array of objects (instead of an array of strings). + +## v3 deprecations + +The following functionality is deprecated. For backwards compatibility purposes, +v3 will continue to provide this functionality. However, this deprecated +functionality _will be removed_ in the next major version of the API. + +The recommendations below will help you prepare your application for the next major version of the API. + +1. Method: /gists/:id/fork +: Recommendation: Use **/gists/:id/forks** (plural) instead. + +1. Method: /legacy/issues/search/:owner/:repository/:state/:keyword +: Recommendation: Use [v3 Issue Search API](/v3/search/#search-issues) instead. + +1. Method: /legacy/repos/search/:keyword +: Recommendation: Use [v3 Repository Search API](/v3/search/#search-repositories) instead. + +1. Method: /legacy/user/search/:keyword +: Recommendation: Use [v3 User Search API](/v3/search/#search-users) instead. + +1. Method: /legacy/user/email/:email +: Recommendation: Use [v3 User Search API](/v3/search/#search-users) instead. + +1. Method: /repos/:owner/:repo/hooks/:id/test +: Recommendation: Use **/repos/:owner/:repo/hooks/:id/tests** (plural) instead. + +1. Method: /teams/:id/members/:username +: Recommendation: Use [Get Team Membership](/v3/orgs/teams/#get-team-membership), [Add Team Membership](/v3/orgs/teams/#add-team-membership), and [Remove Team Membership](/v3/orgs/teams/#remove-team-membership) instead. + +1. Query parameters when POSTing to /repos/:owner/:repo/forks +: Recommendation: Use JSON to POST to this method instead. + +1. Query parameter value: Passing "watchers" as the value for the "sort" parameter in a GET request to /repos/:owner/:repo/forks +: Recommendation: Use **stargazers** as the value instead. + +1. Pull Request attribute: merge_commit_sha +: Recommendation: [Do not use this attribute](/changes/2013-04-25-deprecating-merge-commit-sha/). + +1. Rate Limit attribute: rate +: Recommendation: Use **resources["core"]** instead. + +1. Repository attribute: forks +: Recommendation: Use **forks_count** instead. + +1. Repository attribute: master_branch +: Recommendation: Use **default_branch** instead. + +1. Repository attribute: open_issues +: Recommendation: Use **open_issues_count** instead. + +1. Repository attribute: public +: Recommendation: When [creating a repository](/v3/repos/#create), use the + **private** attribute to indicate whether the repository should be public or + private. Do not use the **public** attribute. + +1. Repository attribute: watchers +: Recommendation: Use **watchers_count** instead. + +1. User attribute: bio +: Recommendation: Do not use this attribute. It is obsolete. + +1. User attribute: plan["collaborators"] +: Recommendation: Do not use this attribute. It is obsolete. + +1. User attribute: gravatar_id +: Recommendation: Use **avatar_url** instead. + +1. Feed attribute: current_user_organization_url +: Recommendation: Use **current_user_organization_urls** instead. + +1. Feed attribute: current_user_organization +: Recommendation: Use **current_user_organizations** instead. + +1. Pagination parameters `top` and `sha` for method: /repos/:owner/:repo/commits +: Recommendation: When fetching [the list of commits for a repository](/v3/repos/commits/#list-commits-on-a-repository) + use the [standard `per_page` and `page` parameters](/v3/#pagination) for pagination, instead of `per_page`, + `top`, and `sha`. + +1. Authorization attribute: token +: Recommendation: This attribute will return an empty string in the majority of + the Authorizations API responses. Please see + [the deprecation blog post](/changes/2015-02-20-migration-period-removing-authorizations-token/) + and the [Authorizations API deprecation notice](/v3/oauth_authorizations/#deprecation-notice) + for full details. + +# beta (Deprecated) {#beta} + +The [beta API](/v3) is deprecated. Its current functionality is stable and unchangeable. Please [file a support issue][support] if you have problems. + +
+

+ Note: We recommend using the v3 API + instead of the deprecated beta version of the API. +

+

+ The beta media type differs from the v3 media type in + just a few places. In most + cases, migrating an application from the beta media type to the v3 media + type is smooth and painless. +

+

+ We will eventually retire the beta version, but we have no official + retirement date to announce at the moment. When the time comes, rest assured + that we'll announce the retirement with plenty of notice. +

+
+ +## Breaking beta changes + +### June 15th, 2011: + +* `gravatar_url` is being deprecated in favor of `avatar_url` for all + responses that include users or orgs. A default size is no longer + included in the URL. +* Creating new gists (both anonymously and with an authenticated user) + should use `POST /gists` from now on. `POST /users/:username/gists` is no + longer supported. + +### June 1st, 2011: + +* Removed support for PUT verb on update requests. Use POST or PATCH + instead. +* Removed `.json` extension from all URLs. +* No longer using the X-Next or X-Last headers. Pagination info is + returned in the Link header instead. +* JSON-P response has completely changed to a more consistent format. +* Starring gists now uses PUT verb (instead of POST) and returns 204. + +# v2 + +We removed support for API v2 on June 12, 2012. + +# v1 + +We removed support for API v1 on June 12, 2012. + +[support]: https://github.com/contact?form[subject]=APIv3 diff --git a/content/webhooks/configuring/index.md b/content/webhooks/configuring/index.md new file mode 100644 index 0000000000..a9b12629f0 --- /dev/null +++ b/content/webhooks/configuring/index.md @@ -0,0 +1,84 @@ +--- +title: Configuring your server | GitHub API +layout: webhooks +--- + +# Configuring Your Server + +* TOC +{:toc} + +Now that our webhook is ready to deliver messages, we'll set up a basic Sinatra server +to handle incoming payloads. + +Recall that we specifically set our webhook URL to `http://localhost:4567/payload`. +Since we're developing locally, we'll need to expose our local development environment +to the Internet, so that GitHub can send out messages, and our local server can +process them. + +Note: you can download the complete source code for this project +[from the platform-samples repo][platform samples]. + +## Using ngrok + +First, we'll install a program to expose our local host to the Internet. We'll use +ngrok to do this. [ngrok is a free download](https://ngrok.com/download) available +for all major operating systems. + +When you're done with that, you can expose your localhost by running `./ngrok 4567` +on the command line. You should see a line that looks something like this: + + #!bash + Forwarding http://7e9ea9dc.ngrok.com -> 127.0.0.1:4567 + +Copy that funky `*.ngrok.com` URL! We're now going to go *back* to the Payload +URL and pasting this server into that field. It should look something like `http://7e9ea9dc.ngrok.com/payload`. + +By doing this, we've set ourselves up to expose our localhost at path `/payload` +to the Internet. + +## Writing the server + +Now comes the fun part! We want our server to listen to `POST` requests, at `/payload`, +because that's where we told GitHub our webhook URL was. Since ngrok is exposing +our local environment, we don't need to set up a real server somewhere online, and +can happily test out our code locally. + +Let's set up a little Sinatra app to do something with the information. Our initial +setup might look something like this: + + #!ruby + require 'sinatra' + require 'json' + + post '/payload' do + push = JSON.parse(request.body.read) + puts "I got some JSON: #{push.inspect}" + end + +(If you're unfamiliar with how Sinatra works, we recommend [reading the Sinatra guide][Sinatra].) + +Start this server up. + +Since we set up our webhook to listen to events dealing with `Issues`, go ahead +and create a new Issue on the repository you're testing with. Once you create +it, switch back to your terminal. You should see something like this in your output: + + #!bash + ~/Developer/platform-samples/hooks/ruby/configuring-your-server $ ruby server.rb + == Sinatra/1.4.4 has taken the stage on 4567 for development with backup from Thin + >> Thin web server (v1.5.1 codename Straight Razor) + >> Maximum connections set to 1024 + >> Listening on localhost:4567, CTRL+C to stop + I got some JSON: {"action"=>"opened", "issue"=>{"url"=>"... + +Success! You've successfully configured your server to listen to webhooks. Your +server can now process this information any way you see fit. For example, if you +were setting up a "real" web application, you might want to log some of the JSON +output to a database. + +For additional information on working with webhooks for fun and profit, head on +over to the [Testing Webhooks](/webhooks/testing) guide. + +[platform samples]: https://github.com/github/platform-samples/tree/master/hooks/ruby/configuring-your-server +[Sinatra]: http://www.sinatrarb.com/ diff --git a/content/webhooks/creating/index.md b/content/webhooks/creating/index.md new file mode 100644 index 0000000000..7bc5b7a714 --- /dev/null +++ b/content/webhooks/creating/index.md @@ -0,0 +1,66 @@ +--- +title: Creating webhooks | GitHub API +layout: webhooks +--- + +# Creating Webhooks + +* TOC +{:toc} + +Now that we understand [the basics of webhooks][webhooks-overview], let's go +through the process of building out our own webhook powered integration. In +this tutorial, we'll create a repository webhook that will be responsible for +listing out how popular our repository is, based on the number of Issues it +receives per day. + +Creating a webhook is a two-step process. You'll first need to set up how you want +your webhook to behave through GitHub--what events should it listen to. After that, +you'll set up your server to receive and manage the payload. + +## Setting up a Webhook + +To set up a repository webhook on GitHub, head over to the **Settings** page of +your repository, and click on **Webhooks & services**. After that, click on +**Add webhook**. + +Alternatively, you can choose to build and manage a webhook [through the Webhooks API][webhook-api]. + +Webhooks require a few configuration options before you can make use of them. +We'll go through each of these settings below. + +## Payload URL + +This is the server endpoint that will receive the webhook payload. + +Since we're developing locally for our tutorial, let's set it to `http://localhost:4567/payload`. +We'll explain why in the [Configuring Your Server](/webhooks/configuring/) docs. + +## Content Type + +Webhooks can be delivered using different content types: + +- The `application/json` content type will deliver the JSON payload directly as the body of the POST. +- The `application/x-www-form-urlencoded` content type will send the JSON payload as a form parameter + called "payload". + +Choose the one that best fits your needs. For this tutorial, the default content type of +`application/json` is fine. + +## Events + +Events are at the core of webhooks. These webhooks fire whenever a certain action is +taken on the repository, which your server's payload URL intercepts and acts upon. + +A full list of webhook events, and when they execute, can be found in [the webhooks API][hooks-api] reference. + +Since our webhook is dealing with Issues in a repository, we'll click on **Issues**, +and toggle the options there. + +When you're finished, click on **Add webhook**. Phew! Now that the webhook is created, +it's time to set up our local server to test the webhook. Head on over to +[Configuring Your Server](/webhooks/configuring/) to learn how to do that. + +[webhooks-overview]: /webhooks/ +[webhook-api]: /v3/repos/hooks/ +[hooks-api]: /webhooks/#events diff --git a/content/webhooks/index.md b/content/webhooks/index.md new file mode 100644 index 0000000000..bc95d4a62c --- /dev/null +++ b/content/webhooks/index.md @@ -0,0 +1,197 @@ +--- +title: Webhooks | GitHub API +layout: webhooks +--- + +# Webhooks + +* TOC +{:toc} + + +Webhooks allow you to build or set up integrations which subscribe to certain +events on GitHub.com. When one of those events is triggered, we'll send a HTTP +POST payload to the webhook's configured URL. Webhooks can be used to update +an external issue tracker, trigger CI builds, update a backup mirror, or even +deploy to your production server. You're only limited by your imagination. + +Each webhook can be installed [on an organization][org-hooks] or [a specific +repository][repo-hooks]. Once installed, they will be triggered each time one +or more subscribed events occurs on that organization or repository. + + +## Events + +When configuring a webhook, you can choose which events you would like to +receive payloads for. You can [even opt-in to all current and future +events][wildcard-section]. Only subscribing to the specific events you plan on +handling is useful for limiting the number of HTTP requests to your server. You +can change the list of subscribed events through the API or UI anytime. By +default, webhooks are only subscribed to the `push` event. + +Each event corresponds to a certain set of actions that can happen to your +organization and/or repository. For example, if you subscribe to the `issues` +event you'll receive [detailed payloads][payloads-section] every time an issue +is opened, closed, labeled, etc. + + +The available events are: + +Name | Description +-----|-----------| +`*` | Any time any event is triggered ([Wildcard Event][wildcard-section]). +`commit_comment` | Any time a Commit is commented on. +`create` | Any time a Branch or Tag is created. +`delete` | Any time a Branch or Tag is deleted. +`deployment` | Any time a Repository has a new deployment created from the API. +`deployment_status` | Any time a deployment for a Repository has a status update from the API. +`fork` | Any time a Repository is forked. +`gollum` | Any time a Wiki page is updated. +`issue_comment` | Any time an Issue is commented on. +`issues` | Any time an Issue is assigned, unassigned, labeled, unlabeled, opened, closed, or reopened. +`member` | Any time a User is added as a collaborator to a non-Organization Repository. +`membership` | Any time a User is added or removed from a team. **Organization hooks only**. +`page_build` | Any time a Pages site is built or results in a failed build. +`public` | Any time a Repository changes from private to public. +`pull_request_review_comment` | Any time a Commit is commented on while inside a Pull Request review (the Files Changed tab). +`pull_request` | Any time a Pull Request is assigned, unassigned, labeled, unlabeled, opened, closed, reopened, or synchronized (updated due to a new push in the branch that the pull request is tracking). +`push` | Any Git push to a Repository, including editing tags or branches. Commits via API actions that update references are also counted. **This is the default event.** +`repository` | Any time a Repository is created. **Organization hooks only**. +`release` | Any time a Release is published in a Repository. +`status` | Any time a Repository has a status update from the API +`team_add` | Any time a team is added or modified on a Repository. +`watch` | Any time a User watches a Repository. + +### Wildcard Event + +We also support a wildcard (`*`) that will match all supported events. When you +add the wildcard event, we'll replace any existing events you have configured +with the wildcard event and send you payloads for all supported events. You'll +also automatically get any new events we might add in the future. + + +## Payloads + +Each event type has a specific payload format with the relevant event +information. All event payloads mirror [the payloads for the Event +types][event-types], with the exception of [the original `push` +event][event-types-push], which has a more detailed webhook payload. + +In addition to the fields [documented for each event][event-types], webhook +payloads include the user who performed the event (`sender`) as well as the +organization (`organization`) and/or repository (`repository`) which the event +occurred on. + +### Delivery headers + +HTTP requests made to your webhook's configured URL endpoint will contain +several special headers: + +Header | Description +-------|-------------| +`X-Github-Event`| Name of the [event][events-section] that triggered this delivery. +`X-Hub-Signature`| HMAC hex digest of the payload, using [the hook's `secret`][repo-hooks-create] as the key (if configured). +`X-Github-Delivery`| Unique ID for this delivery. + +Also, the `User-Agent` for the requests will have the prefix `GitHub-Hookshot/`. + +### Example delivery + +
+POST /payload HTTP/1.1
+
+Host: localhost:4567
+X-Github-Delivery: 72d3162e-cc78-11e3-81ab-4c9367dc0958
+User-Agent: GitHub-Hookshot/044aadd
+Content-Type: application/json
+Content-Length: 6615
+X-Github-Event: issues
+
+{
+  "action": "opened",
+  "issue": {
+    "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
+    "number": 1347,
+    ...
+  },
+  "repository" : {
+    "id": 1296269,
+    "full_name": "octocat/Hello-World",
+    "owner": {
+      "login": "octocat",
+      "id": 1,
+      ...
+    },
+    ...
+  },
+  "sender": {
+    "login": "octocat",
+    "id": 1,
+    ...
+  }
+}
+
+ + +## Ping Event + +When you create a new webhook, we'll send you a simple `ping` event to let you +know you've set up the webhook correctly. This event isn't stored so it isn't +retrievable via the [Events API][events-api]. You can trigger a `ping` again by +calling the [ping endpoint][repo-hooks-ping]. + +### Ping Event Payload + +Key | Value | +----| ----- | +zen | Random string of GitHub zen | +hook_id | The ID of the webhook that triggered the ping | +hook | The [webhook configuration][repo-hooks-show] | + + +## Service Hooks + +In addition to webhooks, we also offer the ability to install pre-rolled +integrations for a variety of existing services. These services [are contributed +and maintained by the Open Source community][github-services]. + +Service hooks are installed and configured in a similar fashion as webhooks. +When [creating a hook][webhooks-guide-create], just set the `:name` parameter to +a service name instead of "web" (for webhook). The main differences to keep in +mind between webhooks and service hooks are: + +- Service hooks cannot be installed on organizations, only repositories. +- You can only install a one service per integrator for a repository, whereas + multiple webhooks can be installed on each organization/repository. +- Each service hook only supports a specific set of events, depending on the + services implementation. +- Each service has its own unique set of configuration options. + +To see a full list of available services, their supported events, and +configuration options, check out https://api.github.com/hooks. Documentation for all +service hooks can be found in the [docs directory][github-services-docs] of the +github-services repository. + +**Note:** If you are building a new integration, you should build it as webhook. +We suggest creating an [OAuth application][oauth-applications] to automatically +install and manage your users' webhooks. We will no longer be accepting new +services to the [github-services repository][github-services]. + + +[service-hooks-section]: #service-hooks +[events-section]: #events +[wildcard-section]: #wildcard-event +[payloads-section]: #payloads +[webhooks-guide-create]: /webhooks/creating/ +[org-hooks]: /v3/orgs/hooks/ +[repo-hooks]: /v3/repos/hooks/ +[repo-hooks-show]: /v3/repos/hooks/#get-single-hook +[repo-hooks-create]: /v3/repos/hooks/#create-a-hook +[repo-hooks-ping]: /v3/repos/hooks/#ping-a-hook +[events-api]: /v3/activity/events/ +[event-types]: /v3/activity/events/types/ +[event-types-push]: /v3/activity/events/types/#pushevent +[github-services]: https://github.com/github/github-services +[github-services-docs]: https://github.com/github/github-services/tree/master/docs +[oauth-applications]: /v3/oauth/ diff --git a/content/webhooks/securing/index.md b/content/webhooks/securing/index.md new file mode 100644 index 0000000000..0f8d77d4e2 --- /dev/null +++ b/content/webhooks/securing/index.md @@ -0,0 +1,71 @@ +--- +title: Securing your webhooks | GitHub API +layout: webhooks +--- + +# Securing your webhooks + +* TOC +{:toc} + +Once your server is configured to receive payloads, it'll listen for any payload sent to the endpoint you configured. For security reasons, you probably want to limit requests to those coming from GitHub. There are a few ways to go about this--for example, you could opt to whitelist requests from GitHub's IP address--but a far easier method is to set up a secret token and validate the information. + + +## Setting your secret token + +You'll need to set up your secret token in two places: GitHub and your server. + +To set your token on GitHub: + +1. Navigate to the repository where you're setting up your webhook. +2. Fill out the Secret textbox. Use a random string with high entropy (e.g., by taking the output of `ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'` at the terminal). +![Webhook secret token field](/images/webhook_secret_token.png) +3. Click **Update Webhook**. + +Next, set up an environment variable on your server that stores this token. Typically, this is as simple as running: + +
+export SECRET_TOKEN=your_token
+
+ +**Never** hardcode the token into your app! + +## Validating payloads from GitHub + +When your secret token is set, GitHub uses it to create a hash signature with each payload. You can find details on the implementation [in our Ruby implementation][ruby-secret]. + +This hash signature is passed along with each request in the headers as `X-Hub-Signature`. Suppose you have a basic server listening to webhooks that looks like this: + + #!ruby + require 'sinatra' + require 'json' + + post '/payload' do + push = JSON.parse(params[:payload]) + puts "I got some JSON: #{push.inspect}" + end + +The goal is to compute a hash using your `SECRET_TOKEN`, and ensure that the hash from GitHub matches. GitHub uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: + + #!ruby + post '/payload' do + request.body.rewind + payload_body = request.body.read + verify_signature(payload_body) + push = JSON.parse(params[:payload]) + puts "I got some JSON: #{push.inspect}" + end + + def verify_signature(payload_body) + signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) + return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE']) + end + +Obviously, your language and server implementations may differ than this code. There's a couple of very important thing to point out, however: + +* No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. + +* Using a plain `==` operator is **not advised**. A method like [`secure_compare`][secure_compare] performs a "constant time" string comparison, which renders it safe from certain timing attacks against regular equality operators. + +[ruby-secret]: https://github.com/github/github-services/blob/14f4da01ce29bc6a02427a9fbf37b08b141e81d9/lib/services/web.rb#L47-L50 +[secure_compare]: http://rubydoc.info/github/rack/rack/master/Rack/Utils.secure_compare diff --git a/content/webhooks/testing/index.md b/content/webhooks/testing/index.md new file mode 100644 index 0000000000..747ce3e6e3 --- /dev/null +++ b/content/webhooks/testing/index.md @@ -0,0 +1,44 @@ +--- +title: Testing webhooks | GitHub API +layout: webhooks +--- + +# Testing Webhooks + +* TOC +{:toc} + +Now that you've [configured your local server](/webhooks/configuring/), you might +be interested in pushing your code to the limits. To that end, GitHub's webhooks +view provides some tooling for testing your deployed payloads. + + +## Listing recent deliveries + +Every webhook has its own "Recent Deliveries" section, which lists, at a glance +whether a deployment was successful (green check) or failed (red x). + +![Recent Deliveries view](/images/webhooks_recent_deliveries.png) + +You can also identify when each delivery was attempted. + +## Digging into results + +By expanding an individual delivery, you'll be able to witness *precisely* +what information GitHub is attempting to send to your server. This includes +both the HTTP Request and Response. + +### Request + +The webhook delivery view provides information on which Headers were sent by GitHub. +It also includes details about the JSON payload. + +![Viewing a payload request](/images/payload_request_tab.png) + +### Response + +The response tab lists how your server replied once it received the payload from +GitHub. This includes the status code, the headers, and any additional data +within the response body. + +![Viewing a payload response](/images/payload_response_tab.png) diff --git a/css/960.css b/css/960.css deleted file mode 100644 index 5e00e1847b..0000000000 --- a/css/960.css +++ /dev/null @@ -1,643 +0,0 @@ -/* - 960 Grid System ~ Core CSS. - Learn more ~ http://960.gs/ - - Licensed under GPL and MIT. -*/ - -/* - Forces backgrounds to span full width, - even if there is horizontal scrolling. - Increase this if your layout is wider. - - Note: IE6 works fine without this fix. -*/ - -body { - min-width: 960px; -} - -/* `Containers -----------------------------------------------------------------------------------------------------*/ - -.container_12, -.container_16 { - margin-left: auto; - margin-right: auto; - width: 960px; -} - -/* `Grid >> Global -----------------------------------------------------------------------------------------------------*/ - -.grid_1, -.grid_2, -.grid_3, -.grid_4, -.grid_5, -.grid_6, -.grid_7, -.grid_8, -.grid_9, -.grid_10, -.grid_11, -.grid_12, -.grid_13, -.grid_14, -.grid_15, -.grid_16 { - display: inline; - float: left; - margin-left: 10px; - margin-right: 10px; -} - -.push_1, .pull_1, -.push_2, .pull_2, -.push_3, .pull_3, -.push_4, .pull_4, -.push_5, .pull_5, -.push_6, .pull_6, -.push_7, .pull_7, -.push_8, .pull_8, -.push_9, .pull_9, -.push_10, .pull_10, -.push_11, .pull_11, -.push_12, .pull_12, -.push_13, .pull_13, -.push_14, .pull_14, -.push_15, .pull_15 { - position: relative; -} - -.container_12 .grid_3, -.container_16 .grid_4 { - width: 220px; -} - -.container_12 .grid_6, -.container_16 .grid_8 { - width: 460px; -} - -.container_12 .grid_9, -.container_16 .grid_12 { - width: 700px; -} - -.container_12 .grid_12, -.container_16 .grid_16 { - width: 940px; -} - -/* `Grid >> Children (Alpha ~ First, Omega ~ Last) -----------------------------------------------------------------------------------------------------*/ - -.alpha { - margin-left: 0; -} - -.omega { - margin-right: 0; -} - -/* `Grid >> 12 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_12 .grid_1 { - width: 60px; -} - -.container_12 .grid_2 { - width: 140px; -} - -.container_12 .grid_4 { - width: 300px; -} - -.container_12 .grid_5 { - width: 380px; -} - -.container_12 .grid_7 { - width: 540px; -} - -.container_12 .grid_8 { - width: 620px; -} - -.container_12 .grid_10 { - width: 780px; -} - -.container_12 .grid_11 { - width: 860px; -} - -/* `Grid >> 16 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_16 .grid_1 { - width: 40px; -} - -.container_16 .grid_2 { - width: 100px; -} - -.container_16 .grid_3 { - width: 160px; -} - -.container_16 .grid_5 { - width: 280px; -} - -.container_16 .grid_6 { - width: 340px; -} - -.container_16 .grid_7 { - width: 400px; -} - -.container_16 .grid_9 { - width: 520px; -} - -.container_16 .grid_10 { - width: 580px; -} - -.container_16 .grid_11 { - width: 640px; -} - -.container_16 .grid_13 { - width: 760px; -} - -.container_16 .grid_14 { - width: 820px; -} - -.container_16 .grid_15 { - width: 880px; -} - -/* `Prefix Extra Space >> Global -----------------------------------------------------------------------------------------------------*/ - -.container_12 .prefix_3, -.container_16 .prefix_4 { - padding-left: 240px; -} - -.container_12 .prefix_6, -.container_16 .prefix_8 { - padding-left: 480px; -} - -.container_12 .prefix_9, -.container_16 .prefix_12 { - padding-left: 720px; -} - -/* `Prefix Extra Space >> 12 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_12 .prefix_1 { - padding-left: 80px; -} - -.container_12 .prefix_2 { - padding-left: 160px; -} - -.container_12 .prefix_4 { - padding-left: 320px; -} - -.container_12 .prefix_5 { - padding-left: 400px; -} - -.container_12 .prefix_7 { - padding-left: 560px; -} - -.container_12 .prefix_8 { - padding-left: 640px; -} - -.container_12 .prefix_10 { - padding-left: 800px; -} - -.container_12 .prefix_11 { - padding-left: 880px; -} - -/* `Prefix Extra Space >> 16 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_16 .prefix_1 { - padding-left: 60px; -} - -.container_16 .prefix_2 { - padding-left: 120px; -} - -.container_16 .prefix_3 { - padding-left: 180px; -} - -.container_16 .prefix_5 { - padding-left: 300px; -} - -.container_16 .prefix_6 { - padding-left: 360px; -} - -.container_16 .prefix_7 { - padding-left: 420px; -} - -.container_16 .prefix_9 { - padding-left: 540px; -} - -.container_16 .prefix_10 { - padding-left: 600px; -} - -.container_16 .prefix_11 { - padding-left: 660px; -} - -.container_16 .prefix_13 { - padding-left: 780px; -} - -.container_16 .prefix_14 { - padding-left: 840px; -} - -.container_16 .prefix_15 { - padding-left: 900px; -} - -/* `Suffix Extra Space >> Global -----------------------------------------------------------------------------------------------------*/ - -.container_12 .suffix_3, -.container_16 .suffix_4 { - padding-right: 240px; -} - -.container_12 .suffix_6, -.container_16 .suffix_8 { - padding-right: 480px; -} - -.container_12 .suffix_9, -.container_16 .suffix_12 { - padding-right: 720px; -} - -/* `Suffix Extra Space >> 12 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_12 .suffix_1 { - padding-right: 80px; -} - -.container_12 .suffix_2 { - padding-right: 160px; -} - -.container_12 .suffix_4 { - padding-right: 320px; -} - -.container_12 .suffix_5 { - padding-right: 400px; -} - -.container_12 .suffix_7 { - padding-right: 560px; -} - -.container_12 .suffix_8 { - padding-right: 640px; -} - -.container_12 .suffix_10 { - padding-right: 800px; -} - -.container_12 .suffix_11 { - padding-right: 880px; -} - -/* `Suffix Extra Space >> 16 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_16 .suffix_1 { - padding-right: 60px; -} - -.container_16 .suffix_2 { - padding-right: 120px; -} - -.container_16 .suffix_3 { - padding-right: 180px; -} - -.container_16 .suffix_5 { - padding-right: 300px; -} - -.container_16 .suffix_6 { - padding-right: 360px; -} - -.container_16 .suffix_7 { - padding-right: 420px; -} - -.container_16 .suffix_9 { - padding-right: 540px; -} - -.container_16 .suffix_10 { - padding-right: 600px; -} - -.container_16 .suffix_11 { - padding-right: 660px; -} - -.container_16 .suffix_13 { - padding-right: 780px; -} - -.container_16 .suffix_14 { - padding-right: 840px; -} - -.container_16 .suffix_15 { - padding-right: 900px; -} - -/* `Push Space >> Global -----------------------------------------------------------------------------------------------------*/ - -.container_12 .push_3, -.container_16 .push_4 { - left: 240px; -} - -.container_12 .push_6, -.container_16 .push_8 { - left: 480px; -} - -.container_12 .push_9, -.container_16 .push_12 { - left: 720px; -} - -/* `Push Space >> 12 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_12 .push_1 { - left: 80px; -} - -.container_12 .push_2 { - left: 160px; -} - -.container_12 .push_4 { - left: 320px; -} - -.container_12 .push_5 { - left: 400px; -} - -.container_12 .push_7 { - left: 560px; -} - -.container_12 .push_8 { - left: 640px; -} - -.container_12 .push_10 { - left: 800px; -} - -.container_12 .push_11 { - left: 880px; -} - -/* `Push Space >> 16 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_16 .push_1 { - left: 60px; -} - -.container_16 .push_2 { - left: 120px; -} - -.container_16 .push_3 { - left: 180px; -} - -.container_16 .push_5 { - left: 300px; -} - -.container_16 .push_6 { - left: 360px; -} - -.container_16 .push_7 { - left: 420px; -} - -.container_16 .push_9 { - left: 540px; -} - -.container_16 .push_10 { - left: 600px; -} - -.container_16 .push_11 { - left: 660px; -} - -.container_16 .push_13 { - left: 780px; -} - -.container_16 .push_14 { - left: 840px; -} - -.container_16 .push_15 { - left: 900px; -} - -/* `Pull Space >> Global -----------------------------------------------------------------------------------------------------*/ - -.container_12 .pull_3, -.container_16 .pull_4 { - left: -240px; -} - -.container_12 .pull_6, -.container_16 .pull_8 { - left: -480px; -} - -.container_12 .pull_9, -.container_16 .pull_12 { - left: -720px; -} - -/* `Pull Space >> 12 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_12 .pull_1 { - left: -80px; -} - -.container_12 .pull_2 { - left: -160px; -} - -.container_12 .pull_4 { - left: -320px; -} - -.container_12 .pull_5 { - left: -400px; -} - -.container_12 .pull_7 { - left: -560px; -} - -.container_12 .pull_8 { - left: -640px; -} - -.container_12 .pull_10 { - left: -800px; -} - -.container_12 .pull_11 { - left: -880px; -} - -/* `Pull Space >> 16 Columns -----------------------------------------------------------------------------------------------------*/ - -.container_16 .pull_1 { - left: -60px; -} - -.container_16 .pull_2 { - left: -120px; -} - -.container_16 .pull_3 { - left: -180px; -} - -.container_16 .pull_5 { - left: -300px; -} - -.container_16 .pull_6 { - left: -360px; -} - -.container_16 .pull_7 { - left: -420px; -} - -.container_16 .pull_9 { - left: -540px; -} - -.container_16 .pull_10 { - left: -600px; -} - -.container_16 .pull_11 { - left: -660px; -} - -.container_16 .pull_13 { - left: -780px; -} - -.container_16 .pull_14 { - left: -840px; -} - -.container_16 .pull_15 { - left: -900px; -} - -/* `Clear Floated Elements -----------------------------------------------------------------------------------------------------*/ - -/* http://sonspring.com/journal/clearing-floats */ - -.clear { - clear: both; - display: block; - overflow: hidden; - visibility: hidden; - width: 0; - height: 0; -} - -/* http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified */ - -.clearfix:before, -.clearfix:after { - content: '\0020'; - display: block; - overflow: hidden; - visibility: hidden; - width: 0; - height: 0; -} - -.clearfix:after { - clear: both; -} - -/* - The following zoom:1 rule is specifically for IE6 + IE7. - Move to separate stylesheet if invalid CSS is a problem. -*/ - -.clearfix { - zoom: 1; -} \ No newline at end of file diff --git a/css/uv_active4d.css b/css/uv_active4d.css deleted file mode 100644 index 60e909b3ad..0000000000 --- a/css/uv_active4d.css +++ /dev/null @@ -1,115 +0,0 @@ -pre.active4d code { - background:none; - color:#000; - font-size:1.1em -} - -pre.active4d .DiffHeader { - background-color: #656565; - color: #FFFFFF; -} -pre.active4d .Operator { -} -pre.active4d .InheritedClass { -} -pre.active4d .TypeName { - color: #21439C; -} -pre.active4d .Number { - color: #A8017E; -} -pre.active4d .EmbeddedSource { - background-color: #ECF1FF; -} -pre.active4d { - background-color: #FFFFFF; - color: #000000; -} -pre.active4d .DiffInsertedLine { - background-color: #98FF9A; - color: #000000; -} -pre.active4d .LibraryVariable { - color: #A535AE; -} -pre.active4d .Storage { - color: #FF5600; -} -pre.active4d .InterpolatedEntity { - color: #66CCFF; -} -pre.active4d .line-numbers { - background-color: #BAD6FD; - color: #000000; -} -pre.active4d .LocalVariable { - color: #6392FF; -} -pre.active4d .DiffLineRange { - background-color: #1B63FF; - color: #FFFFFF; -} -pre.active4d .BlockComment { - color: #D33435; -} -pre.active4d .TagName { - color: #016CFF; -} -pre.active4d .FunctionArgument { -} -pre.active4d .BuiltInConstant { - color: #A535AE; -} -pre.active4d .LineComment { - color: #D33535; -} -pre.active4d .DiffDeletedLine { - background-color: #FF7880; - color: #000000; -} -pre.active4d .NamedConstant { - color: #B7734C; -} -pre.active4d .CommandMethod { - color: #45AE34; -} -pre.active4d .TableField { - color: #0BB600; -} -pre.active4d .PlainXmlText { - color: #000000; -} -pre.active4d .Invalid { - background-color: #990000; - color: #FFFFFF; -} -pre.active4d .LibraryClassType { - color: #A535AE; -} -pre.active4d .TagAttribute { - color: #963DFF; -} -pre.active4d .Keyword { - color: #006699; -} -pre.active4d .UserDefinedConstant { -} -pre.active4d .String { - color: #666666; -} -pre.active4d .DiffUnchangedLine { - color: #5E5E5E; -} -pre.active4d .TagContainer { - color: #7A7A7A; -} -pre.active4d .FunctionName { - color: #21439C; -} -pre.active4d .Variable { - color: #0053FF; -} -pre.active4d .DateTimeLiteral { - font-weight: bold; - color: #66CCFF; -} \ No newline at end of file diff --git a/guides/basics-of-authentication/index.html b/guides/basics-of-authentication/index.html deleted file mode 100644 index fa12d2b93f..0000000000 --- a/guides/basics-of-authentication/index.html +++ /dev/null @@ -1,458 +0,0 @@ - - - - - - - - Basics of Authentication | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Basics of Authentication

- - - -

In this section, we’re going to focus on the basics of authentication. Specifically, -we’re going to create a Ruby server (using Sinatra) that implements -the web flow of an application in several different ways.

- -

Note: you can download the complete source code for this project -from the platform-samples repo.

- -

Registering your app

- -

First, you’ll need to register your application. Every -registered OAuth application is assigned a unique Client ID and Client Secret. -The Client Secret should not be shared! That includes checking the string -into your repository.

- -

You can fill out every piece of information however you like, except the -Authorization callback URL. This is easily the most important piece to setting -up your application. It’s the callback URL that GitHub returns the user to after -successful authentication.

- -

Since we’re running a regular Sinatra server, the location of the local instance -is set to http://localhost:4567. Let’s fill in the callback URL as http://localhost:4567/callback.

- -

Accepting user authorization

- -

Now, let’s start filling out our simple server. Create a file called server.rb and paste this into it:

- -
require 'sinatra'
-require 'rest-client'
-require 'json'
-
-CLIENT_ID = ENV['GH_BASIC_CLIENT_ID']
-CLIENT_SECRET = ENV['GH_BASIC_SECRET_ID']
-
-get '/' do
-  erb :index, :locals => {:client_id => CLIENT_ID}
-end
- -

Your client ID and client secret keys come from your application’s configuration -page. You should never, ever store these values in -GitHub–or any other public place, for that matter. We recommend storing them as -environment variables–which is exactly what we’ve done here.

- -

Next, in views/index.erb, paste this content:

- -
<html>
-  <head>
-  </head>
-  <body>
-    <p>
-      Well, hello there!
-    </p>
-    <p>
-      We're going to now talk to the GitHub API. Ready?
-      <a href="https://github.com/login/oauth/authorize?scope=user:email&client_id=<%= client_id %>">Click here</a> to begin!</a>
-    </p>
-    <p>
-      If that link doesn't work, remember to provide your own <a href="/v3/oauth/#web-application-flow">Client ID</a>!
-    </p>
-  </body>
-</html>
- -

(If you’re unfamiliar with how Sinatra works, we recommend reading the Sinatra guide.)

- -

Also, notice that the URL uses the scope query parameter to define the -scopes requested by the application. For our application, we’re -requesting user:email scope for reading private email addresses.

- -

Navigate your browser to http://localhost:4567. After clicking on the link, you -should be taken to GitHub, and presented with a dialog that looks something like this: -

- -

If you trust yourself, click Authorize App. Wuh-oh! Sinatra spits out a -404 error. What gives?!

- -

Well, remember when we specified a Callback URL to be callback? We didn’t provide -a route for it, so GitHub doesn’t know where to drop the user after they authorize -the app. Let’s fix that now!

- -

Providing a callback

- -

In server.rb, add a route to specify what the callback should do:

- -
get '/callback' do
-  # get temporary GitHub code...
-  session_code = request.env['rack.request.query_hash']['code']
-
-  # ... and POST it back to GitHub
-  result = RestClient.post('https://github.com/login/oauth/access_token',
-                          {:client_id => CLIENT_ID,
-                           :client_secret => CLIENT_SECRET,
-                           :code => session_code},
-                           :accept => :json)
-
-  # extract the token and granted scopes
-  access_token = JSON.parse(result)['access_token']
-end
- -

After a successful app authentication, GitHub provides a temporary code value. -You’ll need to POST this code back to GitHub in exchange for an access_token. -To simplify our GET and POST HTTP requests, we’re using the rest-client. -Note that you’ll probably never access the API through REST. For a more serious -application, you should probably use a library written in the language of your choice.

- -

Checking granted scopes

- -

In the future, users will be able to edit the scopes you requested, -and your application might be granted less access than you originally asked for. -So, before making any requests with the token, you should check the scopes that -were granted for the token by the user.

- -

The scopes that were granted are returned as a part of the response from -exchanging a token.

- -
# check if we were granted user:email scope
-scopes = JSON.parse(result)['scope'].split(',')
-has_user_email_scope = scopes.include? 'user:email'
- -

In our application, we’re using scopes.include? to check if we were granted -the user:email scope needed for fetching the authenticated user’s private -email addresses. Had the application asked for other scopes, we would have -checked for those as well.

- -

Also, since there’s a hierarchical relationship between scopes, you should -check that you were granted the lowest level of required scopes. For example, -if the application had asked for user scope, it might have been granted only -user:email scope. In that case, the application wouldn’t have been granted -what it asked for, but the granted scopes would have still been sufficient.

- -

Checking for scopes only before making requests is not enough since it’s posible -that users will change the scopes in between your check and the actual request. -In case that happens, API calls you expected to succeed might fail with a 404 -or 401 status, or return a different subset of information.

- -

To help you gracefully handle these situations, all API responses for requests -made with valid tokens also contain an X-OAuth-Scopes header. -This header contains the list of scopes of the token that was used to make the -request. In addition to that, the Authorization API provides an endpoint to -check a token for validity. -Use this information to detect changes in token scopes, and inform your users of -changes in available application functionality.

- -

Making authenticated requests

- -

At last, with this access token, you’ll be able to make authenticated requests as -the logged in user:

- -
# fetch user information
-auth_result = JSON.parse(RestClient.get('https://api.github.com/user',
-                                        {:params => {:access_token => access_token}}))
-
-# if the user authorized it, fetch private emails
-if has_user_email_scope
-  auth_result['private_emails'] =
-    JSON.parse(RestClient.get('https://api.github.com/user/emails',
-                              {:params => {:access_token => access_token}}))
-
-erb :basic, :locals => auth_result
- -

We can do whatever we want with our results. In this case, we’ll just dump them straight into basic.erb:

- -
<p>Hello, <%= login %>!</p>
-<p>
-  <% if !email.empty? %> It looks like your public email address is <%= email %>.
-  <% else %> It looks like you don't have a public email. That's cool.
-  <% end %>
-</p>
-<p>
-  <% if defined? private_emails %>
-  With your permission, we were also able to dig up your private email addresses:
-  <%= private_emails.join(', ') %>
-  <% else %>
-  Also, you're a bit secretive about your private email addresses.
-  <% end %>
-</p>
- -

Implementing “persistent” authentication

- -

It’d be a pretty bad model if we required users to log into the app every single -time they needed to access the web page. For example, try navigating directly to -http://localhost:4567/basic. You’ll get an error.

- -

What if we could circumvent the entire -“click here” process, and just remember that, as long as the user’s logged into -GitHub, they should be able to access this application? Hold on to your hat, -because that’s exactly what we’re going to do.

- -

Our little server above is rather simple. In order to wedge in some intelligent -authentication, we’re going to switch over to using sessions for storing tokens. -This will make authentication transparent to the user.

- -

Also, since we’re persisting scopes within the session, we’ll need to -handle cases when the user updates the scopes after we checked them, or revokes -the token. To do that, we’ll use a rescue block and check that the first API -call succeeded, which verifies that the token is still valid. After that, we’ll -check the X-OAuth-Scopes response header to verify that the user hasn’t revoked -the user:email scope.

- -

Create a file called advanced_server.rb, and paste these lines into it:

- -
require 'sinatra'
-require 'rest_client'
-require 'json'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-# if ENV['GITHUB_CLIENT_ID'] && ENV['GITHUB_CLIENT_SECRET']
-#  CLIENT_ID        = ENV['GITHUB_CLIENT_ID']
-#  CLIENT_SECRET    = ENV['GITHUB_CLIENT_SECRET']
-# end
-
-CLIENT_ID = ENV['GH_BASIC_CLIENT_ID']
-CLIENT_SECRET = ENV['GH_BASIC_SECRET_ID']
-
-use Rack::Session::Cookie, :secret => rand.to_s()
-
-def authenticated?
-  session[:access_token]
-end
-
-def authenticate!
-  erb :index, :locals => {:client_id => CLIENT_ID}
-end
-
-get '/' do
-  if !authenticated?
-    authenticate!
-  else
-    access_token = session[:access_token]
-    scopes = []
-
-    begin
-      auth_result = RestClient.get('https://api.github.com/user',
-                                   {:params => {:access_token => access_token},
-                                    :accept => :json})
-    rescue => e
-      # request didn't succeed because the token was revoked so we
-      # invalidate the token stored in the session and render the
-      # index page so that the user can start the OAuth flow again
-
-      session[:access_token] = nil
-      return authenticate!
-    end
-
-    # the request succeeded, so we check the list of current scopes
-    if auth_result.headers.include? :x_oauth_scopes
-      scopes = auth_result.headers[:x_oauth_scopes].split(', ')
-    end
-
-    auth_result = JSON.parse(auth_result)
-
-    if scopes.include? 'user:email'
-      auth_result['private_emails'] =
-        JSON.parse(RestClient.get('https://api.github.com/user/emails',
-                       {:params => {:access_token => access_token},
-                        :accept => :json}))
-    end
-
-    erb :advanced, :locals => auth_result
-  end
-end
-
-get '/callback' do
-  session_code = request.env['rack.request.query_hash']['code']
-
-  result = RestClient.post('https://github.com/login/oauth/access_token',
-                          {:client_id => CLIENT_ID,
-                           :client_secret => CLIENT_SECRET,
-                           :code => session_code},
-                           :accept => :json)
-
-  session[:access_token] = JSON.parse(result)['access_token']
-
-  redirect '/'
-end
- -

Much of the code should look familiar. For example, we’re still using RestClient.get -to call out to the GitHub API, and we’re still passing our results to be rendered -in an ERB template (this time, it’s called advanced.erb).

- -

Also, we now have the authenticated? method which checks if the user is already -authenticated. If not, the authenticate! method is called, which performs the -OAuth flow and updates the session with the granted token and scopes.

- -

Next, create a file in views called advanced.erb, and paste this markup into it:

- -
<html>
-  <head>
-  </head>
-  <body>
-    <p>Well, well, well, <%= login %>!</p>
-    <p>
-      <% if !email.empty? %> It looks like your public email address is <%= email %>.
-      <% else %> It looks like you don't have a public email. That's cool.
-      <% end %>
-    </p>
-    <p>
-      <% if defined? private_emails %>
-      With your permission, we were also able to dig up your private email addresses:
-      <%= private_emails.join(', ') %>
-      <% else %>
-      Also, you're a bit secretive about your private email addresses.
-      <% end %>
-    </p>
-  </body>
-</html>
- -

From the command line, call ruby advanced_server.rb, which starts up your -server on port 4567 – the same port we used when we had a simple Sinatra app. -When you navigate to http://localhost:4567, the app calls authenticate! -which redirects you to /callback. /callback then sends us back to /, -and since we’ve been authenticated, renders advanced.erb.

- -

We could completely simplify this roundtrip routing by simply changing our callback -URL in GitHub to /. But, since both server.rb and advanced.rb are relying on -the same callback URL, we’ve got to do a little bit of wonkiness to make it work.

- -

Also, if we had never authorized this application to access our GitHub data, -we would’ve seen the same confirmation dialog from earlier pop-up and warn us.

- -

If you’d like, you can play around with yet another Sinatra-GitHub auth example -available as a separate project.

- - -
- - -
- - - - - - - - diff --git a/guides/getting-started/index.html b/guides/getting-started/index.html deleted file mode 100644 index 942147a3fc..0000000000 --- a/guides/getting-started/index.html +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - - - Getting Started | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Getting Started

- - - -

Let’s walk through core API concepts as we tackle some everyday use cases.

- -

Overview

- -

Most applications will use an existing wrapper library in the language -of your choice, but it’s important to familiarize yourself with the underlying API -HTTP methods first.

- -

There’s no easier way to kick the tires than through cURL.

- -

Hello World

- -

Let’s start by testing our setup. Open up a command prompt and enter the -following command (without the $):

- -
-$ curl https://api.github.com/zen
-
-Keep it logically awesome.
-
- -

The response will be a random selection from our design philosophies.

- -

Next, let’s GET Chris Wanstrath’s GitHub profile:

- -
-# GET /users/defunkt
-$ curl https://api.github.com/users/defunkt
-
-{
-  "login": "defunkt",
-  "id": 2,
-  "url": "https://api.github.com/users/defunkt",
-  "html_url": "https://github.com/defunkt",
-  ...
-}
-
- -

Mmmmm, tastes like JSON. Let’s add the -i flag to include headers:

- -
-$ curl -i https://api.github.com/users/defunkt
-
-HTTP/1.1 200 OK
-Server: GitHub.com
-Date: Sun, 11 Nov 2012 18:43:28 GMT
-Content-Type: application/json; charset=utf-8
-Connection: keep-alive
-Status: 200 OK
-ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
-X-RateLimit-Limit: 60
-X-RateLimit-Remaining: 57
-X-RateLimit-Reset: 1352660008
-X-GitHub-Media-Type: github.beta
-Vary: Accept
-Cache-Control: public, max-age=60, s-maxage=60
-X-Content-Type-Options: nosniff
-Content-Length: 692
-Last-Modified: Tue, 30 Oct 2012 18:58:42 GMT
-
-{
-  "login": "defunkt",
-  "id": 2,
-  "url": "https://api.github.com/users/defunkt",
-  "html_url": "https://github.com/defunkt",
-  ...
-}
-
- -

There are a few interesting bits in the response headers. As expected, the -Content-Type is application/json.

- -

Any headers beginning with X- are custom headers, and are not included in the -HTTP spec. Let’s take a look at a few of them:

- -
    -
  • -X-GitHub-Media-Type has a value of github.beta. This lets us know the media type -for the response. Media types have helped us version our output in API v3. We’ll -talk more about that later.
  • -
  • Take note of the X-RateLimit-Limit and X-RateLimit-Remaining headers. This -pair of headers indicate how many requests a client can make in -a rolling time period (typically an hour) and how many of those requests the -client has already spent.
  • -
- -

Authentication

- -

Unauthenticated clients can make 60 requests per hour. To get more, we’ll need to -authenticate. In fact, doing anything interesting with the GitHub API requires -authentication.

- -

Basic

- -

The easiest way to authenticate with the GitHub API is by simply using your GitHub -username and password via Basic Authentication.

- -
-$ curl -i -u <your_username> https://api.github.com/users/defunkt
-
-Enter host password for user '<your_username>':
-
- -

The -u flag sets the username, and cURL will prompt you for the password. You -can use -u "username:password" to avoid the prompt, but this leaves your -password in shell history and isn’t recommended. When authenticating, you -should see your rate limit bumped to 5,000 requests an hour, as indicated in the -X-RateLimit-Limit header.

- -

In addition to just getting more calls per hour, authentication is the key to -reading and writing private information via the API.

- -

Two-factor authentication

- -

If you have two-factor authentication enabled, the API will return a -401 Unauthorized error code for the above request (and every other API request):

- -
-$ curl -i -u <your_username> https://api.github.com/users/defunkt
-
-Enter host password for user '<your_username>':
-
-HTTP/1.1 401 Unauthorized
-X-GitHub-OTP: required; :2fa-type
-
-{
-  "message": "Must specify two-factor authentication OTP code.",
-  "documentation_url": "http://developer.github.com/v3/auth#working-with-two-factor-authentication"
-}
-
- -

The easiest way to get around that error is to create an OAuth token and use -OAuth authentication instead of Basic Authentication. See the -OAuth section below for more information.

- -

Get your own user profile

- -

When properly authenticated, you can take advantage of the permissions -associated with your GitHub account. For example, try getting -your own user profile:

- -
-$ curl -i -u <your_username> https://api.github.com/user
-
-{
-  ...
-  "plan": {
-    "space": 2516582,
-    "collaborators": 10,
-    "private_repos": 20,
-    "name": "medium"
-  }
-  ...
-}
-
- -

This time, in addition to the same set of public information we -retrieved for @defunkt earlier, you should also see the non-public -information for your user profile. For example, you’ll see a plan object -in the response which gives details about the GitHub plan for the account.

- -

OAuth

- -

While convenient, Basic Authentication isn’t ideal because you shouldn’t give your GitHub -username and password to anyone. Applications that need to read or write -private information using the API on behalf of another user should use OAuth.

- -

Instead of usernames and passwords, OAuth uses tokens. Tokens provide two big -features:

- -
    -
  • -Revokable access: users can revoke authorization to third party apps at any time
  • -
  • -Limited access: users can review the specific access that a token -will provide before authorizing a third party app
  • -
- -

Normally, tokens are created via a web flow. An application -sends users to GitHub to log in. GitHub then presents a dialog -indicating the name of the app, as well as the level of access the app -has once it’s authorized by the user. After a user authorizes access, GitHub -redirects the user back to the application:

- -

- -

However, you don’t need to set up the entire web flow to begin working with OAuth tokens. -An easier way to get a token is to create a Personal token via your -Application settings page:

- -

- -

Also, the Authorizations API makes it simple to use Basic Authentication -to create an OAuth token. Try pasting and running the following command:

- -
-$ curl -i -u <your_username> -d '{"scopes": ["repo"]}' \
-    https://api.github.com/authorizations
-
-HTTP/1.1 201 Created
-Location: https://api.github.com/authorizations/2
-Content-Length: 384
-
-{
-  "scopes": [
-    "repo"
-  ],
-  "token": "5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4",
-  "updated_at": "2012-11-14T14:04:24Z",
-  "url": "https://api.github.com/authorizations/2",
-  "app": {
-    "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
-    "name": "GitHub API"
-  },
-  "created_at": "2012-11-14T14:04:24Z",
-  "note_url": null,
-  "id": 2,
-  "note": null
-}
-
- -

There’s a lot going on in this one little call, so let’s break it down. First, -the -d flag indicates we’re doing a POST, using the -application/x-www-form-urlencoded content type (as opposed to GET). All POST -requests to the GitHub API should be in JSON.

- -

Next, let’s look at the scopes we’re sending over in this call. When creating -a new token, we include an optional array of scopes, or access -levels, that indicate what information this token can access. In this case, -we’re setting up the token with repo access, which grants access to read and -write to private repositories. See the scopes docs for a full list of -scopes. You should only request scopes that your application actually needs, -in order to not frighten users with potentially invasive actions. The 201 -status code tells us that the call was successful, and the JSON returned -contains the details of our new OAuth token.

- -

If you have two-factor authentication enabled, the API will -return the previously described 401 Unauthorized error code -for the above request. You can get around that error by providing a 2FA OTP code -in the X-GitHub-OTP request header:

- -
-$ curl -i -u <your_username> -H "X-GitHub-OTP: <your_2fa_OTP_code>" \
-    -d '{"scopes": ["repo"]}' https://api.github.com/authorizations
-
- -

If you enabled 2FA with a mobile application, go ahead and get an OTP code from -your one-time password application on your phone. If you enabled 2FA with text -messages, you’ll receive an SMS with your OTP code after making a request to -this endpoint.

- -

Now, we can use the forty character token instead of a username and password -in the rest of our examples. Let’s grab our own user info again, using OAuth this time:

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    https://api.github.com/user
-
- -

Treat OAuth tokens like passwords! Don’t share them with other users or store -them in insecure places. The tokens in these examples are fake and the names have -been changed to protect the innocent.

- -

Now that we’ve got the hang of making authenticated calls, let’s move along to -the Repositories API.

- -

Repositories

- -

Almost any meaningful use of the GitHub API will involve some level of Repository -information. We can GET repository details in the same way we fetched user -details earlier:

- -
-$ curl -i https://api.github.com/repos/twbs/bootstrap
-
- -

In the same way, we can view repositories for the authenticated user:

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    https://api.github.com/user/repos
-
- -

Or, we can list repositories for another user:

- -
-$ curl -i https://api.github.com/users/technoweenie/repos
-
- -

Or, we can list repositories for an organization:

- -
-$ curl -i https://api.github.com/orgs/mozilla/repos
-
- -

The information returned from these calls will depend on how we authenticate:

- -
    -
  • Using Basic Authentication, the response includes all repositories the -the user has access to see on github.com.
  • -
  • Using OAuth, private repositories are only returned if the OAuth token -contains the repo scope.
  • -
- -

As the docs indicate, these methods take a type parameter that -can filter the repositories returned based on what type of access the user has -for the repository. In this way, we can fetch only directly-owned repositories, -organization repositories, or repositories the user collaborates on via a team.

- -
-$ curl -i "https://api.github.com/users/technoweenie/repos?type=owner"
-
- -

In this example, we grab only those repositories that technoweenie owns, not the -ones on which he collaborates. Note the quoted URL above. Depending on your -shell setup, cURL sometimes requires a quoted URL or else it ignores the -query string.

- -

Create a repository

- -

Fetching information for existing repositories is a common use case, but the -GitHub API supports creating new repositories as well. To create a repository, -we need to POST some JSON containing the details and configuration options.

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    -d '{ \
-        "name": "blog", \
-        "auto_init": true, \
-        "private": true, \
-        "gitignore_template": "nanoc" \
-      }' \
-    https://api.github.com/user/repos
-
- -

In this minimal example, we create a new repository for our blog (to be served -on GitHub Pages, perhaps). Though the blog will be public, we’ve made -the repository private. In this single step, we’ll also initialize it with -a README and a nanoc-flavored .gitignore template.

- -

The resulting repository will be found at https://github.com/<your_username>/blog. -To create a repository under an organization for which you’re -an owner, just change the API method from /user/repos to /orgs/<org_name>/repos.

- -

Next, let’s fetch our newly created repository:

- -
-$ curl -i https://api.github.com/repos/pengwynn/blog
-
-HTTP/1.1 404 Not Found
-
-{
-    "message": "Not Found"
-}
-
- -

Oh noes! Where did it go? Since we created the repository as private, we need -to authenticate in order to see it. If you’re a grizzled HTTP user, you might -expect a 403 instead. Since we don’t want to leak information about private -repositories, the GitHub API returns a 404 in this case, as if to say “we can -neither confirm nor deny the existence of this repository.”

- -

Issues

- -

The UI for Issues on GitHub aims to provide ‘just enough’ workflow while -staying out of your way. With the GitHub Issues API, you can pull -data out or create issues from other tools to create a workflow that works for -your team.

- -

Just like github.com, the API provides a few methods to view issues for the -authenticated user. To see all your issues, call GET /issues:

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    https://api.github.com/issues
-
- -

To get only the issues under one of your GitHub organizations, call GET -/orgs/<org>/issues:

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    https://api.github.com/orgs/rails/issues
-
- -

We can also get all the issues under a single repository:

- -
-$ curl -i https://api.github.com/repos/rails/rails/issues
-
- -

Pagination

- -

A project the size of Rails has thousands of issues. We’ll need to paginate, -making multiple API calls to get the data. Let’s repeat that last call, this -time taking note of the response headers:

- -
-$ curl -i https://api.github.com/repos/rails/rails/issues
-
-HTTP/1.1 200 OK
-
-Link: <https://api.github.com/repos/rails/rails/issues?page=2>; rel="next",
-<https://api.github.com/repos/rails/rails/issues?page=14>; rel="last"
-
- -

The Link header provides a way for a response to link to -external resources, in this case additional pages of data. Since our call found -more than thirty issues (the default page size), the API tells us where we can -find the next page and the last page of results.

- -

Creating an issue

- -

Now that we’ve seen how to paginate lists of issues, let’s create an issue from -the API.

- -

To create an issue, we need to be authenticated, so we’ll pass an -OAuth token in the header. Also, we’ll pass the title, body, and labels in the JSON -body to the /issues path underneath the repository in which we want to create -the issue:

- -
-$ curl -i -H 'Authorization: token 5199831f4dd3b79e7c5b7e0ebe75d67aa66e79d4' \
-    -d '{ \
-         "title": "New logo", \
-         "body": "We should have one", \
-         "labels": ["design"] \
-       }' \
-    https://api.github.com/repos/pengwynn/api-sandbox/issues
-
-HTTP/1.1 201 Created
-Location: https://api.github.com/repos/pengwynn/api-sandbox/issues/17
-X-RateLimit-Limit: 5000
-
-{
-  "pull_request": {
-    "patch_url": null,
-    "html_url": null,
-    "diff_url": null
-  },
-  "created_at": "2012-11-14T15:25:33Z",
-  "comments": 0,
-  "milestone": null,
-  "title": "New logo",
-  "body": "We should have one",
-  "user": {
-    "login": "pengwynn",
-    "gravatar_id": "7e19cd5486b5d6dc1ef90e671ba52ae0",
-    "avatar_url": "https://secure.gravatar.com/avatar/7e19cd5486b5d6dc1ef90e671ba52ae0?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
-    "id": 865,
-    "url": "https://api.github.com/users/pengwynn"
-  },
-  "closed_at": null,
-  "updated_at": "2012-11-14T15:25:33Z",
-  "number": 17,
-  "closed_by": null,
-  "html_url": "https://github.com/pengwynn/api-sandbox/issues/17",
-  "labels": [
-    {
-      "color": "ededed",
-      "name": "design",
-      "url": "https://api.github.com/repos/pengwynn/api-sandbox/labels/design"
-    }
-  ],
-  "id": 8356941,
-  "assignee": null,
-  "state": "open",
-  "url": "https://api.github.com/repos/pengwynn/api-sandbox/issues/17"
-}
-
- -

The response gives us a couple of pointers to the newly created issue, both in -the Location response header and the url field of the JSON response.

- -

Conditional requests

- -

A big part of being a good API citizen is respecting rate limits by -caching information that hasn’t changed. The API supports conditional -requests and helps you do the right thing. Consider the -first call we made to get defunkt’s profile:

- -
-$ curl -i https://api.github.com/users/defunkt
-
-HTTP/1.1 200 OK
-ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
-
- -

In addition to the JSON body, take note of the HTTP status code of 200 and -the ETag header. -The ETag is a fingerprint of the response. If we pass that on subsequent calls, -we can tell the API to give us the resource again, only if it has changed:

- -
-$ curl -i -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"' \
-    https://api.github.com/users/defunkt
-
-HTTP/1.1 304 OK
-
- -

The 304 status indicates that the resource hasn’t changed since the last time -we asked for it and the response will contain no body. As a bonus, 304 -responses don’t count against your rate limit.

- -

Woot! Now you know the basics of the GitHub API!

- -
    -
  • Basic & OAuth authentication
  • -
  • Fetching and creating repositories and issues
  • -
  • Conditional requests
  • -
- -

Keep learning with the next API guide Basics of Authentication!

- - -
- - -
- - - - - - - - diff --git a/guides/index.html b/guides/index.html deleted file mode 100644 index 8b3a2b5426..0000000000 --- a/guides/index.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - Development Guides | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Development Guides

- -

This section of the documentation is intended to get you up-and-running with -real-world GitHub API applications. We’ll cover everything you need to know, from -authentication, to manipulating results, to combining results with other services.

- -

Every tutorial here will have a project, and every project will be -stored and documented in our public -platform-samples repository.

- -

Feel free to fork, clone, and improve these guides.

- -

- -
- - -
- - - - - - - - diff --git a/guides/rendering-data-as-graphs/index.html b/guides/rendering-data-as-graphs/index.html deleted file mode 100644 index a265a38fc0..0000000000 --- a/guides/rendering-data-as-graphs/index.html +++ /dev/null @@ -1,463 +0,0 @@ - - - - - - - - Rendering Data as Graphs | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Rendering Data as Graphs

- - - -

In this guide, we’re going to use the API to fetch information about repositories -that we own, and the programming languages that make them up. Then, we’ll -visualize that information in a couple of different ways using the D3.js library. To -interact with the GitHub API, we’ll be using the excellent Ruby library, Octokit.

- -

If you haven’t already, you should read the “Basics of Authentication” -guide before starting this example. You can find the complete source code for this project in the platform-samples repository.

- -

Let’s jump right in!

- -

Setting up an OAuth application

- -

First, register a new application on GitHub. Set the main and callback -URLs to http://localhost:4567/. As before, we’re going to handle authentication for the API by -implementing a Rack middleware using sinatra-auth-github:

- -
require 'sinatra/auth/github'
-
-module Example
-  class MyGraphApp < Sinatra::Base
-    # !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-    # Instead, set and test environment variables, like below
-    # if ENV['GITHUB_CLIENT_ID'] && ENV['GITHUB_CLIENT_SECRET']
-    #  CLIENT_ID        = ENV['GITHUB_CLIENT_ID']
-    #  CLIENT_SECRET    = ENV['GITHUB_CLIENT_SECRET']
-    # end
-
-    CLIENT_ID = ENV['GH_GRAPH_CLIENT_ID']
-    CLIENT_SECRET = ENV['GH_GRAPH_SECRET_ID']
-
-    enable :sessions
-
-    set :github_options, {
-      :scopes    => "repo",
-      :secret    => CLIENT_SECRET,
-      :client_id => CLIENT_ID,
-      :callback_url => "/"
-    }
-
-    register Sinatra::Auth::Github
-
-    get '/' do
-      if !authenticated?
-        authenticate!
-      else
-        access_token = github_user["token"]
-      end
-    end
-  end
-end
- -

Set up a similar config.ru file as in the previous example:

- -
ENV['RACK_ENV'] ||= 'development'
-require "rubygems"
-require "bundler/setup"
-
-require File.expand_path(File.join(File.dirname(__FILE__), 'server'))
-
-run Example::MyGraphApp
- -

Fetching repository information

- -

This time, in order to talk to the GitHub API, we’re going to use the Octokit -Ruby library. This is much easier than directly making a bunch of -REST calls. Plus, Octokit was developed by a GitHubber, and is actively maintained, -so you know it’ll work.

- -

Authentication with the API via Octokit is easy. Just pass your login -and token to the Octokit::Client constructor:

- -
if !authenticated?
-  authenticate!
-else
-  octokit_client = Octokit::Client.new(:login => github_user.login, :oauth_token => github_user.token)
-end
- -

Let’s do something interesting with the data about our repositories. We’re going -to see the different programming languages they use, and count which ones are used -most often. To do that, we’ll first need a list of our repositories from the API. -With Octokit, that looks like this:

- -
repos = client.repositories
- -

Next, we’ll iterate over each repository, and count the language that GitHub -associates with it:

- -
language_obj = {}
-repos.each do |repo|
-  # sometimes language can be nil
-  if repo.language
-    if !language_obj[repo.language]
-      language_obj[repo.language] = 1
-    else
-      language_obj[repo.language] += 1
-    end
-  end
-end
-
-languages.to_s
- -

When you restart your server, your web page should display something -that looks like this:

- -
{"JavaScript"=>13, "PHP"=>1, "Perl"=>1, "CoffeeScript"=>2, "Python"=>1, "Java"=>3, "Ruby"=>3, "Go"=>1, "C++"=>1}
-
- -

So far, so good, but not very human-friendly. A visualization -would be great in helping us understand how these language counts are distributed. Let’s feed -our counts into D3 to get a neat bar graph representing the popularity of the languages we use.

- -

Visualizing language counts

- -

D3.js, or just D3, is a comprehensive library for creating many kinds of charts, graphs, and interactive visualizations. -Using D3 in detail is beyond the scope of this guide, but for a good introductory article, -check out “D3 for Mortals”.

- -

D3 is a JavaScript library, and likes working with data as arrays. So, let’s convert our Ruby hash into -a JSON array for use by JavaScript in the browser.

- -
languages = []
-language_obj.each do |lang, count|
-  languages.push :language => lang, :count => count
-end
-
-erb :lang_freq, :locals => { :languages => languages.to_json}
- -

We’re simply iterating over each key-value pair in our object and pushing them into -a new array. The reason we didn’t do this earlier is because we didn’t want to iterate -over our language_obj object while we were creating it.

- -

Now, lang_freq.erb is going to need some JavaScript to support rendering a bar graph. -For now, you can just use the code provided here, and refer to the resources linked above -if you want to learn more about how D3 works:

- -
<!DOCTYPE html>
-<meta charset="utf-8">
-<html>
-  <head>
-    <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.0.1/d3.v3.min.js"></script>
-    <style>
-    svg {
-      padding: 20px;
-    }
-    rect {
-      fill: #2d578b
-    }
-    text {
-      fill: white;
-    }
-    text.yAxis {
-      font-size: 12px;
-      font-family: Helvetica, sans-serif;
-      fill: black;
-    }
-    </style>
-  </head>
-  <body>
-    <p>Check this sweet data out:</p>
-    <div id="lang_freq"></div>
-
-  </body>
-  <script>
-    var data = <%= languages %>;
-
-    var barWidth = 40;
-    var width = (barWidth + 10) * data.length;
-    var height = 300;
-
-    var x = d3.scale.linear().domain([0, data.length]).range([0, width]);
-    var y = d3.scale.linear().domain([0, d3.max(data, function(datum) { return datum.count; })]).
-      rangeRound([0, height]);
-
-    // add the canvas to the DOM
-    var languageBars = d3.select("#lang_freq").
-      append("svg:svg").
-      attr("width", width).
-      attr("height", height);
-
-    languageBars.selectAll("rect").
-      data(data).
-      enter().
-      append("svg:rect").
-      attr("x", function(datum, index) { return x(index); }).
-      attr("y", function(datum) { return height - y(datum.count); }).
-      attr("height", function(datum) { return y(datum.count); }).
-      attr("width", barWidth);
-
-    languageBars.selectAll("text").
-      data(data).
-      enter().
-      append("svg:text").
-      attr("x", function(datum, index) { return x(index) + barWidth; }).
-      attr("y", function(datum) { return height - y(datum.count); }).
-      attr("dx", -barWidth/2).
-      attr("dy", "1.2em").
-      attr("text-anchor", "middle").
-      text(function(datum) { return datum.count;});
-
-    languageBars.selectAll("text.yAxis").
-      data(data).
-      enter().append("svg:text").
-      attr("x", function(datum, index) { return x(index) + barWidth; }).
-      attr("y", height).
-      attr("dx", -barWidth/2).
-      attr("text-anchor", "middle").
-      text(function(datum) { return datum.language;}).
-      attr("transform", "translate(0, 18)").
-      attr("class", "yAxis");
-  </script>
-</html>
- -

Phew! Again, don’t worry about what most of this code is doing. The relevant part -here is a line way at the top–var data = <%= languages %>;–which indicates -that we’re passing our previously created languages array into ERB for manipulation.

- -

As the “D3 for Mortals” guide suggests, this isn’t necessarily the best use of -D3. But it does serve to illustrate how you can use the library, along with Octokit, -to make some really amazing things.

- -

Combining different API calls

- -

Now it’s time for a confession: the language attribute within repositories -only identifies the “primary” language defined. That means that if you have -a repository that combines several languages, the one with the most bytes of code -is considered to be the primary language.

- -

Let’s combine a few API calls to get a true representation of which language -has the greatest number of bytes written across all our code. A treemap -should be a great way to visualize the sizes of our coding languages used, rather -than simply the count. We’ll need to construct an array of objects that looks -something like this:

- -
[ { "name": "language1", "size": 100},
-  { "name": "language2", "size": 23}
-  ...
-]
- -

Since we already have a list of repositories above, let’s inspect each one, and -call the language listing API method:

- -
repos.each do |repo|
-  repo_name = repo.name
-  repo_langs = octokit_client.languages("#{github_user.login}/#{repo_name}")
-end
- -

From there, we’ll cumulatively add each language found to a “master list”:

- -
repo_langs.each do |lang, count|
-  if !language_obj[lang]
-    language_obj[lang] = count
-  else
-    language_obj[lang] += count
-  end
-end
- -

After that, we’ll format the contents into a structure that D3 understands:

- -
language_obj.each do |lang, count|
-  language_byte_count.push :name => "#{lang} (#{count})", :count => count
-end
-
-# some mandatory formatting for D3
-language_bytes = [ :name => "language_bytes", :elements => language_byte_count]
- -

(For more information on D3 tree map magic, check out this simple tutorial.)

- -

To wrap up, we pass this JSON information over to the same ERB template:

- -
erb :lang_freq, :locals => { :languages => languages.to_json, :language_byte_count => language_bytes.to_json}
- -

Like before, here’s a bunch of JavaScript that you can drop -directly into your template:

- -
<div id="byte_freq"></div>
-<script>
-  var language_bytes = <%= language_byte_count %>
-
-  var childrenFunction = function(d){return d.elements};
-  var sizeFunction = function(d){return d.count;};
-  var colorFunction = function(d){return Math.floor(Math.random()*20)};
-  var nameFunction = function(d){return d.name;};
-
-  var color = d3.scale.linear()
-              .domain([0,10,15,20])
-              .range(["grey","green","yellow","red"]);
-
-  drawTreemap(5000, 2000, '#byte_freq', language_bytes, childrenFunction, nameFunction, sizeFunction, colorFunction, color);
-
-  function drawTreemap(height,width,elementSelector,language_bytes,childrenFunction,nameFunction,sizeFunction,colorFunction,colorScale){
-
-      var treemap = d3.layout.treemap()
-          .children(childrenFunction)
-          .size([width,height])
-          .value(sizeFunction);
-
-      var div = d3.select(elementSelector)
-          .append("div")
-          .style("position","relative")
-          .style("width",width + "px")
-          .style("height",height + "px");
-
-      div.data(language_bytes).selectAll("div")
-          .data(function(d){return treemap.nodes(d);})
-          .enter()
-          .append("div")
-          .attr("class","cell")
-          .style("background",function(d){ return colorScale(colorFunction(d));})
-          .call(cell)
-          .text(nameFunction);
-  }
-
-  function cell(){
-      this
-          .style("left",function(d){return d.x + "px";})
-          .style("top",function(d){return d.y + "px";})
-          .style("width",function(d){return d.dx - 1 + "px";})
-          .style("height",function(d){return d.dy - 1 + "px";});
-  }
-</script>
- -

Et voila! Beautiful rectangles containing your repo languages, with relative -proportions that are easy to see at a glance. You might need to -tweak the height and width of your treemap, passed as the first two -arguments to drawTreemap above, to get all the information to show up properly.

- - -
- - -
- - - - - - - - diff --git a/guides/traversing-with-pagination/index.html b/guides/traversing-with-pagination/index.html deleted file mode 100644 index 47fb806286..0000000000 --- a/guides/traversing-with-pagination/index.html +++ /dev/null @@ -1,366 +0,0 @@ - - - - - - - - Traversing with Pagination | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Traversing with Pagination

- - - -

The GitHub API provides a vast wealth of information for developers to consume. -Most of the time, you might even find that you’re asking for too much information, -and in order to keep our servers happy, the API will automatically paginate the requested items.

- -

In this guide, we’ll make some calls to the GitHub Search API, and iterate over -the results using pagination. You can find the complete source code for this project -in the platform-samples repository.

- -

Basics of Pagination

- -

To start with, it’s important to know a few facts about receiving paginated items:

- -
    -
  1. Different API calls respond with different defaults. For example, a call to -list GitHub’s public repositories -provides paginated items in sets of 30, whereas a call to the GitHub Search API -provides items in sets of 100
  2. -
  3. You can specify how many items to receive (up to a maximum of 100); but,
  4. -
  5. For technical reasons, not every endpoint behaves the same. For example, -events won’t let you set a maximum for items to receive. -Be sure to read the documentation on how to handle paginated results for specific endpoints.
  6. -
- -

Information about pagination is provided in the Link header -of an API call. For example, let’s make a curl request to the search API, to find -out how many times Mozilla projects use the phrase addClass:

- -
curl -I "https://api.github.com/search/code?q=addClass+user:mozilla"
-
- -

The -I parameter indicates that we only care about the headers, not the actual -content. In examining the result, you’ll notice some information in the Link header -that looks like this:

- -
Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next",
-  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last"
-
- -

Let’s break that down. rel="next" says that the next page is page=2. This makes -sense, since by default, all paginated queries start at page 1. rel="last" -provides some more information, stating that the last page of results is on page 34. -Thus, we have 33 more pages of information about addClass that we can consume. -Nice!

- -

Keep in mind that you should always rely on these link relations provided -to you. Don’t try to guess or construct your own URL. Some API calls, like listing -commits on a repository, use pagination results that are based -on SHA values, not numbers.

- - - -

Now that you know how many pages there are to receive, you can start navigating -through the pages to consume the results. You do this by passing in a page -parameter. By default, page always starts at 1. Let’s jump ahead to page 14 -and see what happens:

- -
curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&page=14"
-
- -

Here’s the link header once more:

- -
Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel="next",
-  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last",
-  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1>; rel="first",
-  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=13>; rel="prev"
-
- -

As expected, rel="next" is at 15, and rel="last" is still 34. But now we’ve -got some more information: rel="first" indicates the URL for the first page, -and more importantly, rel="prev" lets you know the page number of the previous -page. Using this information, you could construct some UI that lets users jump -between the first, previous, next, or last list of results in an API call.

- -

Changing the number of items received

- -

By passing the per_page parameter, you can specify how many items you want -each page to return, up to 100 items. Let’s try asking for 50 items about addClass:

- -
curl -I "https://api.github.com/search/code?q=addClass+user:mozilla&per_page=50"
-
- -

Notice what it does to the header response:

- -
Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&per_page=50&page=2>; rel="next",
-  <https://api.github.com/search/code?q=addClass+user%3Amozilla&per_page=50&page=20>; rel="last"
-
- -

As you might have guessed, the rel="last" information says that the last page -is now 20. This is because we are asking for more information per page about -our results.

- -

Consuming the information

- -

You don’t want to be making low-level curl calls just to be able to work with -pagination, so let’s write a little Ruby script that does everything we’ve -just described above.

- -

As always, first we’ll require GitHub’s Octokit.rb Ruby library, and -pass in our personal access token:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
- -

Next, we’ll execute the search, using Octokit’s search_code method. Unlike -using curl, we can also immediately retrieve the number of results, so let’s -do that:

- -
results = client.search_code('addClass user:mozilla')
-total_count = results.total_count
- -

Now, let’s grab the number of the last page, similar to page=34>; rel="last" -information in the link header. Octokit.rb support pagination information through -an implementation called “Hypermedia link relations.” -We won’t go into detail about what that is, but, suffice to say, each element -in the results variable has a hash called rels, which can contain information -about :next, :last, :first, and :prev, depending on which result you’re -on. These relations also contain information about the resulting URL, by calling -rels[:last].href.

- -

Knowing this, let’s grab the page number of the last result, and present all -this information to the user:

- -
last_response = client.last_response
-number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1]
-
-puts "There are #{total_count} results, on #{number_of_pages} pages!"
- -

Finally, let’s iterate through the results. You could do this with a loop for i in 1..number_of_pages.to_i, -but instead, let’s follow the rels[:next] headers to retrieve information from -each page. For the sake of simplicity, let’s just grab the file path of the first -result from each page. To do this, we’ll need a loop; and at the end of every loop, -we’ll retrieve the data set for the next page by following the rels[:next] information. -The loop will finish when there is no rels[:next] information to consume (in other -words, we are at rels[:last]). It might look something like this:

- -
loop do
-  puts last_response.data.items.first.path
-  last_response = last_response.rels[:next].get
-  sleep 4 # back off from the API rate limiting; don't do this in Real Life
-  break if last_response.rels[:next].nil?
-end
- -

Changing the number of items per page is extremely simple with Octokit.rb. Simply -pass a per_page options hash to the initial client construction. After that, -your code should remain intact:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
-
-results = client.search_code('addClass user:mozilla', :per_page => 100)
-total_count = results.total_count
-
-last_response = client.last_response
-number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1]
-
-puts last_response.rels[:last].href
-puts "There are #{total_count} results, on #{number_of_pages} pages!"
-
-puts "And here's the first path for every set"
-
-loop do
-  puts last_response.data.items.first.path
-  last_response = last_response.rels[:next].get
-  sleep 4 # back off from the API rate limiting; don't do this in Real Life
-  break if last_response.rels[:next].nil?
-end
- - - -

Normally, with pagination, your goal isn’t to concatenate all of the possible -results, but rather, to produce a set of navigation, like this:

- -

Sample of pagination links

- -

Let’s sketch out a micro-version of what that might entail.

- -

From the code above, we already know we can get the number_of_pages in the -paginated results from the first call:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
-
-results = client.search_code('addClass user:mozilla')
-total_count = results.total_count
-
-last_response = client.last_response
-number_of_pages = last_response.rels[:last].href.match(/page=(\d+)$/)[1]
-
-puts last_response.rels[:last].href
-puts "There are #{total_count} results, on #{number_of_pages} pages!"
- -

From there, we can construct a beautiful ASCII representation of the number boxes:

- -
numbers = ""
-for i in 1..number_of_pages.to_i
-  numbers << "[#{i}] "
-end
-puts numbers
- -

Let’s simulate a user clicking on one of these boxes, by constructing a random -number:

- -
random_page = Random.new
-random_page = random_page.rand(1..number_of_pages.to_i)
-
-puts "A User appeared, and clicked number #{random_page}!"
- -

Now that we have a page number, we can use Octokit to explicitly retrieve that -individual page, by passing the :page option:

- -
clicked_results = client.search_code('addClass user:mozilla', :page => random_page)
- -

If we wanted to get fancy, we could also grab the previous and next pages, in -order to generate links for back (<<) and foward (>>) elements:

- -
prev_page_href = client.last_response.rels[:prev] ? client.last_response.rels[:prev].href : "(none)"
-next_page_href = client.last_response.rels[:next] ? client.last_response.rels[:next].href : "(none)"
-
-puts "The prev page link is #{prev_page_href}"
-puts "The next page link is #{next_page_href}"
- - -
- - -
- - - - - - - - diff --git a/guides/working-with-comments/index.html b/guides/working-with-comments/index.html deleted file mode 100644 index 93c3cce916..0000000000 --- a/guides/working-with-comments/index.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - Working with Comments | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Working with Comments

- - - -

For any Pull Request, GitHub provides three kinds of comment views: -comments on the Pull Request as a whole, comments on a specific line within the Pull Request, -and comments on a specific commit within the Pull Request.

- -

Each of these types of comments goes through a different portion of the GitHub API. -In this guide, we’ll explore how you can access and manipulate each one. For every -example, we’ll be using this sample Pull Request made on the “octocat” -repository. As always, samples can be found in our platform-samples repository.

- -

Pull Request Comments

- -

To access comments on a Pull Request, you’ll go through the Issues API. -This may seem counterintuitive at first. But once you understand that a Pull -Request is just an Issue with code, it makes sense to use the Issues API to -create comments on a Pull Request.

- -

We’ll demonstrate fetching Pull Request comments by creating a Ruby script using -Octokit.rb. You’ll also want to create a personal access token.

- -

The following code should help you get started accessing comments from a Pull Request -using Octokit.rb:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
-
-client.issue_comments("octocat/Spoon-Knife", 1176).each do |comment|
-  username = comment[:user][:login]
-  post_date = comment[:created_at]
-  content = comment[:body]
-
-  puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n"
-end
- -

Here, we’re specifically calling out to the Issues API to get the comments (issue_comments), -providing both the repository’s name (octocat/Spoon-Knife), and the Pull Request ID -we’re interested in (1176). After that, it’s simply a matter of iterating through -the comments to fetch information about each one.

- -

Pull Request Comments on a Line

- -

Within the diff view, you can start a discussion on a particular aspect of a singular -change made within the Pull Request. These comments occur on the individual lines -within a changed file. The endpoint URL for this discussion comes from the Pull Request Review API.

- -

The following code fetches all the Pull Request comments made on files, given a single Pull Request number:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
-
-client.pull_request_comments("octocat/Spoon-Knife", 1176).each do |comment|
-  username = comment[:user][:login]
-  post_date = comment[:created_at]
-  content = comment[:body]
-  path = comment[:path]
-  position = comment[:position]
-
-  puts "#{username} made a comment on #{post_date} for the file called #{path}, on line #{position}. It says:\n'#{content}'\n"
-end
- -

You’ll notice that it’s incredibly similar to the example above. The difference -between this view and the Pull Request comment is the focus of the conversation. -A comment made on a Pull Request should be reserved for discussion or ideas on -the overall direction of the code. A comment made as part of a Pull Request review should -deal specifically with the way a particular change was implemented within a file.

- -

Commit Comments

- -

The last type of comments occur specifically on individual commits. For this reason, -they make use of the commit comment API.

- -

To retrieve the comments on a commit, you’ll want to use the SHA1 of the commit. -In other words, you won’t use any identifier related to the Pull Request. Here’s an example:

- -
require 'octokit'
-
-# !!! DO NOT EVER USE HARD-CODED VALUES IN A REAL APP !!!
-# Instead, set and test environment variables, like below
-client = Octokit::Client.new :access_token => ENV['MY_PERSONAL_TOKEN']
-
-client.commit_comments("octocat/Spoon-Knife", "cbc28e7c8caee26febc8c013b0adfb97a4edd96e").each do |comment|
-  username = comment[:user][:login]
-  post_date = comment[:created_at]
-  content = comment[:body]
-
-  puts "#{username} made a comment on #{post_date}. It says:\n'#{content}'\n"
-end
- -

Note that this API call will retrieve single line comments, as well as comments made -on the entire commit.

- - -
- - -
- - - - - - - - diff --git a/images/nav-rule.png b/images/nav-rule.png deleted file mode 100644 index f97c91b383..0000000000 Binary files a/images/nav-rule.png and /dev/null differ diff --git a/images/oauth_prompt.png b/images/oauth_prompt.png deleted file mode 100644 index af74b809bc..0000000000 Binary files a/images/oauth_prompt.png and /dev/null differ diff --git a/images/personal_token.png b/images/personal_token.png deleted file mode 100644 index fea0980fba..0000000000 Binary files a/images/personal_token.png and /dev/null differ diff --git a/images/rackspace_logo.png b/images/rackspace_logo.png deleted file mode 100644 index f3b73f1f05..0000000000 Binary files a/images/rackspace_logo.png and /dev/null differ diff --git a/index.html b/index.html deleted file mode 100644 index 908c53a4ee..0000000000 --- a/index.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - GitHub Developer - - - - - - - - - - - -
- -
- -
-

Leverage the power of
-GitHub in your app

-

Get started with one of our guides, or jump straight into the API documentation.

- Browse the documentation - -
- -
-
    -
  • - -

    Get Started

    -

    New to the GitHub API? With these guides you’ll be up and running in a snap.

    -
  • -
  • - -

    Libraries

    -

    We’ve got you covered. Use the GitHub API in your favorite language.

    -
  • -
  • - -

    Support

    -

    Are you stuck? Already tried our troubleshooting guide? Talk to a supportocat.

    -
  • - -
-
- - - - - - - - - diff --git a/layouts/_changes.html b/layouts/_changes.html new file mode 100644 index 0000000000..594da817c1 --- /dev/null +++ b/layouts/_changes.html @@ -0,0 +1,6 @@ +<% @changes.each do |article| %> +
+ <%= render '_meta', :item => article %> + <%= article.compiled_content %> +
+<% end %> diff --git a/layouts/_meta.html b/layouts/_meta.html new file mode 100644 index 0000000000..ffebb2fc9a --- /dev/null +++ b/layouts/_meta.html @@ -0,0 +1,19 @@ +

+ <%= @item[:title] %> +

+ +
+ +
diff --git a/layouts/api.html b/layouts/api.html new file mode 100644 index 0000000000..c88bb4ae0d --- /dev/null +++ b/layouts/api.html @@ -0,0 +1,27 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + + +
+
+ <%= yield %> +
+ + <%= render 'sidebar' %> +
+ + <%= render 'footer' %> + + diff --git a/layouts/blog.html b/layouts/blog.html new file mode 100644 index 0000000000..3517207783 --- /dev/null +++ b/layouts/blog.html @@ -0,0 +1,20 @@ +<%= render 'head' %> + + + <%= render 'header' %> + +
+
+ <%= yield %> +
+ + +
+ + <%= render 'footer' %> + + diff --git a/layouts/changes.html b/layouts/changes.html new file mode 100644 index 0000000000..710fd394ac --- /dev/null +++ b/layouts/changes.html @@ -0,0 +1,5 @@ +
+<%= render '_meta', :item => @item %> + +<%= yield %> +
diff --git a/layouts/default.html b/layouts/default.html new file mode 100644 index 0000000000..d5cff16727 --- /dev/null +++ b/layouts/default.html @@ -0,0 +1,16 @@ +<%= render 'head' %> + + + <%= render 'header' %> + +
+
+ <%= yield %> +
+ + <%= render 'sidebar' %> +
+ + <%= render 'footer' %> + + diff --git a/layouts/developers.html b/layouts/developers.html new file mode 100644 index 0000000000..ac7fc4504e --- /dev/null +++ b/layouts/developers.html @@ -0,0 +1,10 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + <%= yield %> + + <%= render 'footer' %> + + diff --git a/layouts/footer.html b/layouts/footer.html new file mode 100644 index 0000000000..62b6dfb2fd --- /dev/null +++ b/layouts/footer.html @@ -0,0 +1,50 @@ + + + + diff --git a/layouts/guides.html b/layouts/guides.html new file mode 100644 index 0000000000..8153056801 --- /dev/null +++ b/layouts/guides.html @@ -0,0 +1,50 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + + + + + <%= render 'footer' %> + + diff --git a/layouts/head.html b/layouts/head.html new file mode 100644 index 0000000000..89a594df2a --- /dev/null +++ b/layouts/head.html @@ -0,0 +1,15 @@ + + + + + + + + <%= @item[:title] %> + + + + + + + diff --git a/layouts/header.html b/layouts/header.html new file mode 100644 index 0000000000..0304dfa940 --- /dev/null +++ b/layouts/header.html @@ -0,0 +1,20 @@ +
+ +
diff --git a/layouts/headlines.html b/layouts/headlines.html new file mode 100644 index 0000000000..102ccef4ba --- /dev/null +++ b/layouts/headlines.html @@ -0,0 +1,6 @@ +

Recent Posts

+ diff --git a/layouts/libraries.html b/layouts/libraries.html new file mode 100644 index 0000000000..7513c8e39a --- /dev/null +++ b/layouts/libraries.html @@ -0,0 +1,23 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + + +
+ <%= yield %> +
+ + <%= render 'footer' %> + + diff --git a/layouts/overview.html b/layouts/overview.html new file mode 100644 index 0000000000..de3437dc99 --- /dev/null +++ b/layouts/overview.html @@ -0,0 +1,10 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + <%= yield %> + + <%= render 'footer' %> + + diff --git a/v3/changelog/index.html b/layouts/sidebar.html similarity index 50% rename from v3/changelog/index.html rename to layouts/sidebar.html index 5975f68d33..f6c5d046c2 100644 --- a/v3/changelog/index.html +++ b/layouts/sidebar.html @@ -1,77 +1,22 @@ - - - - - - - - GitHub API Changelog - - - - - - - - - - - -
- -
- - - -
-
-

The API changelog can now be found on the homepage. Please update your links.

- -
- - - - - - - - - - diff --git a/layouts/webhooks.html b/layouts/webhooks.html new file mode 100644 index 0000000000..6d1b959710 --- /dev/null +++ b/layouts/webhooks.html @@ -0,0 +1,43 @@ +<%= render 'head' %> + + + <%= render 'header' %> + + + +
+
+ <%= yield %> +
+ + +
+
+ + <%= render 'footer' %> + + diff --git a/lib/changes_helper.rb b/lib/changes_helper.rb new file mode 100644 index 0000000000..a1012c76e5 --- /dev/null +++ b/lib/changes_helper.rb @@ -0,0 +1,88 @@ +module ChangesHelper + MimeFormat ||= "application/vnd.github.%s+json".freeze + # Public: Filters the change items out. If a version is given, show only the + # items related to that version. + # + # version - Optional String version key. + # + # Returns an Array of all 30 Nanoc::Item objects, sorted in reverse + # chronological order. + def api_changes(version = nil) + changes = @items.select { |item| item[:kind] == 'change' } + if version + version_s = version.to_s + changes.select { |item| item[:api_version] == version_s } + else + changes + end.sort! do |x, y| + attribute_to_time(y[:created_at]) <=> attribute_to_time(x[:created_at]) + end + end + + # Public + def current_api + @current_api ||= (api_versions[-2] || api_versions.first).first + end + + # Public + def upcoming_api + @upcoming_api ||= begin + version, date = api_versions.last + version unless date + end + end + + # Public + def current_api?(version) + @api_current_checks ||= {} + if @api_current_checks.key?(version) + @api_current_checks[version] + end + + @api_current_checks[version] = version == current_api + end + + # Public + def no_current_api_versions?(*versions) + versions.none? { |v| current_api?(v) } + end + + # Public + def api_released_at(version) + @api_releases ||= {} + if @api_releases.key?(version) + @api_releases[version] + end + + @api_releases[version] = begin + pair = api_versions.detect do |(name, date)| + name == version + end + pair ? pair[1] : nil + end + end + + # Public + def api_mimetype_listing(version) + version_s = version.to_s + mime = mimetype_for version_s + if time = api_released_at(version_s) + mime << " (" + mime << "Current, " if current_api?(version_s) + mime << strftime(time) + mime << ")" + else + mime + end + end + + # Internal + def mimetype_for(version) + MimeFormat % version.to_s + end + + # Internal + def api_versions + @api_versions ||= Array(@site.config[:api_versions]) + end +end diff --git a/lib/default.rb b/lib/default.rb new file mode 100644 index 0000000000..1921f46370 --- /dev/null +++ b/lib/default.rb @@ -0,0 +1,3 @@ +# All files in the 'lib' directory will be loaded +# before nanoc starts compiling. +include Nanoc::Helpers::Rendering, Nanoc::Helpers::Blogging, ChangesHelper diff --git a/lib/enterprise-purge.rb b/lib/enterprise-purge.rb new file mode 100644 index 0000000000..9ffcb372b5 --- /dev/null +++ b/lib/enterprise-purge.rb @@ -0,0 +1,19 @@ +class EnterprisePurgeFilter < Nanoc::Filter + identifier :enterprise_purge_filter + type :text + + ENTERPRISE_START_STRING = '{{#enterprise-only}}' + ENTERPRISE_END_STRING = '{{/enterprise-only}}' + + # if we're running in Dotcom mode, we'll be lazy and just hide the content. + # otherwise, when running script/enterprise-cutter, we'll bring these sections back + def run(content, params={}) + start_replacement = '
' + end_replacement = '
' + + content = content.gsub(%r{

#{ENTERPRISE_START_STRING}

}, start_replacement) + content = content.gsub(%r{

#{ENTERPRISE_END_STRING}

}, end_replacement) + + content + end +end diff --git a/lib/resources.rb b/lib/resources.rb new file mode 100644 index 0000000000..f684dea429 --- /dev/null +++ b/lib/resources.rb @@ -0,0 +1,2443 @@ +require 'pp' +require 'yajl/json_gem' +require 'stringio' +require 'cgi' +require 'securerandom' + +module GitHub + module Resources + module Helpers + + STATUSES ||= { + 200 => '200 OK', + 201 => '201 Created', + 202 => '202 Accepted', + 204 => '204 No Content', + 205 => '205 Reset Content', + 301 => '301 Moved Permanently', + 302 => '302 Found', + 307 => '307 Temporary Redirect', + 304 => '304 Not Modified', + 401 => '401 Unauthorized', + 403 => '403 Forbidden', + 404 => '404 Not Found', + 405 => '405 Method not allowed', + 409 => '409 Conflict', + 422 => '422 Unprocessable Entity', + 500 => '500 Server Error', + 502 => '502 Bad Gateway' + } + + DefaultTimeFormat ||= "%B %-d, %Y".freeze + + def post_date(item) + strftime item[:created_at] + end + + def strftime(time, format = DefaultTimeFormat) + attribute_to_time(time).strftime(format) + end + + def avatar_for(login) + %(Avatar for #{login}) % avatar_url_for(login) + end + + def avatar_url_for(login) + "https://github.com/#{login}.png" + end + + def headers(status, head = {}) + lines = ["Status: #{STATUSES[status]}"] + head.each do |key, value| + case key + when :pagination + lines << link_header(value) + else + lines << "#{key}: #{value}" + end + end + + lines << "X-RateLimit-Limit: 5000" unless head.has_key?('X-RateLimit-Limit') + lines << "X-RateLimit-Remaining: 4999" unless head.has_key?('X-RateLimit-Remaining') + + %(
#{lines * "\n"}
\n) + end + + def link_header(rels) + formatted_rels = rels.map { |name, url| link_header_rel(name, url) } + + lines = ["Link: #{formatted_rels.shift}"] + while formatted_rels.any? + lines.last << "," + lines << " #{formatted_rels.shift}" + end + + lines + end + + def link_header_rel(name, url) + %Q{<#{url}>; rel="#{name}"} + end + + def default_pagination_rels + { + :next => "https://api.github.com/resource?page=2", + :last => "https://api.github.com/resource?page=5" + } + end + + def json(key) + hash = get_resource(key) + hash = yield hash if block_given? + + %(
) +
+          JSON.pretty_generate(hash) + "
" + end + + def get_resource(key) + hash = case key + when Hash + h = {} + key.each { |k, v| h[k.to_s] = v } + h + when Array + key + else Resources.const_get(key.to_s.upcase) + end + end + + def text_html(response, status, head = {}) + hs = headers(status, head.merge('Content-Type' => 'text/html')) + res = CGI.escapeHTML(response) + hs + %(
) + res + "
" + end + + def webhook_headers(event_name) + "
" + File.read("lib/webhooks/#{event_name}.headers.txt") + "
" + end + + def webhook_payload(event_name) + "
" + File.read("lib/webhooks/#{event_name}.payload.json") + "
" + end + + CONTENT ||= { + 'LATEST_ENTERPRISE_VERSION' => '2.1', + "PUT_CONTENT_LENGTH" => "Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see \"[HTTP verbs](/v3/#http-verbs).\"", + "ORG_HOOK_CONFIG_HASH" => + ''' +Name | Type | Description +-----|------|-------------- +`url` | `string` | **Required** The URL to which the payloads will be delivered. +`content_type` | `string` | The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. +`secret` | `string` | If provided, payloads will be delivered with an `X-Hub-Signature` header. The value of this header is computed as the [HMAC hex digest of the body, using the `secret` as the key][hub-signature]. +`insecure_ssl` | `string` | Determines whether the SSL certificate of the host for `url` will be verified when delivering payloads. Supported values include `"0"` (verification is performed) and `"1"` (verification is not performed). The default is `"0"`. **We strongly recommend not setting this to "1" as you are subject to man-in-the-middle and other attacks.** +''' + } + + def fetch_content(key) + CONTENT[key.to_s.upcase] + end + + end + + USER ||= { + "login" => "octocat", + "id" => 1, + "avatar_url" => "https://github.com/images/error/octocat_happy.gif", + "gravatar_id" => "", + "url" => "https://api.github.com/users/octocat", + "html_url" => "https://github.com/octocat", + "followers_url" => "https://api.github.com/users/octocat/followers", + "following_url" => "https://api.github.com/users/octocat/following{/other_user}", + "gists_url" => "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/octocat/subscriptions", + "organizations_url" => "https://api.github.com/users/octocat/orgs", + "repos_url" => "https://api.github.com/users/octocat/repos", + "events_url" => "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url" => "https://api.github.com/users/octocat/received_events", + "type" => "User", + "site_admin" => false + } + + CONTRIBUTOR ||= USER.merge({ + "contributions" => 32 + }) + + FULL_USER ||= USER.merge({ + "name" => "monalisa octocat", + "company" => "GitHub", + "blog" => "https://github.com/blog", + "location" => "San Francisco", + "email" => "octocat@github.com", + "hireable" => false, + "bio" => "There once was...", + "public_repos" => 2, + "public_gists" => 1, + "followers" => 20, + "following" => 0, + "html_url" => "https://github.com/octocat", + "created_at" => "2008-01-14T04:33:35Z", + "updated_at" => "2008-01-14T04:33:35Z" + }) + + PRIVATE_USER ||= FULL_USER.merge({ + "total_private_repos" => 100, + "owned_private_repos" => 100, + "private_gists" => 81, + "disk_usage" => 10000, + "collaborators" => 8, + "plan" => { + "name" => "Medium", + "space" => 400, + "private_repos" => 20, + "collaborators" => 0 # Plans now allow *unlimited* collaborators, so + # this attribute is deprecated. However, the beta + # and v3 media types need to continue to return an + # integer value for backwards compatibility. + } + }) + + SIMPLE_PUBLIC_KEY ||= { + "id" => 1, + "key" => "ssh-rsa AAA..." + } + + PUBLIC_KEY ||= SIMPLE_PUBLIC_KEY.merge \ + "url" => "https://api.github.com/user/keys/1", + "title" => "octocat@octomac", + "verified" => true, + "created_at" => "2014-12-10T15:53:42Z" + + DEPLOY_KEY ||= SIMPLE_PUBLIC_KEY.merge \ + "url" => "https://api.github.com/repos/octocat/Hello-World/keys/1", + "title" => "octocat@octomac", + "verified" => true, + "created_at" => "2014-12-10T15:53:42Z" + + SIMPLE_REPO ||= { + "id" => 1296269, + "owner" => USER, + "name" => "Hello-World", + "full_name" => "octocat/Hello-World", + "description" => "This your first repo!", + "private" => false, + "fork" => false, + "url" => "https://api.github.com/repos/octocat/Hello-World", + "html_url" => "https://github.com/octocat/Hello-World" + } + + REPO_PERMISSIONS ||= { + "admin" => false, + "push" => false, + "pull" => true + } + + REPO ||= SIMPLE_REPO.merge({ + "clone_url" => "https://github.com/octocat/Hello-World.git", + "git_url" => "git://github.com/octocat/Hello-World.git", + "ssh_url" => "git@github.com:octocat/Hello-World.git", + "svn_url" => "https://svn.github.com/octocat/Hello-World", + "mirror_url" => "git://git.example.com/octocat/Hello-World", + "homepage" => "https://github.com", + "language" => nil, + "forks_count" => 9, + "stargazers_count" => 80, + "watchers_count" => 80, + "size" => 108, + "default_branch" => 'master', + "open_issues_count" => 0, + "has_issues" => true, + "has_wiki" => true, + "has_pages" => false, + "has_downloads" => true, + "pushed_at" => "2011-01-26T19:06:43Z", + "created_at" => "2011-01-26T19:01:12Z", + "updated_at" => "2011-01-26T19:14:43Z", + "permissions" => REPO_PERMISSIONS + }) + + FULL_REPO ||= REPO.merge({ + "subscribers_count" => 42, + "organization" => USER.merge('type' => 'Organization'), + "parent" => REPO, + "source" => REPO + }) + + STARRED_REPO ||= { + "starred_at" => "2011-01-16T19:06:43Z", + "repo" => REPO + } + + TAG ||= { + "name" => "v0.1", + "commit" => { + "sha" => "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc", + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" + }, + "zipball_url" => "https://github.com/octocat/Hello-World/zipball/v0.1", + "tarball_url" => "https://github.com/octocat/Hello-World/tarball/v0.1", + } + + BRANCHES ||= [ + { + "name" => "master", + "commit" => { + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" + } + } + ] + + BRANCH ||= {"name"=>"master", + "commit"=> + {"sha"=>"7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "commit"=> + {"author"=> + {"name"=>"The Octocat", + "date"=>"2012-03-06T15:06:50-08:00", + "email"=>"octocat@nowhere.com"}, + "url"=> + "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "message"=> + "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.", + "tree"=> + {"sha"=>"b4eecafa9be2f2006ce1b709d6857b07069b4608", + "url"=> + "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"}, + "committer"=> + {"name"=>"The Octocat", + "date"=>"2012-03-06T15:06:50-08:00", + "email"=>"octocat@nowhere.com"}}, + "author"=> + {"gravatar_id"=>"", + "avatar_url"=> + "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", + "url"=>"https://api.github.com/users/octocat", + "id"=>583231, + "login"=>"octocat"}, + "parents"=> + [{"sha"=>"553c2077f0edc3d5dc5d17262f6aa498e69d6f8e", + "url"=> + "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"}, + {"sha"=>"762941318ee16e59dabbacb1b4049eec22f0d303", + "url"=> + "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"}], + "url"=> + "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "committer"=> + {"gravatar_id"=>"", + "avatar_url"=> + "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", + "url"=>"https://api.github.com/users/octocat", + "id"=>583231, + "login"=>"octocat"}}, + "_links"=> + {"html"=>"https://github.com/octocat/Hello-World/tree/master", + "self"=>"https://api.github.com/repos/octocat/Hello-World/branches/master"}} + + MERGE_COMMIT ||= { + "sha" => "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "commit" => { + "author" => { + "name" => "The Octocat", + "date" => "2012-03-06T15:06:50-08:00", + "email" => "octocat@nowhere.com" + }, + "committer" => { + "name" => "The Octocat", + "date" => "2012-03-06T15:06:50-08:00", + "email" => "octocat@nowhere.com" + }, + "message" => "Shipped cool_feature!", + "tree" => { + "sha" => "b4eecafa9be2f2006ce1b709d6857b07069b4608", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608" + }, + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "comment_count" => 0 + }, + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "html_url" => "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", + "comments_url" => "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments", + "author" => { + "login" => "octocat", + "id" => 583231, + "avatar_url" => "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/octocat", + "html_url" => "https://github.com/octocat", + "followers_url" => "https://api.github.com/users/octocat/followers", + "following_url" => "https://api.github.com/users/octocat/following", + "gists_url" => "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/octocat/subscriptions", + "organizations_url" => "https://api.github.com/users/octocat/orgs", + "repos_url" => "https://api.github.com/users/octocat/repos", + "events_url" => "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url" => "https://api.github.com/users/octocat/received_events", + "type" => "User" + }, + "committer" => { + "login" => "octocat", + "id" => 583231, + "avatar_url" => "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/octocat", + "html_url" => "https://github.com/octocat", + "followers_url" => "https://api.github.com/users/octocat/followers", + "following_url" => "https://api.github.com/users/octocat/following", + "gists_url" => "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/octocat/subscriptions", + "organizations_url" => "https://api.github.com/users/octocat/orgs", + "repos_url" => "https://api.github.com/users/octocat/repos", + "events_url" => "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url" => "https://api.github.com/users/octocat/received_events", + "type" => "User" + }, + "parents" => [ + { + "sha" => "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e", + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e" + }, + { + "sha" => "762941318ee16e59dabbacb1b4049eec22f0d303", + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303" + } + ] +} + + MILESTONE ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/milestones/1", + "html_url" => "https://github.com/octocat/Hello-World/milestones/v1.0", + "labels_url" => "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels", + "id" => 1002604, + "number" => 1, + "state" => "open", + "title" => "v1.0", + "description" => "Tracking milestone for version 1.0", + "creator" => USER, + "open_issues" => 4, + "closed_issues" => 8, + "created_at" => "2011-04-10T20:09:31Z", + "updated_at" => "2014-03-03T18:58:10Z", + "closed_at" => "2013-02-12T13:22:01Z", + "due_on" => "2012-10-09T23:39:01Z" + } + + + PULL ||= { + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/pulls/1347", + "html_url" => "https://github.com/octocat/Hello-World/pull/1347", + "diff_url" => "https://github.com/octocat/Hello-World/pull/1347.diff", + "patch_url" => "https://github.com/octocat/Hello-World/pull/1347.patch", + "issue_url" => "https://api.github.com/repos/octocat/Hello-World/issues/1347", + "commits_url" => "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits", + "review_comments_url" => "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments", + "review_comment_url" => "https://api.github.com/repos/octocat/Hello-World/pulls/comments/{number}", + "comments_url" => "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments", + "statuses_url" => "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "number" => 1347, + "state" => "open", + "title" => "new-feature", + "body" => "Please pull these awesome changes", + "created_at" => "2011-01-26T19:01:12Z", + "updated_at" => "2011-01-26T19:01:12Z", + "closed_at" => "2011-01-26T19:01:12Z", + "merged_at" => "2011-01-26T19:01:12Z", + "head" => { + "label" => "new-topic", + "ref" => "new-topic", + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "user" => USER, + "repo" => REPO, + }, + "base" => { + "label" => "master", + "ref" => "master", + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "user" => USER, + "repo" => REPO, + }, + "_links" => { + "self" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/1347"}, + "html" => {'href' => + "https://github.com/octocat/Hello-World/pull/1347"}, + "issue" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/issues/1347"}, + "comments" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"}, + "review_comments" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"}, + "review_comment" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/comments/{number}"}, + "commits" => { 'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"}, + "statuses" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"} + }, + "user" => USER + } + + FULL_PULL ||= PULL.merge({ + "merge_commit_sha" => "e5bd3914e2e596debea16f433f57875b5b90bcd6", + "merged" => false, + "mergeable" => true, + "merged_by" => USER, + "comments" => 10, + "commits" => 3, + "additions" => 100, + "deletions" => 3, + "changed_files" => 5 + }) + + COMMIT ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "html_url" => "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "comments_url" => "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments", + "commit" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "author" => { + "name" => "Monalisa Octocat", + "email" => "support@github.com", + "date" => "2011-04-14T16:00:49Z", + }, + "committer" => { + "name" => "Monalisa Octocat", + "email" => "support@github.com", + "date" => "2011-04-14T16:00:49Z", + }, + "message" => "Fix all the bugs", + "tree" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + }, + "comment_count" => 0, + }, + "author" => USER, + "committer" => USER, + "parents" => [{ + "url" => "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e", + "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + }] + } + + FULL_COMMIT ||= COMMIT.merge({ + "stats" => { + "additions" => 104, + "deletions" => 4, + "total" => 108, + }, + "files" => [{ + "filename" => "file1.txt", + "additions" => 10, + "deletions" => 2, + "changes" => 12, + "status" => "modified", + "raw_url" => "https://github.com/octocat/Hello-World/raw/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt", + "blob_url" => "https://github.com/octocat/Hello-World/blob/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt", + "patch" => "@@ -29,7 +29,7 @@\n....." + }] + }) + + COMMIT_COMMENT ||= { + "html_url" => "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1", + "url" => "https://api.github.com/repos/octocat/Hello-World/comments/1", + "id" => 1, + "body" => "Great stuff", + "path" => "file1.txt", + "position" => 4, + "line" => 14, + "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "user" => USER, + "created_at" => "2011-04-14T16:00:49Z", + "updated_at" => "2011-04-14T16:00:49Z" + } + + FILE ||= { + "sha" => "bbcd538c8e72b8c175046e27cc8f907076331401", + "filename" => "file1.txt", + "status" => "added", + "additions" => 103, + "deletions" => 21, + "changes" => 124, + "blob_url" => "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", + "raw_url" => "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt", + "contents_url" => "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e", + "patch" => "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" + } + + COMMIT_COMPARISON ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/compare/master...topic", + "html_url" => "https://github.com/octocat/Hello-World/compare/master...topic", + "permalink_url" => "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17", + "diff_url" => "https://github.com/octocat/Hello-World/compare/master...topic.diff", + "patch_url" => "https://github.com/octocat/Hello-World/compare/master...topic.patch", + "base_commit" => COMMIT, + "merge_base_commit" => COMMIT, + "status" => "behind", + "ahead_by" => 1, + "behind_by" => 2, + "total_commits" => 1, + "commits" => [COMMIT], + "files" => [FILE], + } + + PULL_COMMENT ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1", + "id" => 1, + "diff_hunk" => "@@ -16,33 +16,40 @@ public class Connection : IConnection...", + "path" => "file1.txt", + "position" => 1, + "original_position" => 4, + "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "original_commit_id" => "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840", + "user" => USER, + "body" => "Great stuff", + "created_at" => "2011-04-14T16:00:49Z", + "updated_at" => "2011-04-14T16:00:49Z", + "html_url" => "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1", + "pull_request_url" => "https://api.github.com/repos/octocat/Hello-World/pulls/1", + "_links" => { + "self" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"}, + "html" => {'href' => + "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"}, + "pull_request" => {'href' => + "https://api.github.com/repos/octocat/Hello-World/pulls/1"} + } + } + + RELEASE_ASSET ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/releases/assets/1", + "browser_download_url" => "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip", + "id" => 1, + "name" => "example.zip", + "label" => "short description", + "state" => "uploaded", + "content_type" => "application/zip", + "size" => 1024, + "download_count" => 42, + "created_at" => "2013-02-27T19:35:32Z", + "updated_at" => "2013-02-27T19:35:32Z", + "uploader" => USER + } + + RELEASE ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/releases/1", + "html_url" => "https://github.com/octocat/Hello-World/releases/v1.0.0", + "assets_url" => "https://api.github.com/repos/octocat/Hello-World/releases/1/assets", + "upload_url" => "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}", + "tarball_url" => "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0", + "zipball_url" => "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0", + "id" => 1, + "tag_name" => "v1.0.0", + "target_commitish" => "master", + "name" => "v1.0.0", + "body" => "Description of the release", + "draft" => false, + "prerelease" => false, + "created_at" => "2013-02-27T19:35:32Z", + "published_at" => "2013-02-27T19:35:32Z", + "author" => USER, + "assets" => [RELEASE_ASSET] + } + + CREATED_RELEASE ||= RELEASE.merge({ + "assets" => [] + }) + + DOWNLOAD ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/downloads/1", + "html_url" => "https://github.com/repos/octocat/Hello-World/downloads/new_file.jpg", + "id" => 1, + "name" => "new_file.jpg", + "description" => "Description of your download", + "size" => 1024, + "download_count" => 40, + "content_type" => ".jpg" + } + + CREATE_DOWNLOAD ||= DOWNLOAD.merge({ + "policy" => "ewogICAg...", + "signature" => "mwnFDC...", + "bucket" => "github", + "accesskeyid" => "1ABCDEFG...", + "path" => "downloads/octocat/Hello-World/new_file.jpg", + "acl" => "public-read", + "expirationdate" => "2011-04-14T16:00:49Z", + "prefix" => "downloads/octocat/Hello-World/", + "mime_type" => "image/jpeg", + "redirect" => false, + "s3_url" => "https://github.s3.amazonaws.com/" + }) + + PAGES ||= { + "url" => "https://api.github.com/repos/github/developer.github.com/pages", + "status" => "built", + "cname" => "developer.github.com", + "custom_404" => false + } + + PAGES_BUILD ||= { + "url" => "https://api.github.com/repos/github/developer.github.com/pages/builds/5472601", + "status" => "built", + "error" => { + "message" => nil + }, + "pusher" => USER, + "commit" => "351391cdcb88ffae71ec3028c91f375a8036a26b", + "duration" => 2104, + "created_at" => "2014-02-10T19:00:49Z", + "updated_at" => "2014-02-10T19:00:51Z" + } + + ORG ||= { + "login" => "github", + "id" => 1, + "url" => "https://api.github.com/orgs/github", + "avatar_url" => "https://github.com/images/error/octocat_happy.gif", + "description" => "A great organization" + } + + FULL_ORG ||= ORG.merge({ + "name" => "github", + "company" => "GitHub", + "blog" => "https://github.com/blog", + "location" => "San Francisco", + "email" => "octocat@github.com", + "public_repos" => 2, + "public_gists" => 1, + "followers" => 20, + "following" => 0, + "html_url" => "https://github.com/octocat", + "created_at" => "2008-01-14T04:33:35Z", + "type" => "Organization" + }) + + PRIVATE_ORG ||= FULL_ORG.merge({ + "total_private_repos" => 100, + "owned_private_repos" => 100, + "private_gists" => 81, + "disk_usage" => 10000, + "collaborators" => 8, + "billing_email" => "support@github.com", + "plan" => { + "name" => "Medium", + "space" => 400, + "private_repos" => 20 + } + }) + + TEAM ||= { + "id" => 1, + "url" => "https://api.github.com/teams/1", + "name" => "Justice League", + "slug" => "justice-league", + "description" => "A great team.", + "permission" => "admin", + "members_url" => "https://api.github.com/teams/1/members{/member}", + "repositories_url" => "https://api.github.com/teams/1/repos" + } + + FULL_TEAM ||= TEAM.merge({ + "members_count" => 3, + "repos_count" => 10, + "organization" => ORG + }) + + TEAM_MEMBERSHIP ||= { + "url" => "https://api.github.com/teams/1/memberships/octocat" + } + + ACTIVE_TEAM_MEMBERSHIP ||= TEAM_MEMBERSHIP.merge( + "state" => "active" + ) + + PENDING_TEAM_MEMBERSHIP ||= TEAM_MEMBERSHIP.merge( + "state" => "pending" + ) + + USER_FOR_ORG_MEMBERSHIP ||= { + "login" => "defunkt", + "id" => 3, + "avatar_url" => "https://github.com/images/error/octocat_happy.gif", + "gravatar_id" => "", + "url" => "https://api.github.com/users/defunkt", + "html_url" => "https://github.com/defunkt", + "followers_url" => "https://api.github.com/users/defunkt/followers", + "following_url" => "https://api.github.com/users/defunkt/following{/other_user}", + "gists_url" => "https://api.github.com/users/defunkt/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/defunkt/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/defunkt/subscriptions", + "organizations_url" => "https://api.github.com/users/defunkt/orgs", + "repos_url" => "https://api.github.com/users/defunkt/repos", + "events_url" => "https://api.github.com/users/defunkt/events{/privacy}", + "received_events_url" => "https://api.github.com/users/defunkt/received_events", + "type" => "User", + "site_admin" => false + } + + ORG_FOR_ACTIVE_ORG_MEMBERSHIP ||= { + "login" => "octocat", + "url" => "https://api.github.com/orgs/octocat", + "id" => 1, + "repos_url" => "https://api.github.com/users/octocat/repos", + "events_url" => "https://api.github.com/users/octocat/events{/privacy}", + "members_url" => "https://api.github.com/users/octocat/members{/member}", + "public_members_url" => "https://api.github/com/users/octocat/public_members{/member}", + "avatar_url" => "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" + } + + ORG_FOR_PENDING_ORG_MEMBERSHIP ||= { + "login" => "invitocat", + "url" => "https://api.github.com/orgs/invitocat", + "id" => 2, + "repos_url" => "https://api.github.com/users/invitocat/repos", + "events_url" => "https://api.github.com/users/invitocat/events{/privacy}", + "members_url" => "https://api.github.com/users/invitocat/members{/member}", + "public_members_url" => "https://api.github/com/users/invitocat/public_members{/member}", + "avatar_url" => "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png" + } + + ACTIVE_ADMIN_ORG_MEMBERSHIP ||= { + "url" => "https://api.github.com/orgs/octocat/memberships/defunkt", + "state" => "active", + "role" => "admin", + "organization_url" => "https://api.github.com/orgs/octocat", + "organization" => ORG_FOR_ACTIVE_ORG_MEMBERSHIP, + "user" => USER_FOR_ORG_MEMBERSHIP + } + + ACTIVE_LIMITED_ORG_MEMBERSHIP ||= { + "url" => "https://api.github.com/orgs/octocat/memberships/defunkt", + "state" => "active", + "role" => "limited_member", + "organization_url" => "https://api.github.com/orgs/octocat", + "organization" => ORG_FOR_ACTIVE_ORG_MEMBERSHIP, + "user" => USER_FOR_ORG_MEMBERSHIP + } + + PENDING_ADMIN_ORG_MEMBERSHIP ||= { + "url" => "https://api.github.com/orgs/invitocat/memberships/defunkt", + "state" => "pending", + "role" => "admin", + "organization_url" => "https://api.github.com/orgs/invitocat", + "organization" => ORG_FOR_PENDING_ORG_MEMBERSHIP, + "user" => USER_FOR_ORG_MEMBERSHIP + } + + PENDING_LIMITED_ORG_MEMBERSHIP ||= { + "url" => "https://api.github.com/orgs/invitocat/memberships/defunkt", + "state" => "pending", + "role" => "limited_member", + "organization_url" => "https://api.github.com/orgs/invitocat", + "organization" => ORG_FOR_PENDING_ORG_MEMBERSHIP, + "user" => USER_FOR_ORG_MEMBERSHIP + } + + ORG_MEMBERSHIPS ||= [ACTIVE_ADMIN_ORG_MEMBERSHIP, PENDING_ADMIN_ORG_MEMBERSHIP] + ACTIVE_ORG_MEMBERSHIPS ||= [ACTIVE_ADMIN_ORG_MEMBERSHIP] + PENDING_ORG_MEMBERSHIPS ||= [PENDING_ADMIN_ORG_MEMBERSHIP] + + LABEL ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/labels/bug", + "name" => "bug", + "color" => "f29513" + } + + ISSUE ||= { + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/issues/1347", + "html_url" => "https://github.com/octocat/Hello-World/issues/1347", + "number" => 1347, + "state" => "open", + "title" => "Found a bug", + "body" => "I'm having a problem with this.", + "user" => USER, + "labels" => [LABEL], + "assignee" => USER, + "milestone" => MILESTONE, + "comments" => 0, + "pull_request" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/pulls/1347", + "html_url" => "https://github.com/octocat/Hello-World/pull/1347", + "diff_url" => "https://github.com/octocat/Hello-World/pull/1347.diff", + "patch_url" => "https://github.com/octocat/Hello-World/pull/1347.patch" + }, + "closed_at" => nil, + "created_at" => "2011-04-22T13:33:48Z", + "updated_at" => "2011-04-22T13:33:48Z" + } + + FULL_ISSUE ||= ISSUE.merge({ + "closed_by" => USER + }) + + ISSUE_COMMENT ||= { + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/issues/comments/1", + "html_url" => "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1", + "body" => "Me too", + "user" => USER, + "created_at" => "2011-04-14T16:00:49Z", + "updated_at" => "2011-04-14T16:00:49Z" + } + + ISSUE_EVENT ||= { + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/issues/events/1", + "actor" => USER, + "event" => "closed", + "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", + "created_at" => "2011-04-14T16:00:49Z" + } + + FULL_ISSUE_EVENT ||= ISSUE_EVENT.merge('issue' => ISSUE) + + ISSUE_SEARCH_ITEM ||= { + "gravatar_id" => "", + "position" => 10, + "number" => 10, + "votes" => 2, + "created_at" => "2010-06-04T23:20:33Z", + "comments" => 5, + "body" => "Issue body goes here", + "title" => "This is is the issue title", + "updated_at" => "2010-06-04T23:20:33Z", + "html_url" => "https://github.com/pengwynn/linkedin/issues/10", + "user" => "ckarbass", + "labels" => [ + "api", + "feature request", + "investigation" + ], + "state" => "open" + } + + ISSUE_SEARCH_RESULTS ||= { + "issues" => [ISSUE_SEARCH_ITEM] + } + + ISSUE_SEARCH_V3_RESULTS ||= { + "total_count" => 280, + "incomplete_results" => false, + "items" => [ + { + "url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132", + "labels_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}", + "comments_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments", + "events_url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events", + "html_url" => "https://github.com/batterseapower/pinyin-toolkit/issues/132", + "id" => 35802, + "number" => 132, + "title" => "Line Number Indexes Beyond 20 Not Displayed", + "user" => { + "login" => "Nick3C", + "id" => 90254, + "avatar_url" => "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/Nick3C", + "html_url" => "https://github.com/Nick3C", + "followers_url" => "https://api.github.com/users/Nick3C/followers", + "following_url" => "https://api.github.com/users/Nick3C/following{/other_user}", + "gists_url" => "https://api.github.com/users/Nick3C/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/Nick3C/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/Nick3C/subscriptions", + "organizations_url" => "https://api.github.com/users/Nick3C/orgs", + "repos_url" => "https://api.github.com/users/Nick3C/repos", + "events_url" => "https://api.github.com/users/Nick3C/events{/privacy}", + "received_events_url" => "https://api.github.com/users/Nick3C/received_events", + "type" => "User" + }, + "labels" => [ + { + "url" => "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug", + "name" => "bug", + "color" => "ff0000" + } + ], + "state" => "open", + "assignee" => nil, + "milestone" => nil, + "comments" => 15, + "created_at" => "2009-07-12T20:10:41Z", + "updated_at" => "2009-07-19T09:23:43Z", + "closed_at" => nil, + "pull_request" => { + "html_url" => nil, + "diff_url" => nil, + "patch_url" => nil + }, + "body" => "...", + "score" => 1.3859273 + } + ] + } + + ISSUE_SEARCH_V3_RESULTS_HIGHLIGHTING ||= { + "text_matches" => [ + { + "object_url" => "https://api.github.com/repositories/215335/issues/132", + "object_type" => "Issue", + "property" => "body", + "fragment" => "comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n", + "matches" => [ + { + "text" => "windows", + "indices" => [ + 14, + 21 + ] + }, + { + "text" => "windows", + "indices" => [ + 78, + 85 + ] + } + ] + }, + { + "object_url" => "https://api.github.com/repositories/215335/issues/comments/25688", + "object_type" => "IssueComment", + "property" => "body", + "fragment" => " right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n", + "matches" => [ + { + "text" => "Windows", + "indices" => [ + 163, + 170 + ] + } + ] + } + ] + } + + REPO_SEARCH_ITEM ||= { + "type" => "repo", + "created" => "2011-09-05T11:07:54Z", + "watchers" => 2913, + "has_downloads" => true, + "username" => "mathiasbynens", + "homepage" => "http://mths.be/dotfiles", + "url" => "https://github.com/mathiasbynens/dotfiles", + "fork" => false, + "has_issues" => true, + "has_wiki" => false, + "forks" => 520, + "size" => 192, + "private" => false, + "followers" => 2913, + "name" => "dotfiles", + "owner" => "mathiasbynens", + "open_issues" => 12, + "pushed_at" => "2012-06-05T03:37:13Z", + "score" => 3.289718, + "pushed" => "2012-06-05T03:37:13Z", + "description" => "sensible hacker defaults for OS X", + "language" => "VimL", + "created_at" => "2011-09-05T11:07:54Z" + } + + REPO_SEARCH_RESULTS ||= { + "repositories" => [REPO_SEARCH_ITEM] + } + + REPO_SEARCH_V3_RESULTS ||= { + "total_count" => 40, + "incomplete_results" => false, + "items" => [ + { + "id" => 3081286, + "name" => "Tetris", + "full_name" => "dtrupenn/Tetris", + "owner" => { + "login" => "dtrupenn", + "id" => 872147, + "avatar_url" => "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/dtrupenn", + "received_events_url" => "https://api.github.com/users/dtrupenn/received_events", + "type" => "User" + }, + "private" => false, + "html_url" => "https://github.com/dtrupenn/Tetris", + "description" => "A C implementation of Tetris using Pennsim through LC4", + "fork" => false, + "url" => "https://api.github.com/repos/dtrupenn/Tetris", + "created_at" => "2012-01-01T00:31:50Z", + "updated_at" => "2013-01-05T17:58:47Z", + "pushed_at" => "2012-01-01T00:37:02Z", + "homepage" => "", + "size" => 524, + "stargazers_count" => 1, + "watchers_count" => 1, + "language" => "Assembly", + "forks_count" => 0, + "open_issues_count" => 0, + "master_branch" => "master", + "default_branch" => "master", + "score" => 10.309712 + } + ] + } + + REPO_SEARCH_V3_RESULTS_HIGHLIGHTING ||= { + "text_matches" => [ + { + "object_url" => "https://api.github.com/repositories/3081286", + "object_type" => "Repository", + "property" => "name", + "fragment" => "Tetris", + "matches" => [ + { + "text" => "Tetris", + "indices" => [ + 0, + 6 + ] + } + ] + }, + { + "object_url" => "https://api.github.com/repositories/3081286", + "object_type" => "Repository", + "property" => "description", + "fragment" => "A C implementation of Tetris using Pennsim through LC4", + "matches" => [ + { + "text" => "Tetris", + "indices" => [ + 22, + 28 + ] + } + ] + } + ] + } + + CODE_SEARCH_V3_RESULTS ||= { + "total_count" => 7, + "incomplete_results" => false, + "items" => [ + { + "name" => "classes.js", + "path" => "src/attributes/classes.js", + "sha" => "d7212f9dee2dcc18f084d7df8f417b80846ded5a", + "url" => "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4", + "git_url" => "https://api.github.com/repositories/167174/git/blobs/d7212f9dee2dcc18f084d7df8f417b80846ded5a", + "html_url" => "https://github.com/jquery/jquery/blob/825ac3773694e0cd23ee74895fd5aeb535b27da4/src/attributes/classes.js", + "repository" => { + "id" => 167174, + "name" => "jquery", + "full_name" => "jquery/jquery", + "owner" => { + "login" => "jquery", + "id" => 70142, + "avatar_url" => "https://0.gravatar.com/avatar/6906f317a4733f4379b06c32229ef02f?d=https%3A%2F%2Fidenticons.github.com%2Ff426f04f2f9813718fb806b30e0093de.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/jquery", + "html_url" => "https://github.com/jquery", + "followers_url" => "https://api.github.com/users/jquery/followers", + "following_url" => "https://api.github.com/users/jquery/following{/other_user}", + "gists_url" => "https://api.github.com/users/jquery/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/jquery/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/jquery/subscriptions", + "organizations_url" => "https://api.github.com/users/jquery/orgs", + "repos_url" => "https://api.github.com/users/jquery/repos", + "events_url" => "https://api.github.com/users/jquery/events{/privacy}", + "received_events_url" => "https://api.github.com/users/jquery/received_events", + "type" => "Organization", + "site_admin" => false + }, + "private" => false, + "html_url" => "https://github.com/jquery/jquery", + "description" => "jQuery JavaScript Library", + "fork" => false, + "url" => "https://api.github.com/repos/jquery/jquery", + "forks_url" => "https://api.github.com/repos/jquery/jquery/forks", + "keys_url" => "https://api.github.com/repos/jquery/jquery/keys{/key_id}", + "collaborators_url" => "https://api.github.com/repos/jquery/jquery/collaborators{/collaborator}", + "teams_url" => "https://api.github.com/repos/jquery/jquery/teams", + "hooks_url" => "https://api.github.com/repos/jquery/jquery/hooks", + "issue_events_url" => "https://api.github.com/repos/jquery/jquery/issues/events{/number}", + "events_url" => "https://api.github.com/repos/jquery/jquery/events", + "assignees_url" => "https://api.github.com/repos/jquery/jquery/assignees{/user}", + "branches_url" => "https://api.github.com/repos/jquery/jquery/branches{/branch}", + "tags_url" => "https://api.github.com/repos/jquery/jquery/tags", + "blobs_url" => "https://api.github.com/repos/jquery/jquery/git/blobs{/sha}", + "git_tags_url" => "https://api.github.com/repos/jquery/jquery/git/tags{/sha}", + "git_refs_url" => "https://api.github.com/repos/jquery/jquery/git/refs{/sha}", + "trees_url" => "https://api.github.com/repos/jquery/jquery/git/trees{/sha}", + "statuses_url" => "https://api.github.com/repos/jquery/jquery/statuses/{sha}", + "languages_url" => "https://api.github.com/repos/jquery/jquery/languages", + "stargazers_url" => "https://api.github.com/repos/jquery/jquery/stargazers", + "contributors_url" => "https://api.github.com/repos/jquery/jquery/contributors", + "subscribers_url" => "https://api.github.com/repos/jquery/jquery/subscribers", + "subscription_url" => "https://api.github.com/repos/jquery/jquery/subscription", + "commits_url" => "https://api.github.com/repos/jquery/jquery/commits{/sha}", + "git_commits_url" => "https://api.github.com/repos/jquery/jquery/git/commits{/sha}", + "comments_url" => "https://api.github.com/repos/jquery/jquery/comments{/number}", + "issue_comment_url" => "https://api.github.com/repos/jquery/jquery/issues/comments/{number}", + "contents_url" => "https://api.github.com/repos/jquery/jquery/contents/{+path}", + "compare_url" => "https://api.github.com/repos/jquery/jquery/compare/{base}...{head}", + "merges_url" => "https://api.github.com/repos/jquery/jquery/merges", + "archive_url" => "https://api.github.com/repos/jquery/jquery/{archive_format}{/ref}", + "downloads_url" => "https://api.github.com/repos/jquery/jquery/downloads", + "issues_url" => "https://api.github.com/repos/jquery/jquery/issues{/number}", + "pulls_url" => "https://api.github.com/repos/jquery/jquery/pulls{/number}", + "milestones_url" => "https://api.github.com/repos/jquery/jquery/milestones{/number}", + "notifications_url" => "https://api.github.com/repos/jquery/jquery/notifications{?since,all,participating}", + "labels_url" => "https://api.github.com/repos/jquery/jquery/labels{/name}" + }, + "score" => 0.5269679, + } + ] + } + + CODE_SEARCH_V3_RESULTS_HIGHLIGHTING ||= { + "text_matches" => [ + { + "object_url" => "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4", + "object_type" => "FileContent", + "property" => "content", + "fragment" => ";\n\njQuery.fn.extend({\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, clazz, j, finalValue", + "matches" => [ + { + "text" => "addClass", + "indices" => [ + 23, + 31 + ] + } + ] + }, + { + "object_url" => "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4", + "object_type" => "FileContent", + "property" => "content", + "fragment" => ".isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this", + "matches" => [ + { + "text" => "addClass", + "indices" => [ + 80, + 88 + ] + } + ] + } + ] + } + + USER_SEARCH_ITEM ||= { + "gravatar_id" => "", + "name" => "Hirotaka Kawata", + "created_at" => "2009-10-05T01:32:06Z", + "location" => "Tsukuba, Ibaraki, Japan", + "public_repo_count" => 8, + "followers" => 10, + "language" => "Python", + "fullname" => "Hirotaka Kawata", + "username" => "techno", + "id" => "user-135050", + "repos" => 8, + "type" => "user", + "followers_count" => 10, + "login" => "techno", + "score" => 4.2559967, + "created" => "2009-10-05T01:32:06Z" + } + + USER_SEARCH_RESULTS ||= { + "users" => [USER_SEARCH_ITEM] + } + + USER_SEARCH_V3_RESULTS ||= { + "total_count" => 12, + "incomplete_results" => false, + "items" => [ + { + "login" => "mojombo", + "id" => 1, + "avatar_url" => "https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png", + "gravatar_id" => "", + "url" => "https://api.github.com/users/mojombo", + "html_url" => "https://github.com/mojombo", + "followers_url" => "https://api.github.com/users/mojombo/followers", + "subscriptions_url" => "https://api.github.com/users/mojombo/subscriptions", + "organizations_url" => "https://api.github.com/users/mojombo/orgs", + "repos_url" => "https://api.github.com/users/mojombo/repos", + "received_events_url" => "https://api.github.com/users/mojombo/received_events", + "type" => "User", + "score" => 105.47857 + } + ] + } + + + USER_SEARCH_V3_RESULTS_HIGHLIGHTING ||= { + "text_matches" => [ + { + "object_url" => "https://api.github.com/users/mojombo", + "object_type" => "User", + "property" => "email", + "fragment" => "tom@github.com", + "matches" => [ + { + "text" => "tom", + "indices" => [ + 0, + 3 + ] + } + ] + }, + { + "object_url" => "https://api.github.com/users/mojombo", + "object_type" => "User", + "property" => "name", + "fragment" => "Tom Preston-Werner", + "matches" => [ + { + "text" => "Tom", + "indices" => [ + 0, + 3 + ] + } + ] + } + ] + } + + EMAIL_SEARCH_RESULTS ||= { + "user" => { + "public_repo_count" => 2, + "public_gist_count" => 1, + "followers_count" => 20, + "following_count" => 0, + "created" => "2009-10-05T01:32:06Z", + "created_at" => "2009-10-05T01:32:06Z", + "name" => "monalisa octocat", + "company" => "GitHub", + "blog" => "https://github.com/blog", + "location" => "San Francisco", + "email" => "octocat@github.com", + "id" => 2, + "login" => "octocat", + "type" => "User", + "gravatar_id" => "", + } + } + + GIST_HISTORY ||= [ + { + "url" => "https://api.github.com/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f", + "version" => "57a7f021a713b1c5a6a199b54cc514735d2d462f", + "user" => USER, + "change_status" => { + "deletions" => 0, + "additions" => 180, + "total" => 180 + }, + "committed_at" => "2010-04-14T02:15:15Z" + } + ] + + + GIST_FORKS ||= [ + { + "user" => USER, + "url" => "https://api.github.com/gists/dee9c42e4998ce2ea439", + "id" => "dee9c42e4998ce2ea439", + "created_at" => "2011-04-14T16:00:49Z", + "updated_at" => "2011-04-14T16:00:49Z" + } + ] + + GIST_FILE ||= { + "ring.erl" => { + "size" => 932, + "raw_url" => "https://gist.githubusercontent.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", + "type" => "text/plain", + "truncated" => false, + "language" => "Erlang" + } + } + + GIST_FILE_WITH_CONTENT ||= { + "ring.erl" => { + "size" => 932, + "raw_url" => "https://gist.githubusercontent.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl", + "type" => "text/plain", + "language" => "Erlang", + "truncated" => false, + "content" => "contents of gist" + } + } + + GIST ||= { + "url" => "https://api.github.com/gists/aa5a315d61ae9438b18d", + "forks_url" => "https://api.github.com/gists/aa5a315d61ae9438b18d/forks", + "commits_url" => "https://api.github.com/gists/aa5a315d61ae9438b18d/commits", + "id" => "aa5a315d61ae9438b18d", + "description" => "description of gist", + "public" => true, + "owner" => USER, + "user" => nil, + "files" => GIST_FILE, + "comments" => 0, + "comments_url" => "https://api.github.com/gists/aa5a315d61ae9438b18d/comments/", + "html_url" => "https://gist.github.com/aa5a315d61ae9438b18d", + "git_pull_url" => "https://gist.github.com/aa5a315d61ae9438b18d.git", + "git_push_url" => "https://gist.github.com/aa5a315d61ae9438b18d.git", + "created_at" => "2010-04-14T02:15:15Z", + "updated_at" => "2011-06-20T11:34:15Z" + } + + FULL_GIST ||= GIST.dup.update \ + "forks" => GIST_FORKS, + "history" => GIST_HISTORY, + "files" => GIST_FILE_WITH_CONTENT + + FULL_GIST_VERSION ||= FULL_GIST.dup.update \ + "url" => "https://api.github.com/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f" + + GIST_COMMENT ||= { + "id" => 1, + "url" => "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1", + "body" => "Just commenting for the sake of commenting", + "user" => USER, + "created_at" => "2011-04-18T23:23:56Z", + "updated_at" => "2011-04-18T23:23:56Z" + } + + TREE ||= { + "sha" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", + "url" => "https://api.github.com/repos/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312", + "tree" => [ + { "path" => "file.rb", + "mode" => "100644", + "type" => "blob", + "size" => 30, + "sha" => "44b4fc6d56897b048c772eb4087f854f46256132", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132", + }, + { "path" => "subdir", + "mode" => "040000", + "type" => "tree", + "sha" => "f484d249c660418515fb01c2b9662073663c242e", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e" + }, + { "path" => "exec_file", + "mode" => "100755", + "type" => "blob", + "size" => 75, + "sha" => "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057", + } + ], + "truncated" => false + } + TREE_EXTRA ||= { + "sha" => "fc6274d15fa3ae2ab983129fb037999f264ba9a7", + "url" => "https://api.github.com/repos/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7", + "tree" => [ { + "path" => "subdir/file.txt", + "mode" => "100644", + "type" => "blob", + "size" => 132, + "sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" + } ], + "truncated" => false + } + TREE_NEW ||= { + "sha" => "cd8274d15fa3ae2ab983129fb037999f264ba9a7", + "url" => "https://api.github.com/repos/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7", + "tree" => [ { + "path" => "file.rb", + "mode" => "100644", + "type" => "blob", + "size" => 132, + "sha" => "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b" + } ] + } + + GIT_COMMIT ||= { + "sha" => "7638417db6d59f3c431d3e1f261cc637155684cd", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", + "author" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "committer" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "message" => "added readme, because im a good github citizen\n", + "tree" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb", + "sha" => "691272480426f78a0138979dd3ce63b77f706feb" + }, + "parents" => [ + { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5", + "sha" => "1acc419d4d6a9ce985db7be48c6349a0475975b5" + } + ] + } + + NEW_COMMIT ||= { + "sha" => "7638417db6d59f3c431d3e1f261cc637155684cd", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", + "author" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "committer" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "message" => "my commit message", + "tree" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132", + "sha" => "827efc6d56897b048c772eb4087f854f46256132" + }, + "parents" => [ + { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0", + "sha" => "7d1b31e74ee336d15cbd21741bc88a537ed063a0" + } + ] + } + + GITTAG ||= { + "tag" => "v0.0.1", + "sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac", + "message" => "initial version\n", + "tagger" => { + "name" => "Scott Chacon", + "email" => "schacon@gmail.com", + "date" => "2014-11-07T22:01:45Z" + }, + "object" => { + "type" => "commit", + "sha" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c" + } + } + + REF ||= { + "ref" => "refs/heads/featureA", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA", + "object" => { + "type" => "commit", + "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" + } + } + + REFS ||= [ + { + "ref" => "refs/heads/master", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/master", + "object" => { + "type" => "commit", + "sha" => "aa218f56b14c9653891f9e74264a383fa43fefbd", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd" + } + }, + { + "ref" => "refs/heads/gh-pages", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/gh-pages", + "object" => { + "type" => "commit", + "sha" => "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac" + } + }, + { + "ref" => "refs/tags/v0.0.1", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.0.1", + "object" => { + "type" => "tag", + "sha" => "940bd336248efae0f9ee5bc7b2d5c985887b16ac", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" + } + } + ] + + HOOK ||= { + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/hooks/1", + "test_url" => "https://api.github.com/repos/octocat/Hello-World/hooks/1/test", + "ping_url" => "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings", + "name" => "web", + "events" => ["push", "pull_request"], + "active" => true, + "config" => + {'url' => 'http://example.com/webhook', 'content_type' => 'json'}, + "updated_at" => "2011-09-06T20:39:23Z", + "created_at" => "2011-09-06T17:26:27Z", + } + + ORG_HOOK ||= { + "id" => 1, + "url" => "https://api.github.com/orgs/octocat/hooks/1", + "ping_url" => "https://api.github.com/orgs/octocat/hooks/1/pings", + "name" => "web", + "events" => ["push", "pull_request"], + "active" => true, + "config" => + {'url' => 'http://example.com', 'content_type' => 'json'}, + "updated_at" => "2011-09-06T20:39:23Z", + "created_at" => "2011-09-06T17:26:27Z", + } + + OAUTH_ACCESS ||= { + "id" => 1, + "url" => "https://api.github.com/authorizations/1", + "scopes" => ["public_repo"], + "token" => "abcdefgh12345678", + "token_last_eight" => "12345678", + "hashed_token" => "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8", + "app" => { + "url" => "http://my-github-app.com", + "name" => "my github app", + "client_id" => "abcde12345fghij67890" + }, + "note" => "optional note", + "note_url" => "http://optional/note/url", + "updated_at" => "2011-09-06T20:39:23Z", + "created_at" => "2011-09-06T17:26:27Z", + "fingerprint" => "jklmnop12345678", + } + + OAUTH_ACCESS_WITH_USER ||= OAUTH_ACCESS.merge(:user => USER) + + EVENT ||= { + :type => "Event", + :public => true, + :payload => {}, + :repo => { + :id => 3, + :name => "octocat/Hello-World", + :url => "https://api.github.com/repos/octocat/Hello-World" + }, + :actor => { + :id => 1, + :login => "octocat", + :gravatar_id => "", + :avatar_url => "https://github.com/images/error/octocat_happy.gif", + :url => "https://api.github.com/users/octocat" + }, + :org => { + :id => 1, + :login => "github", + :gravatar_id => "", + :url => "https://api.github.com/orgs/github", + :avatar_url => "https://github.com/images/error/octocat_happy.gif" + }, + :created_at => "2011-09-06T17:26:27Z", + :id => "12345" + } + + README_CONTENT ||= { + "type" => "file", + "encoding" => "base64", + "size" => 5362, + "name" => "README.md", + "path" => "README.md", + "content" => "encoded content ...", + "sha" => "3d21ec53a331a6f037a91c368710b99387d012c1", + "url" => "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", + "git_url" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", + "html_url" => "https://github.com/octokit/octokit.rb/blob/master/README.md", + "download_url" => "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md", + "_links" => { + "git" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", + "self" => "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", + "html" => "https://github.com/octokit/octokit.rb/blob/master/README.md" + }, + } + + SYMLINK_CONTENT ||= { + "type" => "symlink", + "target" => "/path/to/symlink/target", + "size" => 23, + "name" => "some-symlink", + "path" => "bin/some-symlink", + "sha" => "452a98979c88e093d682cab404a3ec82babebb48", + "url" => "https://api.github.com/repos/octokit/octokit.rb/contents/bin/some-symlink", + "git_url" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/452a98979c88e093d682cab404a3ec82babebb48", + "html_url" => "https://github.com/octokit/octokit.rb/blob/master/bin/some-symlink", + "download_url" => "https://raw.githubusercontent.com/octokit/octokit.rb/master/bin/some-symlink", + "_links" => { + "git" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/452a98979c88e093d682cab404a3ec82babebb48", + "self" => "https://api.github.com/repos/octokit/octokit.rb/contents/bin/some-symlink", + "html" => "https://github.com/octokit/octokit.rb/blob/master/bin/some-symlink" + }, + } + + SUBMODULE_CONTENT ||= { + "type" => "submodule", + "submodule_git_url" => "git://github.com/jquery/qunit.git", + "size" => 0, + "name" => "qunit", + "path" => "test/qunit", + "sha" => "6ca3721222109997540bd6d9ccd396902e0ad2f9", + "url" => "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master", + "git_url" => "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9", + "html_url" => "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9", + "download_url" => nil, + "_links" => { + "git" => "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9", + "self" => "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master", + "html" => "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9" + } + } + + DIRECTORY_CONTENT ||= [ + { + "type" => "file", + "size" => 625, + "name" => "octokit.rb", + "path" => "lib/octokit.rb", + "sha" => "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b", + "url" => "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb", + "git_url" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b", + "html_url" => "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb", + "download_url" => "https://raw.githubusercontent.com/octokit/octokit.rb/master/lib/octokit.rb", + "_links" => { + "self" => "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit.rb", + "git" => "https://api.github.com/repos/octokit/octokit.rb/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b", + "html" => "https://github.com/octokit/octokit.rb/blob/master/lib/octokit.rb", + }, + }, + { + "type" => "dir", + "size" => 0, + "name" => "octokit", + "path" => "lib/octokit", + "sha" => "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", + "url" => "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit", + "git_url" => "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", + "html_url" => "https://github.com/octokit/octokit.rb/tree/master/lib/octokit", + "download_url" => nil, + "_links" => { + "self" => "https://api.github.com/repos/octokit/octokit.rb/contents/lib/octokit", + "git" => "https://api.github.com/repos/octokit/octokit.rb/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", + "html" => "https://github.com/octokit/octokit.rb/tree/master/lib/octokit" + }, + }, + ] + + DEPLOYMENT ||= { + "url" => "https://api.github.com/repos/octocat/example/deployments/1", + "id" => 1, + "sha" => "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", + "ref" => "master", + "task" => "deploy", + "payload" => {:task => 'deploy:migrate'}, + "environment" => "production", + "description" => "Deploy request from hubot", + "creator" => USER, + "created_at" => "2012-07-20T01:19:13Z", + "updated_at" => "2012-07-20T01:19:13Z", + "statuses_url" => "https://api.github.com/repos/octocat/example/deployments/1/statuses", + "repository_url" => "https://api.github.com/repos/octocat/example" + } + + DEPLOYMENT_STATUS ||= { + "url" => "https://api.github.com/repos/octocat/example/deployments/42/statuses/1", + "id" => 1, + "state" => "success", + "creator" => USER, + "description" => "Deployment finished successfully.", + "target_url" => "https://example.com/deployment/42/output", + "created_at" => "2012-07-20T01:19:13Z", + "updated_at" => "2012-07-20T01:19:13Z", + "deployment_url" => "https://api.github.com/repos/octocat/example/deployments/42", + "repository_url" => "https://api.github.com/repos/octocat/example", + "deployment" => { + "id" => 42, + "ref" => "master", + "sha" => "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d", + "url" => "https://api.github.com/repos/octocat/example/deployments/42", + "task" => "deploy", + "creator" => USER, + "environment" => "production", + "payload" => {:task => 'deploy:migrate'}, + "created_at" => "2012-07-20T01:19:13Z", + "updated_at" => "2012-07-20T01:19:13Z", + "description" => "Deploy request from hubot", + "statuses_url" => "https://api.github.com/repos/octocat/example/deployments/42/statuses" + } + } + + SIMPLE_STATUS ||= { + "created_at" => "2012-07-20T01:19:13Z", + "updated_at" => "2012-07-20T01:19:13Z", + "state" => "success", + "target_url" => "https://ci.example.com/1000/output", + "description" => "Build has completed successfully", + "id" => 1, + "url" => "https://api.github.com/repos/octocat/Hello-World/statuses/1", + "context" => "continuous-integration/jenkins" + } + + OTHER_SIMPLE_STATUS ||= { + "created_at" => "2012-08-20T01:19:13Z", + "updated_at" => "2012-08-20T01:19:13Z", + "state" => "success", + "target_url" => "https://ci.example.com/2000/output", + "description" => "Testing has completed successfully", + "id" => 2, + "url" => "https://api.github.com/repos/octocat/Hello-World/statuses/2", + "context" => "security/brakeman" + } + + STATUS ||= SIMPLE_STATUS.merge( + "creator" => USER + ) + + COMBINED_STATUS ||= { + "state" => "success", + "sha" => COMMIT["sha"], + "total_count" => 2, + "statuses" => [ + SIMPLE_STATUS, + OTHER_SIMPLE_STATUS + ], + "repository" => SIMPLE_REPO, + "commit_url" => "https://api.github.com/repos/octocat/Hello-World/#{COMMIT["sha"]}", + "url" => "https://api.github.com/repos/octocat/Hello-World/#{COMMIT["sha"]}/status" + } + + META ||= { + :hooks => ['127.0.0.1/32'], + :git => ['127.0.0.1/32'], + :verifiable_password_authentication => true, + :github_services_sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" + } + + BLOB ||= { + :content => "Content of the blob", + :encoding => "utf-8", + :url => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", + :sha => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", + :size => 100 + } + + BLOB_AFTER_CREATE ||= { + 'url' => "https://api.github.com/repos/octocat/example/git/blobs/3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15", + 'sha' => "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15" + } + + CONTENT_CRUD ||= { + "content" => { + "name" => "hello.txt", + "path" => "notes/hello.txt", + "sha" => "95b966ae1c166bd92f8ae7d1c313e738c731dfc3", + "size" => 9, + "url" => "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt", + "html_url" => "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt", + "git_url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3", + "download_url" => "https://raw.githubusercontent.com/octocat/HelloWorld/master/notes/hello.txt", + "type" => "file", + "_links" => { + "self" => "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt", + "git" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3", + "html" => "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt" + } + }, + "commit" => { + "sha" => "7638417db6d59f3c431d3e1f261cc637155684cd", + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd", + "html_url" => "https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd", + "author" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "committer" => { + "date" => "2014-11-07T22:01:45Z", + "name" => "Scott Chacon", + "email" => "schacon@gmail.com" + }, + "message" => "my commit message", + "tree" => { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb", + "sha" => "691272480426f78a0138979dd3ce63b77f706feb" + }, + "parents" => [ + { + "url" => "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5", + "html_url" => "https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5", + "sha" => "1acc419d4d6a9ce985db7be48c6349a0475975b5" + } + ] + } + } + + THREAD ||= { + :id => "1", + :repository => SIMPLE_REPO, + :subject => { + :title => "Greetings", + :url => "https://api.github.com/repos/octokit/octokit.rb/issues/123", + :latest_comment_url => "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123", + :type => "Issue" + }, + :reason => 'subscribed', + :unread => true, + :updated_at => '2014-11-07T22:01:45Z', + :last_read_at => '2014-11-07T22:01:45Z', + :url => "https://api.github.com/notifications/threads/1" + } + + SUBSCRIPTION ||= { + :subscribed => true, + :ignored => false, + :reason => nil, + :created_at => "2012-10-06T21:34:12Z", + :url => "https://api.github.com/notifications/threads/1/subscription", + :thread_url => "https://api.github.com/notifications/threads/1" + } + + REPO_SUBSCRIPTION ||= SUBSCRIPTION.merge \ + :url => "https://api.github.com/repos/octocat/example/subscription", + :repository_url => "https://api.github.com/repos/octocat/example" + REPO_SUBSCRIPTION.delete :thread_url + + TEMPLATE ||= { + :name => "C", + :source => "# Object files\n*.o\n\n# Libraries\n*.lib\n*.a\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*\n*.dylib\n\n# Executables\n*.exe\n*.out\n*.app\n" + } + + TEMPLATES ||= [ + "Actionscript", + "Android", + "AppceleratorTitanium", + "Autotools", + "Bancha", + "C", + "C++" + ] + + USER_EMAIL ||= { + :email => "octocat@github.com", + :verified => true, + :primary => true + } + + REPO_STATS_CONTRIBUTORS ||= [{ + :author => USER, + :total => 135, + :weeks => [ + { + :w => "1367712000", + :a => 6898, + :d => 77, + :c => 10 + } + ] + }] + + REPO_STATS_COMMIT_ACTIVITY ||= [{ + :days => [0, 3, 26, 20, 39, 1, 0], + :total => 89, + :week => 1336280400 + }] + + REPO_STATS_CODE_FREQUENCY ||= [[ + 1302998400, + 1124, + -435 + ]] + + REPO_STATS_PARTICIPATION ||= { + :all => [11,21,15,2,8,1,8,23,17,21,11,10,33,91,38,34,22,23,32,3,43,87,71,18,13,5,13,16,66,27,12,45,110,117,13,8,18,9,19,26,39,12,20,31,46,91,45,10,24,9,29,7], + :owner => [3,2,3,0,2,0,5,14,7,9,1,5,0,48,19,2,0,1,10,2,23,40,35,8,8,2,10,6,30,0,2,9,53,104,3,3,10,4,7,11,21,4,4,22,26,63,11,2,14,1,10,3] + } + + REPO_STATS_PUNCH_CARD ||= [ + [0,0,5], + [0,1,43], + [0,2,21] + ] + + FEEDS ||= { + :timeline_url => "https://github.com/timeline", + :user_url => "https://github.com/{user}", + :current_user_public_url => "https://github.com/defunkt", + :current_user_url => "https://github.com/defunkt.private?token=abc123", + :current_user_actor_url => "https://github.com/defunkt.private.actor?token=abc123", + :current_user_organization_url => "", + :current_user_organization_urls => [ + "https://github.com/organizations/github/defunkt.private.atom?token=abc123" + ], + :_links => { + :timeline => { + :href => "https://github.com/timeline", + :type => "application/atom+xml" + }, + :user => { + :href => "https://github.com/{user}", + :type => "application/atom+xml" + }, + :current_user_public => { + :href => "https://github.com/defunkt", + :type => "application/atom+xml" + }, + :current_user => { + :href => "https://github.com/defunkt.private?token=abc123", + :type => "application/atom+xml" + }, + :current_user_actor => { + :href => "https://github.com/defunkt.private.actor?token=abc123", + :type => "application/atom+xml" + }, + :current_user_organization => { + :href => "", + :type => "" + }, + :current_user_organizations => [ + { + :href => "https://github.com/organizations/github/defunkt.private.atom?token=abc123", + :type => "application/atom+xml" + } + ] + } + } + + EMOJIS ||= { + "+1" => "https://github.global.ssl.fastly.net/images/icons/emoji/+1.png?v5", + "-1" => "https://github.global.ssl.fastly.net/images/icons/emoji/-1.png?v5", + "100" => "https://github.global.ssl.fastly.net/images/icons/emoji/100.png?v5", + "1234" => "https://github.global.ssl.fastly.net/images/icons/emoji/1234.png?v5", + "8ball" => "https://github.global.ssl.fastly.net/images/icons/emoji/8ball.png?v5", + "a" => "https://github.global.ssl.fastly.net/images/icons/emoji/a.png?v5", + "ab" => "https://github.global.ssl.fastly.net/images/icons/emoji/ab.png?v5" + } + + ADMIN_STATS ||= { + "repos" => { + "total_repos" => 212, + "root_repos" => 194, + "fork_repos" => 18, + "org_repos" => 51, + "total_pushes" => 3082, + "total_wikis" => 15 + }, + "hooks" => { + "total_hooks" => 27, + "active_hooks" => 23, + "inactive_hooks" => 4 + }, + "pages" => { + "total_pages" => 36 + }, + "orgs" => { + "total_orgs" => 33, + "disabled_orgs" => 0, + "total_teams" => 60, + "total_team_members" => 314 + }, + "users" => { + "total_users" => 254, + "admin_users" => 45, + "suspended_users" => 21 + }, + "pulls" => { + "total_pulls" => 86, + "merged_pulls" => 60, + "mergeable_pulls" => 21, + "unmergeable_pulls" => 3, + }, + "issues" => { + "total_issues" => 179, + "open_issues" => 83, + "closed_issues" => 96 + }, + "milestones" => { + "total_milestones" => 7, + "open_milestones" => 6, + "closed_milestones" => 1 + }, + "gists" => { + "total_gists" => 178, + "private_gists" => 151, + "public_gists" => 25 + }, + "comments" => { + "total_commit_comments" => 6, + "total_gist_comments" => 28, + "total_issue_comments" => 366, + "total_pull_request_comments" => 30 + } + } + + LICENSING ||= { + "seats" => 1400, + "seats_used" => 1316, + "seats_available" => 84, + "kind" => "standard", + "days_until_expiration" => 365, + "expire_at" => "2016/02/06 12:41:52 -0600" + } + + INDEXING_SUCCESS ||= { + "message" => "Repository 'kansaichris/japaning' has been added to the indexing queue" + } + + CONFIG_STATUSES ||= { + "status" => "running", + "progress" => [ + { + "status" => "DONE", + "key" => "Appliance core components" + }, + { + "status" => "DONE", + "key" => "GitHub utilities" + }, + { + "status" => "DONE", + "key" => "GitHub applications" + }, + { + "status" => "CONFIGURING", + "key" => "GitHub services" + }, + { + "status" => "PENDING", + "key" => "Reloading appliance services" + } + ] + } + + FETCH_SETTINGS ||= { + "enterprise" => { + "private_mode" => false, + "github_hostname" => "ghe.local", + "auth_mode" => "default", + "storage_mode" => "rootfs", + "admin_password" => nil, + "configuration_id" => 1401777404, + "configuration_run_count" => 4, + "package_version" => "11.10.332", + "avatar" => { + "enabled" => false, + "uri" => "" + }, + "customer" => { + "name" => "GitHub", + "email" => "stannis@themannis.biz", + "uuid" => "af6cac80-e4e1-012e-d822-1231380e52e9", + "secret_key_data" => "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nlQcYBE5TCgsBEACk4yHpUcapplebaumBMXYMiLF+nCQ0lxpx...\n-----END PGP PRIVATE KEY BLOCK-----\n", + "public_key_data" => "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nmI0ETqzZYgEEALSe6snowdenXyqvLfSQ34HWD6C7....\n-----END PGP PUBLIC KEY BLOCK-----\n" + }, + "license" => { + "seats" => 0, + "evaluation" => false, + "expire_at" => "2015-04-27T00:00:00-07:00", + "perpetual" => false, + "unlimited_seating" => true, + "support_key" => "ssh-rsa AAAAB3N....", + "ssh_allowed" => true + }, + "github_ssl" => { + "enabled" => false, + "cert" => nil, + "key" => nil + }, + "ldap" => { + "host" => "", + "port" => "", + "base" => [ + + ], + "uid" => "", + "bind_dn" => "", + "password" => "", + "method" => "Plain", + "user_groups" => [ + + ], + "admin_group" => "" + }, + "cas" => { + "url" => "" + }, + "github_oauth" => { + "client_id" => "12313412", + "client_secret" => "kj123131132", + "organization_name" => "Homestar Runners", + "organization_team" => "homestarrunners/characters" + }, + "smtp" => { + "enabled" => true, + "address" => "smtp.example.com", + "authentication" => "plain", + "port" => "1234", + "domain" => "blah", + "username" => "foo", + "user_name" => "mr_foo", + "enable_starttls_auto" => true, + "password" => "bar", + "support_address" => "enterprise@github.com", + "noreply_address" => "noreply@github.com" + }, + "dns" => { + "primary_nameserver" => "8.8.8.8", + "secondary_nameserver" => "8.8.4.4" + }, + "ntp" => { + "primary_server" => "0.ubuntu.pool.ntp.org", + "secondary_server" => "1.ubuntu.pool.ntp.org" + }, + "timezone" => { + "identifier" => "UTC" + }, + "device" => { + "path" => "/dev/xyz" + }, + "snmp" => { + "enabled" => false, + "community" => "" + }, + "rsyslog" => { + "enabled" => false, + "server" => "", + "protocol_name" => "TCP" + }, + "assets" => { + "storage" => "file", + "bucket" => nil, + "host_name" => nil, + "key_id" => nil, + "access_key" => nil + }, + "pages" => { + "enabled" => true + }, + "collectd" => { + "enabled" => false, + "server" => "", + "port" => "", + "encryption" => "", + "username" => "foo", + "password" => "bar" + } + }, + "run_list" => [ + "role[configure]" + ] + } + + CHECK_MAINTENANCE_STATUS ||= { + "status" => "scheduled", + "scheduled_time" => "Tuesday, January 22 at 15 => 34 -0800", + "connection_services" => [ + { + "name" => "git operations", "number" => 0 + }, + { + "name" => "mysql queries", "number" => 233 + }, + { + "name" => "resque jobs", "number" => 54 + } + ] + } + + SET_MAINTENANCE_STATUS ||= { + "status" => "scheduled", + "scheduled_time" => "Tuesday, January 22 at 15 => 34 -0800", + "connection_services" => [ + { + "name" => "git operations", "number" => 0 + }, + { + "name" => "mysql queries", "number" => 233 + }, + { + "name" => "resque jobs", "number" => 54 + } + ] + } + + GET_AUTHORIZED_SSH_KEYS ||= [ + { + "key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...", + "pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64" + }, + { + "key" => "ssh-rsa AAAAB3NzaC1yc2EAAAAB...", + "pretty-print" => "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64" + } + ] + + LDAP_USER_UPDATE ||= { + 'ldap_dn' => 'uid=asdf,ou=users,dc=github,dc=com' + }.merge(USER) + + LDAP_TEAM_UPDATE ||= { + 'ldap_dn' => 'cn=Enterprise Ops,ou=teams,dc=github,dc=com' + }.merge(TEAM) + + LDAP_SYNC_CONFIRM ||= { + 'status' => 'queued' + } + + LICENSES ||= [ + {"key"=>"agpl-3.0", "name"=>"GNU Affero GPL v3.0", "url"=>"https://api.github.com/licenses/agpl-3.0"}, + {"key"=>"apache-2.0", "name"=>"Apache License 2.0", "url"=>"https://api.github.com/licenses/apache-2.0"}, + {"key"=>"artistic-2.0", "name"=>"Artistic License 2.0", "url"=>"https://api.github.com/licenses/artistic-2.0"}, + {"key"=>"bsd-2-clause", "name"=>"Simplified BSD", "url"=>"https://api.github.com/licenses/bsd-2-clause"}, + {"key"=>"bsd-3-clause", "name"=>"New BSD", "url"=>"https://api.github.com/licenses/bsd-3-clause"}, + {"key"=>"cc0", "name"=>"CC0 1.0 Universal", "url"=>"https://api.github.com/licenses/cc0"}, + {"key"=>"epl-1.0", "name"=>"Eclipse Public License v1.0", "url"=>"https://api.github.com/licenses/epl-1.0"}, + {"key"=>"gpl-2.0", "name"=>"GNU GPL v2.0", "url"=>"https://api.github.com/licenses/gpl-2.0"}, + {"key"=>"gpl-3.0", "name"=>"GNU GPL v3.0", "url"=>"https://api.github.com/licenses/gpl-3.0"}, + {"key"=>"isc", "name"=>"ISC license", "url"=>"https://api.github.com/licenses/isc"}, + {"key"=>"lgpl-2.1", "name"=>"GNU LGPL v2.1", "url"=>"https://api.github.com/licenses/lgpl-2.1"}, + {"key"=>"lgpl-3.0", "name"=>"GNU LGPL v3.0", "url"=>"https://api.github.com/licenses/lgpl-3.0"}, + {"key"=>"mit", "name"=>"MIT License", "url"=>"https://api.github.com/licenses/mit"}, + {"key"=>"mpl-2.0", "name"=>"Mozilla Public License 2.0", "url"=>"https://api.github.com/licenses/mpl-2.0"}, + {"key"=>"unlicense", "name"=>"Public Domain (Unlicense)", "url"=>"https://api.github.com/licenses/unlicense"} + ] + + MIT ||= { + "key"=>"mit", + "name"=>"MIT License", + "url"=>"https://api.github.com/licenses/mit", + "html_url"=>"http://choosealicense.com/licenses/mit/", + "featured"=>true, + "description"=>"A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.", + "category"=>"MIT", + "implementation"=> + "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.", + "required"=>["include-copyright"], + "permitted"=>["commercial-use", "modifications", "distribution", "sublicense", "private-use"], + "forbidden"=>["no-liability"], + "body"=> + "\n\nThe MIT License (MIT)\n\nCopyright (c) [year] [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" + } + + LICENSEE ||= { + "id"=>23022377, + "name"=>"licensee", + "full_name"=>"benbalter/licensee", + "owner"=>{ + "login"=>"benbalter", + "id"=>282759, + "avatar_url"=>"https://avatars.githubusercontent.com/u/282759?v=3", + "gravatar_id"=>"", + "url"=>"https://api.github.com/users/benbalter", + "html_url"=>"https://github.com/benbalter", + "followers_url"=>"https://api.github.com/users/benbalter/followers", + "following_url"=>"https://api.github.com/users/benbalter/following{/other_user}", + "gists_url"=>"https://api.github.com/users/benbalter/gists{/gist_id}", + "starred_url"=>"https://api.github.com/users/benbalter/starred{/owner}{/repo}", + "subscriptions_url"=>"https://api.github.com/users/benbalter/subscriptions", + "organizations_url"=>"https://api.github.com/users/benbalter/orgs", + "repos_url"=>"https://api.github.com/users/benbalter/repos", + "events_url"=>"https://api.github.com/users/benbalter/events{/privacy}", + "received_events_url"=>"https://api.github.com/users/benbalter/received_events", + "type"=>"User", + "site_admin"=>true + }, + "private"=>false, + "html_url"=>"https://github.com/benbalter/licensee", + "description"=>"A Ruby Gem to detect under what license a project is distributed.", + "fork"=>false, "url"=>"https://api.github.com/repos/benbalter/licensee", + "forks_url"=>"https://api.github.com/repos/benbalter/licensee/forks", + "keys_url"=>"https://api.github.com/repos/benbalter/licensee/keys{/key_id}", + "collaborators_url"=>"https://api.github.com/repos/benbalter/licensee/collaborators{/collaborator}", + "teams_url"=>"https://api.github.com/repos/benbalter/licensee/teams", + "hooks_url"=>"https://api.github.com/repos/benbalter/licensee/hooks", + "issue_events_url"=>"https://api.github.com/repos/benbalter/licensee/issues/events{/number}", + "events_url"=>"https://api.github.com/repos/benbalter/licensee/events", + "assignees_url"=>"https://api.github.com/repos/benbalter/licensee/assignees{/user}", + "branches_url"=>"https://api.github.com/repos/benbalter/licensee/branches{/branch}", + "tags_url"=>"https://api.github.com/repos/benbalter/licensee/tags", + "blobs_url"=>"https://api.github.com/repos/benbalter/licensee/git/blobs{/sha}", + "git_tags_url"=>"https://api.github.com/repos/benbalter/licensee/git/tags{/sha}", + "git_refs_url"=>"https://api.github.com/repos/benbalter/licensee/git/refs{/sha}", + "trees_url"=>"https://api.github.com/repos/benbalter/licensee/git/trees{/sha}", + "statuses_url"=>"https://api.github.com/repos/benbalter/licensee/statuses/{sha}", + "languages_url"=>"https://api.github.com/repos/benbalter/licensee/languages", + "stargazers_url"=>"https://api.github.com/repos/benbalter/licensee/stargazers", + "contributors_url"=>"https://api.github.com/repos/benbalter/licensee/contributors", + "subscribers_url"=>"https://api.github.com/repos/benbalter/licensee/subscribers", + "subscription_url"=>"https://api.github.com/repos/benbalter/licensee/subscription", + "commits_url"=>"https://api.github.com/repos/benbalter/licensee/commits{/sha}", + "git_commits_url"=>"https://api.github.com/repos/benbalter/licensee/git/commits{/sha}", + "comments_url"=>"https://api.github.com/repos/benbalter/licensee/comments{/number}", + "issue_comment_url"=>"https://api.github.com/repos/benbalter/licensee/issues/comments{/number}", + "contents_url"=>"https://api.github.com/repos/benbalter/licensee/contents/{+path}", + "compare_url"=>"https://api.github.com/repos/benbalter/licensee/compare/{base}...{head}", + "merges_url"=>"https://api.github.com/repos/benbalter/licensee/merges", + "archive_url"=>"https://api.github.com/repos/benbalter/licensee/{archive_format}{/ref}", + "downloads_url"=>"https://api.github.com/repos/benbalter/licensee/downloads", + "issues_url"=>"https://api.github.com/repos/benbalter/licensee/issues{/number}", + "pulls_url"=>"https://api.github.com/repos/benbalter/licensee/pulls{/number}", + "milestones_url"=>"https://api.github.com/repos/benbalter/licensee/milestones{/number}", + "notifications_url"=>"https://api.github.com/repos/benbalter/licensee/notifications{?since,all,participating}", + "labels_url"=>"https://api.github.com/repos/benbalter/licensee/labels{/name}", + "releases_url"=>"https://api.github.com/repos/benbalter/licensee/releases{/id}", + "created_at"=>"2014-08-16T16:39:56Z", + "updated_at"=>"2015-02-26T18:58:36Z", + "pushed_at"=>"2015-02-26T19:09:18Z", + "git_url"=>"git://github.com/benbalter/licensee.git", + "ssh_url"=>"git@github.com:benbalter/licensee.git", + "clone_url"=>"https://github.com/benbalter/licensee.git", + "svn_url"=>"https://github.com/benbalter/licensee", + "homepage"=>"", + "size"=>687, + "stargazers_count"=>20, + "watchers_count"=>20, + "language"=>"Ruby", + "has_issues"=>true, + "has_downloads"=>true, + "has_wiki"=>false, + "has_pages"=>false, + "forks_count"=>6, + "mirror_url"=>nil, + "open_issues_count"=>2, + "forks"=>6, + "open_issues"=>2, + "watchers"=>20, + "default_branch"=>"master", + "master_branch"=>"master", + "license"=> { + "key"=>"mit", + "name"=>"MIT License", + "url"=>"https://api.github.com/licenses/mit" + }, + "network_count"=>6, + "subscribers_count"=>6 + } + end +end + +include GitHub::Resources::Helpers diff --git a/lib/search_generator.rb b/lib/search_generator.rb new file mode 100755 index 0000000000..4c9806b060 --- /dev/null +++ b/lib/search_generator.rb @@ -0,0 +1,61 @@ +require 'json' +require 'nokogiri' + +class SearchFilter < Nanoc::Filter + identifier :search + type :text + + $search_file_path = File.join(Dir.pwd, "static", "search-index.json") + $search_file_contents = { :pages => [] } + + sidebar = File.open(File.join(Dir.pwd, "layouts", "sidebar.html")) + $sidebar_doc = Nokogiri::HTML(sidebar) + sidebar.close + + def run(content, params={}) + # uses nokogiri to determine parent section name + containing_li_text = $sidebar_doc.xpath("//a[@href='#{@item.identifier}']/../../../h3/a[2]/text()") + + # we're looking at an overview page + containing_li_text = $sidebar_doc.xpath("//a[@href='#{@item.identifier}']/text()") if containing_li_text.empty? + + page = { :url => @item.identifier, :title => @item[:title].split("|")[0].strip, :section => "API/#{containing_li_text}" } + + $search_file_contents[:pages] << page + $search_file_contents[:pages] = merge_sort($search_file_contents[:pages]) + + write_search_file + + content + end + + def write_search_file + begin + File.open($search_file_path, 'w') {|f| f.write(JSON.pretty_generate($search_file_contents) << "\n") } # and final newline) + rescue + puts 'WARNING: cannot write search file.' + end + end + + private + + # basically we need a merge sort for elements like "/v3/orgs." Otherwise, + # nanoc puts "/v3/orgs/members" before "/v3/orgs." Children should respect their + # parents, yo. + def merge_sort(a) + return a if a.size <= 1 + l, r = split_array(a) + result = combine(merge_sort(l), merge_sort(r)) + end + + def split_array(a) + mid = (a.size / 2).round + [a.take(mid), a.drop(mid)] + end + + def combine(a, b) + return b.empty? ? a : b if a.empty? || b.empty? + smallest = a.first[:url] <= b.first[:url] ? a.shift : b.shift + combine(a, b).unshift(smallest) + end +end diff --git a/lib/static.rb b/lib/static.rb new file mode 100644 index 0000000000..5d091fa859 --- /dev/null +++ b/lib/static.rb @@ -0,0 +1,55 @@ +require 'digest/sha1' + +module Nanoc3::DataSources + + class Static < Nanoc3::DataSource + + identifier :static + + def items + # Get prefix + prefix = config[:prefix] || 'static' + + # Get all files under prefix dir + filenames = Dir[prefix + '/**/*'].select { |f| File.file?(f) } + + # Convert filenames to items + filenames.map do |filename| + attributes = { + :extension => File.extname(filename)[1..-1], + :filename => filename, + } + identifier = filename[(prefix.length+1)..-1] + '/' + + mtime = File.mtime(filename) + checksum = checksum_for(filename) + + Nanoc3::Item.new( + filename, + attributes, + identifier, + :binary => true, :mtime => mtime, :checksum => checksum + ) + end + end + + private + + # Returns a checksum of the given filenames + # TODO un-duplicate this somewhere + def checksum_for(*filenames) + filenames.flatten.map do |filename| + digest = Digest::SHA1.new + File.open(filename, 'r') do |io| + until io.eof + data = io.readpartial(2**10) + digest.update(data) + end + end + digest.hexdigest + end.join('-') + end + + end + +end diff --git a/lib/tip_filter.rb b/lib/tip_filter.rb new file mode 100644 index 0000000000..527a35a363 --- /dev/null +++ b/lib/tip_filter.rb @@ -0,0 +1,9 @@ +class TipFilter < Nanoc::Filter + identifier :tip_filter + type :text + + def run(content, params={}) + content = content.gsub(/

\{\{#(tip|warning|error)}}<\/p>/, '

') + content.gsub(/

\{\{\/(tip|warning|error)}}<\/p>/, '

') + end +end diff --git a/lib/webhooks/.gitkeep b/lib/webhooks/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/webhooks/commit_comment.payload.json b/lib/webhooks/commit_comment.payload.json new file mode 100644 index 0000000000..26422f95c7 --- /dev/null +++ b/lib/webhooks/commit_comment.payload.json @@ -0,0 +1,139 @@ +{ + "comment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/comments/8108441", + "html_url": "https://github.com/baxterthehacker/public-repo/commit/7b80eb100206a56523dbda6202d8e5daa05e265b#commitcomment-8108441", + "id": 8108441, + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "position": null, + "line": null, + "path": null, + "commit_id": "7b80eb100206a56523dbda6202d8e5daa05e265b", + "created_at": "2014-10-10T00:09:52Z", + "updated_at": "2014-10-10T00:09:52Z", + "body": "This is a really good change! :+1:" + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/create.payload.json b/lib/webhooks/create.payload.json new file mode 100644 index 0000000000..7aa13aecb0 --- /dev/null +++ b/lib/webhooks/create.payload.json @@ -0,0 +1,113 @@ +{ + "ref": "0.0.1", + "ref_type": "tag", + "master_branch": "master", + "description": "", + "pusher_type": "user", + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:02Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/delete.payload.json b/lib/webhooks/delete.payload.json new file mode 100644 index 0000000000..5e31a84cbd --- /dev/null +++ b/lib/webhooks/delete.payload.json @@ -0,0 +1,111 @@ +{ + "ref": "simple-tag", + "ref_type": "tag", + "pusher_type": "user", + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:05Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/deployment.payload.json b/lib/webhooks/deployment.payload.json new file mode 100644 index 0000000000..7ff05dbd1b --- /dev/null +++ b/lib/webhooks/deployment.payload.json @@ -0,0 +1,151 @@ +{ + "deployment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887", + "id": 73887, + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "ref": "master", + "task": "deploy", + "payload": { + }, + "environment": "production", + "description": null, + "creator": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2014-10-10T00:10:02Z", + "updated_at": "2014-10-10T00:10:02Z", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887/statuses", + "repository_url": "https://api.github.com/repos/baxterthehacker/public-repo" + }, + "id": 73887, + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "ref": "master", + "task": "deploy", + "name": "baxterthehacker/public-repo", + "environment": "production", + "payload": { + }, + "description": null, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:02Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/deployment_status.payload.json b/lib/webhooks/deployment_status.payload.json new file mode 100644 index 0000000000..db1b3e4f6b --- /dev/null +++ b/lib/webhooks/deployment_status.payload.json @@ -0,0 +1,176 @@ +{ + "deployment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887", + "id": 73887, + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "ref": "master", + "task": "deploy", + "payload": { + }, + "environment": "production", + "description": null, + "creator": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2014-10-10T00:10:02Z", + "updated_at": "2014-10-10T00:10:02Z", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887/statuses", + "repository_url": "https://api.github.com/repos/baxterthehacker/public-repo" + }, + "deployment_status": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887/statuses/131259", + "id": 131259, + "state": "success", + "creator": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "description": null, + "target_url": null, + "created_at": "2014-10-10T00:10:03Z", + "updated_at": "2014-10-10T00:10:03Z", + "deployment_url": "https://api.github.com/repos/baxterthehacker/public-repo/deployments/73887", + "repository_url": "https://api.github.com/repos/baxterthehacker/public-repo" + }, + "id": 131259, + "state": "success", + "target_url": null, + "description": null, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:02Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/fork.payload.json b/lib/webhooks/fork.payload.json new file mode 100644 index 0000000000..47620bfba3 --- /dev/null +++ b/lib/webhooks/fork.payload.json @@ -0,0 +1,196 @@ +{ + "forkee": { + "id": 25013628, + "name": "public-repo", + "full_name": "baxterandthehackers/public-repo", + "owner": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterandthehackers/public-repo", + "description": "", + "fork": true, + "url": "https://api.github.com/repos/baxterandthehackers/public-repo", + "forks_url": "https://api.github.com/repos/baxterandthehackers/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterandthehackers/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterandthehackers/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterandthehackers/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterandthehackers/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterandthehackers/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterandthehackers/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterandthehackers/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterandthehackers/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterandthehackers/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterandthehackers/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterandthehackers/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterandthehackers/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterandthehackers/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterandthehackers/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterandthehackers/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterandthehackers/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterandthehackers/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterandthehackers/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterandthehackers/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterandthehackers/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterandthehackers/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterandthehackers/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterandthehackers/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterandthehackers/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterandthehackers/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterandthehackers/public-repo/releases{/id}", + "created_at": "2014-10-10T00:09:53Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterandthehackers/public-repo.git", + "ssh_url": "git@github.com:baxterandthehackers/public-repo.git", + "clone_url": "https://github.com/baxterandthehackers/public-repo.git", + "svn_url": "https://github.com/baxterandthehackers/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "public": true + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 1, + "mirror_url": null, + "open_issues_count": 26, + "forks": 1, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + } +} diff --git a/lib/webhooks/gollum.payload.json b/lib/webhooks/gollum.payload.json new file mode 100644 index 0000000000..319784343c --- /dev/null +++ b/lib/webhooks/gollum.payload.json @@ -0,0 +1,118 @@ +{ + "pages": [ + { + "page_name": "Home", + "title": "Home", + "summary": null, + "action": "edited", + "sha": "f4ae9827975676f8084454b30d83f05f3cb9f935", + "html_url": "https://github.com/baxterthehacker/public-repo/wiki/Home" + } + ], + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-07-25T16:38:20Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 24, + "forks": 0, + "open_issues": 24, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "kdaigle", + "id": 2501, + "avatar_url": "https://avatars.githubusercontent.com/u/2501?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/kdaigle", + "html_url": "https://github.com/kdaigle", + "followers_url": "https://api.github.com/users/kdaigle/followers", + "following_url": "https://api.github.com/users/kdaigle/following{/other_user}", + "gists_url": "https://api.github.com/users/kdaigle/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kdaigle/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kdaigle/subscriptions", + "organizations_url": "https://api.github.com/users/kdaigle/orgs", + "repos_url": "https://api.github.com/users/kdaigle/repos", + "events_url": "https://api.github.com/users/kdaigle/events{/privacy}", + "received_events_url": "https://api.github.com/users/kdaigle/received_events", + "type": "User", + "site_admin": true + } +} diff --git a/lib/webhooks/issue_comment.payload.json b/lib/webhooks/issue_comment.payload.json new file mode 100644 index 0000000000..2acda37ad3 --- /dev/null +++ b/lib/webhooks/issue_comment.payload.json @@ -0,0 +1,182 @@ +{ + "action": "created", + "issue": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/labels{/name}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/comments", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/events", + "html_url": "https://github.com/baxterthehacker/public-repo/issues/51", + "id": 45432786, + "number": 51, + "title": "Spelling error in the README file", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/labels/bug", + "name": "bug", + "color": "fc2929" + } + ], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 1, + "created_at": "2014-10-10T00:09:51Z", + "updated_at": "2014-10-10T00:09:51Z", + "closed_at": null, + "body": "It looks like you accidently spelled 'commit' with two 't's." + }, + "comment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/58596796", + "html_url": "https://github.com/baxterthehacker/public-repo/issues/51#issuecomment-58596796", + "issue_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51", + "id": 58596796, + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "created_at": "2014-10-10T00:09:51Z", + "updated_at": "2014-10-10T00:09:51Z", + "body": "You are totally right! I'll get this fixed right away." + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/issues.payload.json b/lib/webhooks/issues.payload.json new file mode 100644 index 0000000000..04c233e0b4 --- /dev/null +++ b/lib/webhooks/issues.payload.json @@ -0,0 +1,159 @@ +{ + "action": "labeled", + "issue": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/labels{/name}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/comments", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/51/events", + "html_url": "https://github.com/baxterthehacker/public-repo/issues/51", + "id": 45432786, + "number": 51, + "title": "Spelling error in the README file", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/labels/bug", + "name": "bug", + "color": "fc2929" + } + ], + "state": "open", + "locked": false, + "assignee": null, + "milestone": null, + "comments": 1, + "created_at": "2014-10-10T00:09:51Z", + "updated_at": "2014-10-10T00:09:51Z", + "closed_at": null, + "body": "It looks like you accidently spelled 'commit' with two 't's." + }, + "label": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/labels/bug", + "name": "bug", + "color": "fc2929" + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/member.payload.json b/lib/webhooks/member.payload.json new file mode 100644 index 0000000000..4b379c911f --- /dev/null +++ b/lib/webhooks/member.payload.json @@ -0,0 +1,128 @@ +{ + "action": "added", + "member": { + "login": "octocat", + "id": 583231, + "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:05Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/membership.payload.json b/lib/webhooks/membership.payload.json new file mode 100644 index 0000000000..612d967f6d --- /dev/null +++ b/lib/webhooks/membership.payload.json @@ -0,0 +1,61 @@ +{ + "action": "added", + "scope": "team", + "member": { + "login": "kdaigle", + "id": 2501, + "avatar_url": "https://avatars.githubusercontent.com/u/2501?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/kdaigle", + "html_url": "https://github.com/kdaigle", + "followers_url": "https://api.github.com/users/kdaigle/followers", + "following_url": "https://api.github.com/users/kdaigle/following{/other_user}", + "gists_url": "https://api.github.com/users/kdaigle/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kdaigle/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kdaigle/subscriptions", + "organizations_url": "https://api.github.com/users/kdaigle/orgs", + "repos_url": "https://api.github.com/users/kdaigle/repos", + "events_url": "https://api.github.com/users/kdaigle/events{/privacy}", + "received_events_url": "https://api.github.com/users/kdaigle/received_events", + "type": "User", + "site_admin": true + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "team": { + "name": "Contractors", + "id": 123456, + "slug": "contractors", + "permission": "admin", + "url": "https://api.github.com/teams/123456", + "members_url": "https://api.github.com/teams/123456/members{/member}", + "repositories_url": "https://api.github.com/teams/123456/repos" + }, + "organization": { + "login": "baxterandthehackers", + "id": 7649605, + "url": "https://api.github.com/orgs/baxterandthehackers", + "repos_url": "https://api.github.com/orgs/baxterandthehackers/repos", + "events_url": "https://api.github.com/orgs/baxterandthehackers/events", + "members_url": "https://api.github.com/orgs/baxterandthehackers/members{/member}", + "public_members_url": "https://api.github.com/orgs/baxterandthehackers/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2" + } +} diff --git a/lib/webhooks/page_build.payload.json b/lib/webhooks/page_build.payload.json new file mode 100644 index 0000000000..0ea58b7783 --- /dev/null +++ b/lib/webhooks/page_build.payload.json @@ -0,0 +1,139 @@ +{ + "id": 10312005, + "build": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/pages/builds/10312005", + "status": "built", + "error": { + "message": null + }, + "pusher": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "commit": "7700ca29dd050d9adacc0803f866d9b539513535", + "duration": 4440, + "created_at": "2014-10-10T00:09:49Z", + "updated_at": "2014-10-10T00:09:54Z" + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 1, + "mirror_url": null, + "open_issues_count": 26, + "forks": 1, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/ping.payload.json b/lib/webhooks/ping.payload.json new file mode 100644 index 0000000000..befe29af73 --- /dev/null +++ b/lib/webhooks/ping.payload.json @@ -0,0 +1,131 @@ +{ + "zen": "It's not fully shipped until it's fast.", + "hook_id": 3183611, + "hook": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks/3183611", + "test_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks/3183611/test", + "id": 3183611, + "name": "web", + "active": true, + "events": [ + "*" + ], + "config": { + "url": "https://lp6ukjrzvp75.runscope.net", + "content_type": "json" + }, + "last_response": { + "code": null, + "status": "unused", + "message": null + }, + "updated_at": "2014-10-10T00:09:40Z", + "created_at": "2014-10-10T00:09:40Z" + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-07-25T16:38:20Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 24, + "forks": 0, + "open_issues": 24, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/public.payload.json b/lib/webhooks/public.payload.json new file mode 100644 index 0000000000..66a46eb584 --- /dev/null +++ b/lib/webhooks/public.payload.json @@ -0,0 +1,108 @@ +{ + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:10:06Z", + "pushed_at": "2014-10-10T00:10:05Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/pull_request.payload.json b/lib/webhooks/pull_request.payload.json new file mode 100644 index 0000000000..7719ea4fe5 --- /dev/null +++ b/lib/webhooks/pull_request.payload.json @@ -0,0 +1,412 @@ +{ + "action": "opened", + "number": 50, + "pull_request": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50", + "id": 22532849, + "html_url": "https://github.com/baxterthehacker/public-repo/pull/50", + "diff_url": "https://github.com/baxterthehacker/public-repo/pull/50.diff", + "patch_url": "https://github.com/baxterthehacker/public-repo/pull/50.patch", + "issue_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50", + "number": 50, + "state": "open", + "locked": false, + "title": "Update the README with new information", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a pretty simple change that we need to pull into master.", + "created_at": "2014-10-10T00:09:50Z", + "updated_at": "2014-10-10T00:09:50Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cd3ff078a350901f91f4c4036be74f91d0b0d5d5", + "assignee": null, + "milestone": null, + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/commits", + "review_comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/comments", + "review_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/{number}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50/comments", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/05c588ba8cd510ecbe112d020f215facb17817a6", + "head": { + "label": "baxterthehacker:changes", + "ref": "changes", + "sha": "05c588ba8cd510ecbe112d020f215facb17817a6", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 25, + "forks": 0, + "open_issues": 25, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "baxterthehacker:master", + "ref": "master", + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 25, + "forks": 0, + "open_issues": 25, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50" + }, + "html": { + "href": "https://github.com/baxterthehacker/public-repo/pull/50" + }, + "issue": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50" + }, + "comments": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/{number}" + }, + "commits": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/05c588ba8cd510ecbe112d020f215facb17817a6" + } + }, + "merged": false, + "mergeable": true, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 1, + "commits": 1, + "additions": 2, + "deletions": 0, + "changed_files": 1 + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 25, + "forks": 0, + "open_issues": 25, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/pull_request_review_comment.payload.json b/lib/webhooks/pull_request_review_comment.payload.json new file mode 100644 index 0000000000..ece8ab53b0 --- /dev/null +++ b/lib/webhooks/pull_request_review_comment.payload.json @@ -0,0 +1,446 @@ +{ + "action": "created", + "comment": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/18682909", + "id": 18682909, + "diff_hunk": "@@ -1,2 +1,4 @@\n public-repo", + "path": "README.md", + "position": 1, + "original_position": 1, + "commit_id": "05c588ba8cd510ecbe112d020f215facb17817a6", + "original_commit_id": "05c588ba8cd510ecbe112d020f215facb17817a6", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "body": "Maybe you should use more emojji on this line.", + "created_at": "2014-10-10T00:09:50Z", + "updated_at": "2014-10-10T00:09:50Z", + "html_url": "https://github.com/baxterthehacker/public-repo/pull/50#discussion_r18682909", + "pull_request_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50", + "_links": { + "self": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/18682909" + }, + "html": { + "href": "https://github.com/baxterthehacker/public-repo/pull/50#discussion_r18682909" + }, + "pull_request": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50" + } + } + }, + "pull_request": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50", + "id": 22532849, + "html_url": "https://github.com/baxterthehacker/public-repo/pull/50", + "diff_url": "https://github.com/baxterthehacker/public-repo/pull/50.diff", + "patch_url": "https://github.com/baxterthehacker/public-repo/pull/50.patch", + "issue_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50", + "number": 50, + "state": "open", + "locked": false, + "title": "Update the README with new information", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "body": "This is a pretty simple change that we need to pull into master.", + "created_at": "2014-10-10T00:09:50Z", + "updated_at": "2014-10-10T00:09:50Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cd3ff078a350901f91f4c4036be74f91d0b0d5d5", + "assignee": null, + "milestone": null, + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/commits", + "review_comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/comments", + "review_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/{number}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50/comments", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/05c588ba8cd510ecbe112d020f215facb17817a6", + "head": { + "label": "baxterthehacker:changes", + "ref": "changes", + "sha": "05c588ba8cd510ecbe112d020f215facb17817a6", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + } + }, + "base": { + "label": "baxterthehacker:master", + "ref": "master", + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "user": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50" + }, + "html": { + "href": "https://github.com/baxterthehacker/public-repo/pull/50" + }, + "issue": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50" + }, + "comments": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/issues/50/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/comments/{number}" + }, + "commits": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/50/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/05c588ba8cd510ecbe112d020f215facb17817a6" + } + } + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/push.payload.json b/lib/webhooks/push.payload.json new file mode 100644 index 0000000000..040a0573f9 --- /dev/null +++ b/lib/webhooks/push.payload.json @@ -0,0 +1,161 @@ +{ + "ref": "refs/heads/gh-pages", + "before": "4d2ab4e76d0d405d17d1a0f2b8a6071394e3ab40", + "after": "7700ca29dd050d9adacc0803f866d9b539513535", + "created": false, + "deleted": false, + "forced": false, + "base_ref": null, + "compare": "https://github.com/baxterthehacker/public-repo/compare/4d2ab4e76d0d...7700ca29dd05", + "commits": [ + { + "id": "7700ca29dd050d9adacc0803f866d9b539513535", + "distinct": true, + "message": "Trigger pages build", + "timestamp": "2014-10-09T17:10:36-07:00", + "url": "https://github.com/baxterthehacker/public-repo/commit/7700ca29dd050d9adacc0803f866d9b539513535", + "author": { + "name": "Kyle Daigle", + "email": "kyle.daigle@github.com", + "username": "kdaigle" + }, + "committer": { + "name": "Kyle Daigle", + "email": "kyle.daigle@github.com", + "username": "kdaigle" + }, + "added": [ + + ], + "removed": [ + + ], + "modified": [ + "index.html" + ] + } + ], + "head_commit": { + "id": "7700ca29dd050d9adacc0803f866d9b539513535", + "distinct": true, + "message": "Trigger pages build", + "timestamp": "2014-10-09T17:10:36-07:00", + "url": "https://github.com/baxterthehacker/public-repo/commit/7700ca29dd050d9adacc0803f866d9b539513535", + "author": { + "name": "Kyle Daigle", + "email": "kyle.daigle@github.com", + "username": "kdaigle" + }, + "committer": { + "name": "Kyle Daigle", + "email": "kyle.daigle@github.com", + "username": "kdaigle" + }, + "added": [ + + ], + "removed": [ + + ], + "modified": [ + "index.html" + ] + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com" + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://github.com/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": 1400625583, + "updated_at": "2014-07-25T16:37:51Z", + "pushed_at": 1412899789, + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 24, + "forks": 0, + "open_issues": 24, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master" + }, + "pusher": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/release.payload.json b/lib/webhooks/release.payload.json new file mode 100644 index 0000000000..2745fd6770 --- /dev/null +++ b/lib/webhooks/release.payload.json @@ -0,0 +1,148 @@ +{ + "action": "published", + "release": { + "url": "https://api.github.com/repos/baxterthehacker/public-repo/releases/616452", + "assets_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases/616452/assets", + "upload_url": "https://uploads.github.com/repos/baxterthehacker/public-repo/releases/616452/assets{?name}", + "html_url": "https://github.com/baxterthehacker/public-repo/releases/tag/0.0.1", + "id": 616452, + "tag_name": "0.0.1", + "target_commitish": "master", + "name": null, + "draft": false, + "author": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "prerelease": false, + "created_at": "2014-05-20T22:26:15Z", + "published_at": "2014-10-10T00:10:02Z", + "assets": [ + + ], + "tarball_url": "https://api.github.com/repos/baxterthehacker/public-repo/tarball/0.0.1", + "zipball_url": "https://api.github.com/repos/baxterthehacker/public-repo/zipball/0.0.1", + "body": null + }, + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/repository.payload.json b/lib/webhooks/repository.payload.json new file mode 100644 index 0000000000..d22386c3f2 --- /dev/null +++ b/lib/webhooks/repository.payload.json @@ -0,0 +1,119 @@ +{ + "action": "created", + "repository": { + "id": 27496774, + "name": "new-repository", + "full_name": "baxterandthehackers/new-repository", + "owner": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=3", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + }, + "private": true, + "html_url": "https://github.com/baxterandthehackers/new-repository", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterandthehackers/new-repository", + "forks_url": "https://api.github.com/repos/baxterandthehackers/new-repository/forks", + "keys_url": "https://api.github.com/repos/baxterandthehackers/new-repository/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterandthehackers/new-repository/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterandthehackers/new-repository/teams", + "hooks_url": "https://api.github.com/repos/baxterandthehackers/new-repository/hooks", + "issue_events_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterandthehackers/new-repository/events", + "assignees_url": "https://api.github.com/repos/baxterandthehackers/new-repository/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterandthehackers/new-repository/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterandthehackers/new-repository/tags", + "blobs_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterandthehackers/new-repository/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterandthehackers/new-repository/languages", + "stargazers_url": "https://api.github.com/repos/baxterandthehackers/new-repository/stargazers", + "contributors_url": "https://api.github.com/repos/baxterandthehackers/new-repository/contributors", + "subscribers_url": "https://api.github.com/repos/baxterandthehackers/new-repository/subscribers", + "subscription_url": "https://api.github.com/repos/baxterandthehackers/new-repository/subscription", + "commits_url": "https://api.github.com/repos/baxterandthehackers/new-repository/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterandthehackers/new-repository/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterandthehackers/new-repository/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterandthehackers/new-repository/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterandthehackers/new-repository/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterandthehackers/new-repository/merges", + "archive_url": "https://api.github.com/repos/baxterandthehackers/new-repository/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterandthehackers/new-repository/downloads", + "issues_url": "https://api.github.com/repos/baxterandthehackers/new-repository/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterandthehackers/new-repository/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterandthehackers/new-repository/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterandthehackers/new-repository/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterandthehackers/new-repository/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterandthehackers/new-repository/releases{/id}", + "created_at": "2014-12-03T16:39:25Z", + "updated_at": "2014-12-03T16:39:25Z", + "pushed_at": "2014-12-03T16:39:25Z", + "git_url": "git://github.com/baxterandthehackers/new-repository.git", + "ssh_url": "git@github.com:baxterandthehackers/new-repository.git", + "clone_url": "https://github.com/baxterandthehackers/new-repository.git", + "svn_url": "https://github.com/baxterandthehackers/new-repository", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "baxterandthehackers", + "id": 7649605, + "url": "https://api.github.com/orgs/baxterandthehackers", + "repos_url": "https://api.github.com/orgs/baxterandthehackers/repos", + "events_url": "https://api.github.com/orgs/baxterandthehackers/events", + "members_url": "https://api.github.com/orgs/baxterandthehackers/members{/member}", + "public_members_url": "https://api.github.com/orgs/baxterandthehackers/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/status.payload.json b/lib/webhooks/status.payload.json new file mode 100644 index 0000000000..f7b80146fc --- /dev/null +++ b/lib/webhooks/status.payload.json @@ -0,0 +1,206 @@ +{ + "id": 113293109, + "sha": "7b80eb100206a56523dbda6202d8e5daa05e265b", + "name": "baxterthehacker/public-repo", + "target_url": null, + "context": "default", + "description": null, + "state": "success", + "commit": { + "sha": "7b80eb100206a56523dbda6202d8e5daa05e265b", + "commit": { + "author": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "date": "2014-05-20T22:26:15Z" + }, + "committer": { + "name": "baxterthehacker", + "email": "baxterthehacker@users.noreply.github.com", + "date": "2014-05-20T22:26:15Z" + }, + "message": "Create README.md", + "tree": { + "sha": "aa81d3d185d48ac4eb935b57d9aa54e8eb0dcd9d", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees/aa81d3d185d48ac4eb935b57d9aa54e8eb0dcd9d" + }, + "url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits/7b80eb100206a56523dbda6202d8e5daa05e265b", + "comment_count": 25 + }, + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/7b80eb100206a56523dbda6202d8e5daa05e265b", + "html_url": "https://github.com/baxterthehacker/public-repo/commit/7b80eb100206a56523dbda6202d8e5daa05e265b", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/7b80eb100206a56523dbda6202d8e5daa05e265b/comments", + "author": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + + ] + }, + "branches": [ + { + "name": "master", + "commit": { + "sha": "69a8b72e2d3d955075d47f03d902929dcaf74033", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/69a8b72e2d3d955075d47f03d902929dcaf74033" + } + }, + { + "name": "changes", + "commit": { + "sha": "05c588ba8cd510ecbe112d020f215facb17817a6", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/05c588ba8cd510ecbe112d020f215facb17817a6" + } + }, + { + "name": "gh-pages", + "commit": { + "sha": "7700ca29dd050d9adacc0803f866d9b539513535", + "url": "https://api.github.com/repos/baxterthehacker/public-repo/commits/7700ca29dd050d9adacc0803f866d9b539513535" + } + } + ], + "created_at": "2014-10-10T00:10:03Z", + "updated_at": "2014-10-10T00:10:03Z", + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:53Z", + "pushed_at": "2014-10-10T00:10:02Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/lib/webhooks/team_add.payload.json b/lib/webhooks/team_add.payload.json new file mode 100644 index 0000000000..6ee2ea6549 --- /dev/null +++ b/lib/webhooks/team_add.payload.json @@ -0,0 +1,127 @@ +{ + "team": { + "name": "github", + "id": 836012, + "slug": "github", + "permission": "pull", + "url": "https://api.github.com/teams/836012", + "members_url": "https://api.github.com/teams/836012/members{/member}", + "repositories_url": "https://api.github.com/teams/836012/repos" + }, + "repository": { + "id": 25013628, + "name": "public-repo", + "full_name": "baxterandthehackers/public-repo", + "owner": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterandthehackers/public-repo", + "description": "", + "fork": true, + "url": "https://api.github.com/repos/baxterandthehackers/public-repo", + "forks_url": "https://api.github.com/repos/baxterandthehackers/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterandthehackers/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterandthehackers/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterandthehackers/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterandthehackers/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterandthehackers/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterandthehackers/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterandthehackers/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterandthehackers/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterandthehackers/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterandthehackers/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterandthehackers/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterandthehackers/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterandthehackers/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterandthehackers/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterandthehackers/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterandthehackers/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterandthehackers/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterandthehackers/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterandthehackers/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterandthehackers/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterandthehackers/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterandthehackers/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterandthehackers/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterandthehackers/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterandthehackers/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterandthehackers/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterandthehackers/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterandthehackers/public-repo/releases{/id}", + "created_at": "2014-10-10T00:09:53Z", + "updated_at": "2014-10-10T00:10:01Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterandthehackers/public-repo.git", + "ssh_url": "git@github.com:baxterandthehackers/public-repo.git", + "clone_url": "https://github.com/baxterandthehackers/public-repo.git", + "svn_url": "https://github.com/baxterandthehackers/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + }, + "organization": { + "login": "baxterandthehackers", + "id": 7649605, + "url": "https://api.github.com/orgs/baxterandthehackers", + "repos_url": "https://api.github.com/orgs/baxterandthehackers/repos", + "events_url": "https://api.github.com/orgs/baxterandthehackers/events", + "members_url": "https://api.github.com/orgs/baxterandthehackers/members{/member}", + "public_members_url": "https://api.github.com/orgs/baxterandthehackers/public_members{/member}", + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2" + }, + "sender": { + "login": "baxterandthehackers", + "id": 7649605, + "avatar_url": "https://avatars.githubusercontent.com/u/7649605?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterandthehackers", + "html_url": "https://github.com/baxterandthehackers", + "followers_url": "https://api.github.com/users/baxterandthehackers/followers", + "following_url": "https://api.github.com/users/baxterandthehackers/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterandthehackers/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterandthehackers/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterandthehackers/subscriptions", + "organizations_url": "https://api.github.com/users/baxterandthehackers/orgs", + "repos_url": "https://api.github.com/users/baxterandthehackers/repos", + "events_url": "https://api.github.com/users/baxterandthehackers/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterandthehackers/received_events", + "type": "Organization", + "site_admin": false + } +} diff --git a/lib/webhooks/watch.payload.json b/lib/webhooks/watch.payload.json new file mode 100644 index 0000000000..4e4ccd6795 --- /dev/null +++ b/lib/webhooks/watch.payload.json @@ -0,0 +1,109 @@ +{ + "action": "started", + "repository": { + "id": 20000106, + "name": "public-repo", + "full_name": "baxterthehacker/public-repo", + "owner": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/baxterthehacker/public-repo", + "description": "", + "fork": false, + "url": "https://api.github.com/repos/baxterthehacker/public-repo", + "forks_url": "https://api.github.com/repos/baxterthehacker/public-repo/forks", + "keys_url": "https://api.github.com/repos/baxterthehacker/public-repo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/baxterthehacker/public-repo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/baxterthehacker/public-repo/teams", + "hooks_url": "https://api.github.com/repos/baxterthehacker/public-repo/hooks", + "issue_events_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/events{/number}", + "events_url": "https://api.github.com/repos/baxterthehacker/public-repo/events", + "assignees_url": "https://api.github.com/repos/baxterthehacker/public-repo/assignees{/user}", + "branches_url": "https://api.github.com/repos/baxterthehacker/public-repo/branches{/branch}", + "tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/tags", + "blobs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/baxterthehacker/public-repo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/baxterthehacker/public-repo/languages", + "stargazers_url": "https://api.github.com/repos/baxterthehacker/public-repo/stargazers", + "contributors_url": "https://api.github.com/repos/baxterthehacker/public-repo/contributors", + "subscribers_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscribers", + "subscription_url": "https://api.github.com/repos/baxterthehacker/public-repo/subscription", + "commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/baxterthehacker/public-repo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/baxterthehacker/public-repo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/comments/{number}", + "contents_url": "https://api.github.com/repos/baxterthehacker/public-repo/contents/{+path}", + "compare_url": "https://api.github.com/repos/baxterthehacker/public-repo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/baxterthehacker/public-repo/merges", + "archive_url": "https://api.github.com/repos/baxterthehacker/public-repo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/baxterthehacker/public-repo/downloads", + "issues_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues{/number}", + "pulls_url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/baxterthehacker/public-repo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/baxterthehacker/public-repo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/baxterthehacker/public-repo/labels{/name}", + "releases_url": "https://api.github.com/repos/baxterthehacker/public-repo/releases{/id}", + "created_at": "2014-05-20T22:39:43Z", + "updated_at": "2014-10-10T00:09:52Z", + "pushed_at": "2014-10-10T00:09:49Z", + "git_url": "git://github.com/baxterthehacker/public-repo.git", + "ssh_url": "git@github.com:baxterthehacker/public-repo.git", + "clone_url": "https://github.com/baxterthehacker/public-repo.git", + "svn_url": "https://github.com/baxterthehacker/public-repo", + "homepage": null, + "size": 665, + "stargazers_count": 1, + "watchers_count": 1, + "language": null, + "has_issues": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 26, + "forks": 0, + "open_issues": 26, + "watchers": 1, + "default_branch": "master" + }, + "sender": { + "login": "baxterthehacker", + "id": 6752317, + "avatar_url": "https://avatars.githubusercontent.com/u/6752317?v=2", + "gravatar_id": "", + "url": "https://api.github.com/users/baxterthehacker", + "html_url": "https://github.com/baxterthehacker", + "followers_url": "https://api.github.com/users/baxterthehacker/followers", + "following_url": "https://api.github.com/users/baxterthehacker/following{/other_user}", + "gists_url": "https://api.github.com/users/baxterthehacker/gists{/gist_id}", + "starred_url": "https://api.github.com/users/baxterthehacker/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/baxterthehacker/subscriptions", + "organizations_url": "https://api.github.com/users/baxterthehacker/orgs", + "repos_url": "https://api.github.com/users/baxterthehacker/repos", + "events_url": "https://api.github.com/users/baxterthehacker/events{/privacy}", + "received_events_url": "https://api.github.com/users/baxterthehacker/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/libraries/index.html b/libraries/index.html deleted file mode 100644 index 424d3085b7..0000000000 --- a/libraries/index.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - Libraries | GitHub API - - - - - - - - - - - -
- -
- - - -
-
-

Octokit comes in
-many flavors

-

Use the official Octokit library, or choose between any of the available third party libraries.

- - -
- -

Third-party libraries

- -

.NET

- - - -

ActionScript

- - - -

Clojure

- - - -

Emacs Lisp

- - - -

Erlang

- - - -

Go

- - - -

Haskell

- - - -

Java

- - - -

JavaScript

- - - -

Objective-C

- - - -

OCaml

- - - -

Perl

- - - -

PHP

- - - -

Python

- - - -

Ruby

- - - -

Scala

- - - - -
- - - - - - - - diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 0000000000..28212106b8 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e +export CC=gcc + +command -v bundle >/dev/null 2>&1 || { echo >&2 "Bundler required but not found: gem install bundler"; exit 1; } + +echo "==> Installing gem dependencies…" +bundle check --path vendor/gems 2>&1 > /dev/null || { + bundle install --binstubs bin --path vendor/gems --quiet +} diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 0000000000..77d2b0195e --- /dev/null +++ b/script/cibuild @@ -0,0 +1,30 @@ +#!/bin/sh +# Usage: script/cibuild +# CI build script +# +set -e + +# GC customizations +export RUBY_GC_MALLOC_LIMIT=79000000 +export RUBY_HEAP_MIN_SLOTS=800000 +export RUBY_HEAP_FREE_MIN=100000 +export RUBY_HEAP_SLOTS_INCREMENT=400000 +export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 + +export PATH="/usr/share/rbenv/shims:$PATH" +export RACK_ROOT=$(cd "$(dirname $0)"/.. && pwd) +export RACK_ENV="test" +export RAILS_ENV="test" +export RBENV_VERSION="1.9.3-p194" + +# clean out the ruby environment +export RUBYLIB= +export RUBYOPT= + +# bootstrap gem environment changes +cd "$RACK_ROOT" +echo 'Bootstrapping gems...' +script/bootstrap + +echo "==> Running tests…" +bundle exec rake test diff --git a/script/console b/script/console new file mode 100644 index 0000000000..c0d5327d48 --- /dev/null +++ b/script/console @@ -0,0 +1,5 @@ +#!/bin/sh + +script/bootstrap + +bundle console diff --git a/script/enterprise-backport b/script/enterprise-backport new file mode 100755 index 0000000000..f647287285 --- /dev/null +++ b/script/enterprise-backport @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby + +# Occasionally, a change made to the latest version of the Enterprise API documentation +# will need to be backported to the previous verison. This script takes the latest content +# for /enterprise and moves it into the appropriate version folder. + +require 'tmpdir' + +if ARGV.length != 1 + error = '''Error: Run the script like this: bundle exec script/enterprise-backport [VERSION] +e.g. bundle exec script/enterprise-cutter 2.0 +''' + abort error +end + +VERSION = ARGV[0].dup # like, 11.10.340 + +BRANCH_NAME = "backport-docs-for-#{VERSION}" + +Dir.glob('tasks/*.rake').each { |r| load r } + +setup + +temp_dir = Dir.mktmpdir +begin + `cp -r v3/enterprise enterprise/#{VERSION}/v3/` + + rewrite_content("enterprise/#{VERSION}/v3/enterprise") + + `git add enterprise` + `git commit -m "Added enterprise-#{VERSION} backported files"` +ensure + FileUtils.remove_entry_secure temp_dir +end + +puts "\n\nOkay! Feel free to `git push #{BRANCH_NAME}` if you like." diff --git a/script/enterprise-cutter b/script/enterprise-cutter new file mode 100755 index 0000000000..f224f57f82 --- /dev/null +++ b/script/enterprise-cutter @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby + +# When releasing a new Enterprise version, the set of GitHub APIs available to that +# verison do not match the set of documentation generally available on developer.github.com. +# That's because the content on developer.github.com represents everything available to DotCom +# users; since Enterprise is a "managed" product, it's cut off of DotCom at a certain +# time, and the APIs remain frozen (until an organization upgrades their instance). +# +# This script takes two arguments: a date and a version number. Given a date, it +# fetches the state of the site at that moment in time. It then copies all of that +# content into a new folder called *enterprise/*. Thus, we're able to preserve +# the state of the API documentation for a given version at a given time. + +require 'fileutils' +require 'tmpdir' + +if ARGV.length != 2 + error = '''Error: Run the script like this: bundle exec script/enterprise-cutter [DATE] [VERSION] +e.g. bundle exec script/enterprise-cutter 2014-07-08 11.10.340 +''' + abort error +end + +DATE = ARGV[0].dup # yyyy-mm-dd, like, 2014-07-08 +VERSION = ARGV[1].dup # like, 11.10.340 + +BRANCH_NAME = "add-#{VERSION}-docs" + +Dir.glob('tasks/*.rake').each { |r| load r } + +setup + +temp_dir = Dir.mktmpdir +begin + %x(git checkout `git rev-list -n 1 --before="#{DATE}" gh-pages`) + `cp -r * #{temp_dir}` + `git checkout #{BRANCH_NAME}` + FileUtils.mkdir_p("enterprise/#{VERSION}") + `cp -r #{temp_dir}/* enterprise/#{VERSION}` + + rewrite_content("enterprise/#{VERSION}") + + `rm -rf enterprise/#{VERSION}/enterprise` + `rm -rf enterprise/#{VERSION}/output` + `git add enterprise` + `git commit -m "Added enterprise-#{VERSION} files"` +ensure + FileUtils.remove_entry_secure temp_dir +end + +puts "\n\nOkay! Feel free to `git push #{BRANCH_NAME}` if you like." \ No newline at end of file diff --git a/script/server b/script/server new file mode 100755 index 0000000000..d960a557c6 --- /dev/null +++ b/script/server @@ -0,0 +1,12 @@ +#!/bin/sh + +echo "" +echo "" +echo "*********************************************************************" +echo "****** Starting guard. In another window, run adsf -r output *******" +echo "************* Yes, really: http://git.io/GFd6UQ *********************" +echo "*********************************************************************" +echo "" +echo "" + +bundle exec guard diff --git a/shared/css/octicons-regular-webfont.eot b/shared/css/octicons-regular-webfont.eot deleted file mode 100755 index d036926116..0000000000 Binary files a/shared/css/octicons-regular-webfont.eot and /dev/null differ diff --git a/shared/css/octicons-regular-webfont.svg b/shared/css/octicons-regular-webfont.svg deleted file mode 100755 index 04a1bbdf4f..0000000000 --- a/shared/css/octicons-regular-webfont.svg +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/shared/css/octicons-regular-webfont.ttf b/shared/css/octicons-regular-webfont.ttf deleted file mode 100755 index 9d9dc3cb2c..0000000000 Binary files a/shared/css/octicons-regular-webfont.ttf and /dev/null differ diff --git a/shared/css/octicons-regular-webfont.woff b/shared/css/octicons-regular-webfont.woff deleted file mode 100755 index 2ba436bd5b..0000000000 Binary files a/shared/css/octicons-regular-webfont.woff and /dev/null differ diff --git a/shared/images/active-arrow.png b/shared/images/active-arrow.png deleted file mode 100644 index 685fcf9f98..0000000000 Binary files a/shared/images/active-arrow.png and /dev/null differ diff --git a/shared/images/crud-sprite.png b/shared/images/crud-sprite.png deleted file mode 100644 index cc31b49075..0000000000 Binary files a/shared/images/crud-sprite.png and /dev/null differ diff --git a/shared/images/dropdown_sprites.jpg b/shared/images/dropdown_sprites.jpg deleted file mode 100644 index b6a74d6f4e..0000000000 Binary files a/shared/images/dropdown_sprites.jpg and /dev/null differ diff --git a/shared/images/labtocat.png b/shared/images/labtocat.png deleted file mode 100644 index 501ca0bbe9..0000000000 Binary files a/shared/images/labtocat.png and /dev/null differ diff --git a/shared/images/labtocat@2x.png b/shared/images/labtocat@2x.png deleted file mode 100644 index d09881e40d..0000000000 Binary files a/shared/images/labtocat@2x.png and /dev/null differ diff --git a/shared/images/nav-rule.png b/shared/images/nav-rule.png deleted file mode 100644 index f97c91b383..0000000000 Binary files a/shared/images/nav-rule.png and /dev/null differ diff --git a/shared/images/next_step_arrow.gif b/shared/images/next_step_arrow.gif deleted file mode 100644 index 025ffaad09..0000000000 Binary files a/shared/images/next_step_arrow.gif and /dev/null differ diff --git a/shared/images/qmark.png b/shared/images/qmark.png deleted file mode 100644 index 510798bd12..0000000000 Binary files a/shared/images/qmark.png and /dev/null differ diff --git a/shared/images/rackspace_logo.png b/shared/images/rackspace_logo.png deleted file mode 100644 index f3b73f1f05..0000000000 Binary files a/shared/images/rackspace_logo.png and /dev/null differ diff --git a/static/css/Octicons LICENSE b/static/css/Octicons LICENSE new file mode 100755 index 0000000000..05ab2c897a --- /dev/null +++ b/static/css/Octicons LICENSE @@ -0,0 +1,7 @@ +(c) 2012-2014 GitHub + +Font License: SIL OFL 1.1 (http://scripts.sil.org/OFL) +Applies to all font files + +Code License: MIT (http://choosealicense.com/licenses/mit/) +Applies to all other files diff --git a/shared/css/documentation.css b/static/css/documentation.css similarity index 57% rename from shared/css/documentation.css rename to static/css/documentation.css index ad61a96c1c..b858fd6d86 100644 --- a/shared/css/documentation.css +++ b/static/css/documentation.css @@ -1,64 +1,13 @@ -@font-face { - font-family: 'octiconsregular'; - src: url('octicons-regular-webfont.eot'); - src: url('octicons-regular-webfont.eot?#iefix') format('embedded-opentype'), - url('octicons-regular-webfont.woff') format('woff'), - url('octicons-regular-webfont.svg#octiconsregular') format('svg'); - font-weight: normal; - font-style: normal; -} - -/*------------------------------------------------------------------------------ - Icon Styles -------------------------------------------------------------------------------*/ - -.mega-icon { - font-family: 'octiconsregular'; - font-weight: normal; - font-style: normal; - display: inline-block; - text-decoration: none; - line-height: 1; - -webkit-font-smoothing: antialiased; - font-size: 24px; - width: 24px; - height: 24px; -} - -.mega-icon-invertocat:before { - content: "\f00a"; -} - -.octicon-calendar:before { - content: "\f068"; -} - -.octicon { - font: normal normal 16px "octiconsregular"; - line-height: 1; - display: inline-block; - text-decoration: none; - -webkit-font-smoothing: antialiased; -} - -/* end */ +@import 'octicons.css'; /*------------------------------------------------------------------------------ Global Documentation Styles ------------------------------------------------------------------------------*/ -html { - height:100%; -} - body { - font: 13px helvetica,arial,freesans,clean,sans-serif; - line-height: 1.4em; + font: 13px/1.4em "Helvetica Neue", arial,freesans,clean,sans-serif; background-color: #fff; color: #393939; - margin: 0px; - padding: 0px; - height: 100%; } p { @@ -72,12 +21,17 @@ h1 { font-weight: normal; } +body:not(.enterprise) .enterprise-only { + display: none; +} + .content h1 { - font-weight: 300; - -webkit-backface-visibility: hidden; - font-size: 36px; - margin: 0em 0 0.5em; - position: relative; + font-weight: 300; + -webkit-backface-visibility: hidden; + font-size: 36px; + margin: 0em 0 0.5em; + position: relative; + line-height: 30px; } .header-anchor { @@ -88,14 +42,14 @@ h1 { padding: 0 5px 0 10px; height: 100%; width: 20px; - font: normal normal 16px/20px octiconsregular; + font: normal normal 16px/20px octicons; color: #000; -webkit-font-smoothing: antialiased; color: #333; -webkit-transition: opacity 0.3s ease-in-out 0s; -moz-transition: opacity 0.3s ease-in-out 0s; - -ms-transition: opacity 0.3s ease-in-out 0s; + transition: opacity 0.3s ease-in-out 0s; } h1 .header-anchor { @@ -112,55 +66,45 @@ h1 .header-anchor { } h2 { - font-size: 16px; + font-size: 22px; color: #333; margin: 2em auto 1em; position: relative; + font-weight: 300; } .library-list h1 { - margin: 20px 0 20px; - padding: 20px 0 20px; + margin: 20px 0 20px; + padding: 20px 0 20px; } .library-list h2 { - margin-bottom: -17px; - margin-left: 0px; - font-size: 16px; - max-width: 190px; + margin-bottom: -17px; + margin-left: 0px; + font-size: 16px; + max-width: 190px; } .library-list ul { - margin-bottom: 40px; + margin-bottom: 40px; + list-style: none; } .library-list ul li { - padding-left: 200px; - padding-right: 200px; - list-style: none; - font-size: 14px; -} - -body.api .content h2 { - margin-bottom: 1em; - margin-top: 2em; - font-size: 22px; - font-weight: 300; + padding-left: 200px; + padding-right: 200px; + font-size: 14px; } .change h2, .sidebar-shell h2 { - font-weight: 300; - font-size: 22px; - margin: 1.2em 0 1em; + margin: 1.2em 0 1em; } -.change h2.title { - background: none; +.change > .title { line-height: 1.4em; margin: 1.2em 0 0px; padding-left: 0; font-size: 30px; - font-weight: 300; } h2 span.step { @@ -175,6 +119,7 @@ h3 { } h4 { + margin: 1em 0; position: relative; } @@ -202,12 +147,6 @@ blockquote { padding: 0px 20px; } -ul, -ol { - margin: 0px; - padding: 0px; -} - dt { font-weight: bold; } @@ -221,39 +160,33 @@ dd + dd { margin-bottom: 0; } -span.attention, -p.attention { - color: #e98400; - font-style: italic; -} - a img { border: 0px; } .button, .button-secondary { - background-color: #297fc7; - color: #fff; - font-size: 16px; - padding: 15px; - border-radius: 5px; + background-color: #297fc7; + color: #fff; + font-size: 16px; + padding: 15px; + border-radius: 5px; } .button:hover { - text-decoration: none; - background-color: #3088d0; + text-decoration: none; + background-color: #3088d0; } .button-secondary { - background-color: #738797; - font-size: 15px; - padding: 12px; + background-color: #738797; + font-size: 15px; + padding: 12px; -webkit-backface-visibility: hidden; } .button-secondary:hover { - text-decoration: none; - background-color: #7e909e; + text-decoration: none; + background-color: #7e909e; } .rss-subscribe { @@ -298,35 +231,36 @@ a img { } #header .nav { - position: absolute; - right: 0; - top: 20px; + float: right; font-weight: bold; + margin-top: 20px; text-shadow: white 1px 1px 0px; font-size: 14px; } #header .nav li { - display: inline-block; + display: inline-block; margin: 0; list-style-type: none; line-height: 1.4em; } #header .nav a { - color: #515151; + color: #515151; outline: none; text-decoration: none; padding: 20px 11px 19px; -webkit-transition: color 0.2s ease-in-out 0s; -moz-transition: color 0.2s ease-in-out 0s; - -ms-transition: color 0.2s ease-in-out 0s; transition: color 0.2s ease-in-out 0s; } -.overview #header .nav-overview, .api #header .nav-api, .blog #header .nav-blog { - color: #333; - border-bottom: 3px solid #c9c9c9; +.overview #header .nav-overview, +.api #header .nav-api, +.blog #header .nav-blog, +.developers #header .nav-developers { + color: #333; + border-bottom: 3px solid #c9c9c9; } #header .nav a:hover { @@ -350,11 +284,10 @@ a img { margin-top: -4px; width: 51px; border-radius: 3px; - background: url(/shared/images/search.png) 5px center no-repeat #fff; + background: url(/images/search.png) 5px center no-repeat #fff; -webkit-transition: width 0.3s ease-in-out 0s; -moz-transition: width 0.3s ease-in-out 0s; - -ms-transition: width 0.3s ease-in-out 0s; transition: width 0.3s ease-in-out 0s; } @@ -386,7 +319,6 @@ a img { -webkit-transition: opacity 0.3s ease-in-out 0s; -moz-appearance-transition: opacity 0.3s ease-in-out 0s; - -ms-transition: opacity 0.3s ease-in-out 0s; transition: opacity 0.3s ease-in-out 0s; } @@ -394,7 +326,7 @@ a img { position: absolute; right: 4px; top: 2px; - background: url(/shared/images/cancel.png) 0 0 no-repeat; + background: url(/images/cancel.png) 0 0 no-repeat; width: 14px; height: 14px; display: none; @@ -424,7 +356,6 @@ a img { opacity: 1; -webkit-transition: opacity 0.3s ease-in-out 0s; -moz-transition: opacity 0.3s ease-in-out 0s; - -ms-transition: opacity 0.3s ease-in-out 0s; transition: opacity 0.3s ease-in-out 0s; } @@ -465,7 +396,7 @@ a img { } .result:hover, .result.selected { - background-color: #297fc7 !important; + background-color: #297fc7 !important; } .result:hover em, .result.selected em, .result:hover small, .result.selected small { @@ -481,61 +412,58 @@ a img { ------------------------------------------------------------------------------*/ .sub-nav { - max-width: 980px; - margin: 0 auto; - position: relative; - border-bottom: 1px solid #d8d8d8; + max-width: 980px; + margin: 0 auto; + position: relative; + border-bottom: 1px solid #d8d8d8; } -.sub-nav h2, .sub-nav h2 a { - color: #333; - font-weight: normal; - font-size: 22px; - -webkit-backface-visibility: hidden; - margin: 50px 0 10px 0; - text-decoration: none; +.sub-nav > h2, .sub-nav > h2 > a { + color: #333; + font-weight: normal; + font-size: 22px; + -webkit-backface-visibility: hidden; + margin: 50px 0 10px 0; + text-decoration: none; } -.sub-nav h2 a { +.sub-nav > h2 > a { z-index: 10; position: relative; } -.sub-nav li a:hover { - text-decoration: none; -} - .sub-nav ul { - list-style: none; - position: absolute; - right: 0; - bottom: 8px; - width: 100%; - text-align: right; + list-style: none; + position: absolute; + right: 0; + bottom: 8px; + width: 100%; + text-align: right; } .sub-nav li { - display: inline-block; + display: inline-block; } .sub-nav li a { - color: #767676; - font-size: 14px; - margin-left: 16px; - padding: 4px 2px 8px; + color: #767676; + font-size: 14px; + margin-left: 16px; + padding: 4px 2px 8px; } -.sub-nav li:last-child a { - padding-right: 0; +.sub-nav li a:hover { + text-decoration: none; + color: #327fc7; } -.sub-nav li a.active { - color: #222; - border-bottom: 2px solid #d8d8d8; +.sub-nav li:last-child a { + padding-right: 0; } -.sub-nav li a:hover { - color: #327fc7; +.sub-nav li .active { + color: #222; + border-bottom: 2px solid #d8d8d8; } /*------------------------------------------------------------------------------ @@ -543,96 +471,102 @@ a img { ------------------------------------------------------------------------------*/ .wrapper { - max-width: 980px; - margin: 0 auto; + max-width: 980px; + margin: 0 auto; } .wrapper:before, .wrapper:after { - content: " "; + content: " "; } .wrapper:after { - clear: both; + clear: both; } .wrapper.blog { - display: table; + display: table; } .feature { - position: relative; - height: 455px; - overflow: hidden; - border-bottom: 1px solid #ddd; + position: relative; + height: 420px; } .feature h1, .library-list .feature h1 { - border: none; - font-weight: 300; - font-size: 42px; - line-height: 1.2em; - -webkit-backface-visibility: hidden; - padding: 0; - margin: 86px 0 0 0; - text-align: left; + font-weight: 300; + font-size: 42px; + line-height: 1.2em; + -webkit-backface-visibility: hidden; + padding: 80px 0 0 0; + margin: 0; + text-align: left; } -.library-list .feature h1 { - margin-top: 60px; +.library-list .feature { + overflow: hidden; + border-bottom: 1px solid #ddd; + padding-bottom: 40px; } .feature .intro { - color: #666666; - font-size: 18px; - line-height: 1.5em; - max-width: 400px; + color: #666; + font-size: 18px; + line-height: 1.5em; + max-width: 400px; } .feature .button, .highlights .button-secondary { - display: inline-block; + display: inline-block; +} + +.feature .electrocat { + position: absolute; + right: 0; + top: 45px; } -.feature .labtocat { - position: absolute; - right: 0; - top: 30px; +.feature .rocketship { + position: absolute; + right: -50px; + top: 30px; + z-index: -1; } .feature .gundamcat { - position: absolute; - right: 0; - top: 50px; + position: absolute; + right: 0; + top: 50px; } .feature .library-links { - line-height: 40px; - margin-top: 25px; + line-height: 40px; + margin-top: 25px; } .feature .library-links li { - padding: 0; - font-size: 22px; + padding: 0; + font-size: 22px; } .feature .library-links span { - width: 60px; - text-align: right; - padding-right: 10px; - display: inline-block; + width: 60px; + text-align: right; + padding-right: 10px; + display: inline-block; } .feature + .full-width-divider { - margin-top: -1px; + margin-top: -1px; } .full-width-divider { - width: 100%; - background: #f2f2f2; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - overflow: hidden; - z-index: 1; - position: relative; + width: 100%; + background: #f2f2f2; + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + overflow: hidden; + z-index: 1; + position: relative; } .octicon-mail-read:before { @@ -648,44 +582,44 @@ a img { } .highlight-module { - list-style-type: none; - display: table-cell; - padding: 40px 14px 30px; - text-align: center; - margin-top: 10px; - font-size: 14px; - line-height: 1.5em; + list-style-type: none; + display: table-cell; + padding: 40px 14px 30px; + text-align: center; + margin-top: 10px; + font-size: 14px; + line-height: 1.5em; } .highlight-module:first-child { - padding-left: 0; - padding-right: 14px; + padding-left: 0; + padding-right: 14px; } .highlight-module:last-child { - padding-left: 14px; - padding-right: 0; + padding-left: 14px; + padding-right: 0; } -.highlight-module .mega-icon { +.highlight-module .mega-octicon { font-size: 70px; width: 70px; height: 70px; } .highlights h2 { - margin: 30px 0 15px; - font-size: 30px; - font-weight: 300; - -webkit-backface-visibility: hidden; + margin: 25px 0 15px; + font-size: 30px; + line-height: 1.2; + -webkit-backface-visibility: hidden; } -a .mega-icon { +a .mega-octicon { color: #333; } .full-width-divider + #footer { - margin-top: -1px; + margin-top: -1px; } /*------------------------------------------------------------------------------ @@ -696,13 +630,12 @@ a .mega-icon { position: relative; float: right; margin: 20px 0 0; - width: 280px; + width: 290px; } .sidebar-module { border-radius: 4px; overflow: hidden; - display: block; margin-bottom: 20px; font-size: 12px; border: 1px solid #ddd; @@ -719,9 +652,9 @@ a .mega-icon { line-height: 1.5em; } -.sidebar-module.notice p { +.notice > p { padding: 12px; - margin: 0; + margin: 0; } .sidebar-module li { @@ -736,14 +669,14 @@ a .mega-icon { border-top: 1px solid #eee; } -.sidebar-module ul h3, .headlines li { +.sidebar-module ul h3, .headlines > li { margin: 0px; color: #666; border-bottom: 1px solid #eee; font-size: 14px; } -.headlines li a { +.headlines > li > a { color: #333; display: block; padding: 10px 10px; @@ -752,35 +685,25 @@ a .mega-icon { font-weight: 300; } -.headlines a .date { +.headlines > li > a:hover { + color: #327fc7; +} + +.headlines > li > a > .date { font-weight: normal; font-size: 12px; color: #888; } -.headlines li a:hover { - color: #327fc7; -} - .headlines li:hover { background-color: #fdfdfd; } -.sidebar-module h3 a, -.sidebar-module h3.disable span { - padding-top: 8px; - padding-bottom: 8px; - padding-left: 10px; +.sidebar-module h3 a { + padding: 8px 10px 8px 10px; color: #555; text-decoration: none; -} - -.sidebar-module h3.disable span { - padding-left: 20px; - background-image: url(../images/active-arrow.png); - background-position: left center; - background-repeat: no-repeat; - cursor: default; + display: block; } .sidebar-module h3 a:hover { @@ -789,35 +712,28 @@ a .mega-icon { background-color: #fdfdfd; } -div.sidebar-module ul ul, -div.sidebar-module .spacer { - display: block; -} - -div.sidebar-module ul ul li { +.sidebar-module ul ul li { border-bottom: 1px solid #eee; font-weight: bold; color: #666; - background-color: #f9f9f9; + background-color: #f9f9f9; } .sidebar-module ul li:last-child ul li:last-child { border-bottom: none; } -div.sidebar-module li.disable a { +.sidebar-module .disable > a { color: #333; border-left: 2px solid #d8d8d8; padding-left: 29px; } -.sidebar-module ul ul li a, -.sidebar-module ul ul li span { +.sidebar-module ul ul li a { padding: 6px 0px 6px 31px; display: block; text-decoration: none; font-weight: normal; - color: #777; } .sidebar-module ul ul li a:hover { @@ -825,12 +741,6 @@ div.sidebar-module li.disable a { color: #327fc7; } -div.sidebar-module ul ul li span { - padding-left: 20px; - cursor: default; -} - -/* @end */ /*****************************************************************************/ /* @@ -839,14 +749,14 @@ div.sidebar-module ul ul li span { /*****************************************************************************/ .api-status { - text-align: center; - padding: 20px 0; - border-top: 1px solid #ddd; - font-size: 14px; + text-align: center; + padding: 20px 0; + border-top: 1px solid #ddd; + font-size: 14px; } .api-status a { - color: #999; + color: #999; background-position: center bottom; background-repeat: no-repeat; padding-bottom: 40px; @@ -858,25 +768,23 @@ div.sidebar-module ul ul li span { } .api-status .good { + color: #227b41; background-image: url(/images/status-icon-good.png); } .api-status .minor { + color: #ed8b3f; background-image: url(/images/status-icon-minor.png); } .api-status .major { + color: #ad1a05; background-image: url(/images/status-icon-major.png); } .api-status a:hover { - text-decoration: none; - color: #327fc7; -} - -.api-status img { - display: block; - margin: 6px auto 0; + text-decoration: none; + color: #327fc7; } #footer { @@ -886,24 +794,25 @@ div.sidebar-module ul ul li span { color: #636363; margin: 0 auto; max-width: 980px; + clear: both; } #footer a:hover { text-decoration: underline; } -#footer .mega-icon { +#footer .mega-octicon { color: #ccc; + font-size: 24px; } -#footer .mega-icon:hover { +#footer .mega-octicon:hover { color: #bbb; text-decoration: none; } .lower_footer { border-top: 1px solid #ddd; - width: 100%; padding: 30px 0; } @@ -937,8 +846,75 @@ div.sidebar-module ul ul li span { #footer .wrapper { border-top: 1px solid #ddd; - text-align: center; - padding: 20px 0; + text-align: center; + padding: 20px 0; +} + +/* end */ + +/*------------------------------------------------------------------------------ + Dev Program +------------------------------------------------------------------------------*/ +.dev-program.feature { + height: 420px; + margin-top: -2px; + position: relative; +} + +.dev-program.feature, +.dev-program-callout { + background: #160625; +} + +.dev-program.feature .intro { + font-size: 20px; + line-height: 1.5em; + max-width: 500px; +} + +.dev-program.feature h1 { + width: 600px; +} + +.dev-program.feature .earth { + margin-top: -187px; + position: absolute; + right: 5%; + top: 50%; + z-index: 0; +} + +.dev-program.feature .earth-short-loop { + display: none; +} + +.dev-program.feature .wrapper { + position: relative; + z-index: 1; +} + +.dev-program-callout .wrapper { + padding: 40px 0; + background: #160625 url(/images/callout-earth-static.png) no-repeat top right / 30%; +} + +.dev-program.feature h1, +.dev-program-callout h2 { + color: #eee; +} + +.dev-program.feature .intro, +.dev-program-callout p { + color: #a397ad; +} + +.dev-program-callout h2 { + margin: 0; +} + +.dev-program-callout p { + font-size: 16px; + margin: 10px 0 0; } /* end */ @@ -954,12 +930,12 @@ div.sidebar-module ul ul li span { } #wrapper:after, #wrapper:before { - content: " "; - display: table; + content: " "; + display: table; } #wrapper:after { - clear: both; + clear: both; } .content { @@ -973,7 +949,7 @@ div.sidebar-module ul ul li span { } .blog .content { - margin-bottom: 60px; + margin-bottom: 60px; } .content dt { @@ -994,7 +970,7 @@ div.sidebar-module ul ul li span { } .content li { - line-height: 1.7em; + margin: 0.5em 0; } .content img { @@ -1002,6 +978,80 @@ div.sidebar-module ul ul li span { margin: 12px 0; } +/* Taken from Help in order to show images in ordered lists inline */ +ol { + counter-reset: li; + list-style: none; + position: relative; + padding-bottom: 10px; +} +ol > li { + padding: 5px 0 5px 55px; + position: relative; + margin-bottom: 5px; +} +ol > li:before { + content: counter(li); + counter-increment: li; + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 30px; + padding: 0 10px 0 0; + color: #999; + font-size: 22px; + font-weight: bold; + line-height: 35px; + text-align: right; + border-right: 1px solid #ddd; +} +ol > li > p:first-child { + margin-top: 0; +} +ol > li:after { + content: "."; + display: block; + clear: both; + visibility: hidden; + line-height: 0; + height: 0; +} +.content ol > li img { + max-width: 100px; + margin: 0 0 0 10px; + float: right; + border: 1px solid #ddd; + cursor: pointer; +} +.content ol > li img.expanded { + max-width: 400px; +} + +.content .full-image { + position: absolute; + top: 5px; + right: -20px; + z-index: 100; +} +.content .full-image img { + position: absolute; + top: 0; + right: 20px; + margin: 0; + max-width: 600px; + box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); +} +.content .full-image:hover .octicon, .full-image:hover .mini-icon { + color: #666; +} +.content .full-image .octicon, .full-image .octicon-remove-close { + position: absolute; + top: 0px; + right: 0px; + color: #999; + cursor: pointer; +} .content .description { margin-left: 20px; @@ -1017,13 +1067,7 @@ div.sidebar-module ul ul li span { .content dl code, .content ul code, p code { - font: 12px Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; border-radius: 3px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; border: 1px solid #ccc; background-color: #f9f9f9; padding: 0px 3px; @@ -1057,7 +1101,7 @@ p code { } .change .meta ul { - margin: 0; + margin: 0; } .change .meta ul img { @@ -1091,16 +1135,17 @@ p code { } #markdown-toc { - margin: 1em 1.5em 2em; + margin: 1em 1.5em 2em; } #markdown-toc li { - font-size: 14px; - list-style-type: lower-roman; + font-size: 14px; + list-style-type: lower-roman; + margin: 0.25em 0; } #markdown-toc li a { - color: #333; + color: #333; text-decoration: underline; } @@ -1108,16 +1153,14 @@ p code { color: #327fc7; } -body.api .content table { +.content table { width: 100%; overflow: auto; display: block; margin: 15px 0; - border-collapse: collapse; - border-spacing: 0; } -body.api .content thead { +.content thead { margin: 0; padding: 0; border: 0; @@ -1126,25 +1169,25 @@ body.api .content thead { vertical-align: baseline; } -body.api .content table th { +.content table th { border: 1px solid #ddd; padding: 6px 13px; font-weight: bold; text-align: center; } -body.api .content tbody { +.content tbody { vertical-align: middle; border-color: inherit; } -body.api .content table tr { +.content table tr { border-top: 1px solid #ccc; background-color: #fff; vertical-align: inherit; } -body.api .content table td { +.content table td { border: 1px solid #ddd; padding: 6px 13px; } @@ -1155,21 +1198,20 @@ body.api .content table td { Pre/Code Styles ------------------------------------------------------------------------------*/ -code {white-space: nowrap;} +code { + white-space: nowrap; + font: 12px Consolas, 'Liberation Mono', Courier, monospace; +} + +pre code {white-space: pre;} pre { border: 1px solid #cacaca; - line-height: 1.2em; - font: 12px Monaco,"Courier New","DejaVu Sans Mono","Bitstream Vera Sans Mono",monospace; + font: 12px/1.4em Consolas, 'Liberation Mono', Courier, monospace; padding: 10px; overflow:auto; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; border-radius: 3px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; - background-color: #FAFAFB; + background-color: #fafafb; color: #393939; margin: 2em 0; } @@ -1178,285 +1220,49 @@ ul + pre { margin-top: 1em; } -pre code {white-space: pre;} - pre span.comment {color: #aaa;} -pre.headers { +.headers { margin-bottom: 0; - border-bottom-width: 0; - -webkit-border-radius: 3px 3px 0 0; - -moz-border-radius: 3px 3px 0 0; - border-radius: 3px 3px 0 0; - color: #666; - background-color: #f1f1f1; - background-image: -moz-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -ms-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -o-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#e1e1e1)); - background-image: -webkit-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: linear-gradient(top, #f1f1f1, #e1e1e1); - filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f1f1f1', EndColorStr='#e1e1e1'); - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); -} - -pre.no-response { - -webkit-border-radius: 3px 3px; - -moz-border-radius: 3px 3px; border-radius: 3px 3px; border-bottom: 1px solid #CACACA; + background-color: #f4f4f4; } -pre.headers + pre { - -webkit-border-radius: 0 0 3px 3px; - -moz-border-radius: 0 0 3px 3px; +.headers + pre { border-radius: 0 0 3px 3px; margin-top: 0; + border-top-color: #ddd; +} + +.headers + pre.body-response { + margin-top: -2px; } -pre.terminal { +.terminal { background-color: #444; color: #fff; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; border-radius: 3px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; border: none; position: relative; - padding: 10px; - text-shadow: none; - background-image: none; - filter: none; } -pre.terminal em { +.terminal em { color: #f9fe64; } -span.codeline { - display: block; - position: relative; -} - -span.codeline:hover { - background-color: #292929; - margin: 0px; - padding-left: 3px; - margin-left: -3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - color: #666666; -} - -span.codeline span { - display: inline-block; - font-size: 10px; - color: #fff; - padding: 0 0.3em 0.05em; - position: absolute; - right: 0px; - top: 0px; - text-indent: -9999px; - background-image: url(../images/qmark.png); - background-repeat: no-repeat; - background-position: 1px 3px; - max-width: 8px; - min-width: 8px; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; - cursor: default; -} - -span.codeline span:hover { - display: inline-block; - text-indent: 0px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - background: #000; - border: 1px solid #292929; - max-width: 1000px; -} - -span.codeline:hover em { - color: #666666; -} - -pre.bootcamp { - white-space: normal; - margin-left: -10px; - background-image: none; -} - -span.bash-output { - color: #63e463; - display: block; - position: relative; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; -} - -/* end */ - -/*------------------------------------------------------------------------------ - More Info Expander -------------------------------------------------------------------------------*/ - -.more-info { - margin: 10px 0; - position: relative; -} -.more-info > h4 { - background-image: url('../images/dropdown_sprites.jpg'); - background-repeat: no-repeat; - padding: .25em 0 .25em 25px; - cursor: pointer; - color: #4183C4; - font-weight: normal; -} -.more-info h4.compressed { - background-position: 0 0; -} -.more-info:hover h4.compressed { - background-position: 0 -23px; -} -.more-info h4.expanded { - background-position: 0 -46px; -} -.more-info:hover h4.expanded { - background-position: 0 -69px; -} - -.more-info .more-content { - display: none; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - background-color: #FFFFFF; - border: 3px solid #DDDDDD; - padding: 1em 2em; - -webkit-box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); - box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3); - margin: 15px 0 30px; -} - -.more-info .more-content h4 { - margin-top: 1em; -} - -.more-info .more-content pre { - margin-left: 0px; -} - -/****************************/ -/* List Module */ -/****************************/ - -.list-module h2 { - border: solid #cacaca; - border-width: 1px; - border-radius: 3px 3px 0px 0px; - -moz-border-radius: 3px 3px 0px 0px; - -webkit-border-bottom-right-radius: 0px; - -webkit-border-bottom-left-radius: 0px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; - padding: 6px 10px; - background-color: #f1f1f1; - background-image: -moz-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -ms-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -o-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: -webkit-gradient(linear, left top, left bottom, from(#f1f1f1), to(#e1e1e1)); - background-image: -webkit-linear-gradient(top, #f1f1f1, #e1e1e1); - background-image: linear-gradient(top, #f1f1f1, #e1e1e1); - filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f1f1f1', EndColorStr='#e1e1e1'); - color: #666; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); - font-size: 16px; - line-height: 22px; - margin: 0px; -} - -.list-module .list-body { - border: solid #cacaca; - border-width: 0px 1px 1px 1px; - border-radius: 0px 0px 3px 3px; - -moz-border-radius: 0px 0px 3px 3px; - -webkit-border-bottom-right-radius: 3px; - -webkit-border-bottom-left-radius: 3px; - -moz-background-clip: padding; - -webkit-background-clip: padding-box; - background-clip: padding-box; - background-color: #fafafb; - color: #666; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); -} - -.list-module .list-body .icon { - display: block; - height: 28px; - width: 28px; - position: absolute; - top: 10px; - left: 10px; - background: transparent url(images/popular_guide_sprites.png) 0 0 no-repeat; -} - -.list-module a { - border-top: 1px solid #fff; - border-bottom: 1px solid #e9ecee; - padding: 6px 10px; - position: relative; - display: block; -} - -.list-module a:hover { - border-top: 1px solid #fafafb; - border-bottom: 1px solid #e5e8ea; - background-color: #f0f0f3; - text-decoration: none; -} - -.list-module a h3 { - color: #4183C4; -} - -.list-module a:hover h3 { - text-decoration: underline; -} - -.list-module ul { - list-style-type: none; - margin: 0px; -} - -.list-module h3 { - margin: 0px; - font-size: 13px; +.terminal span.comment { + color: #ccc; } -.list-module .list-body a p { - color: #666; - margin: 0px; +.terminal span.output { + color: #63E463; } -/* @end */ - /****************************/ /* Expandable List Module */ /****************************/ -.sidebar-module h3 a { - display: block; -} - .sidebar-module a + a { padding-left: 27px; } @@ -1466,7 +1272,7 @@ span.bash-output { } .sidebar-module .arrow-btn { - background-image: url(/shared/images/expand-arrows.png); + background-image: url(/images/expand-arrows.png); background-repeat: no-repeat; background-position: -3px -3px; width: 13px; @@ -1495,33 +1301,61 @@ span.bash-output { .alert { position:relative; - margin:0 auto; - padding:15px; - color:#264c72; + padding: 0 15px; + color: #264c72; border: 1px solid #97c1da; border-radius: 3px; background-color: #d8ebf8; } -.alert *:first-child { margin-top: 0 } -.alert *:last-child { margin-bottom: 0 } +.warning { + position:relative; + padding: 0 15px; + color: #613A00; + border: 1px solid #dca874; + border-radius: 3px; + background-color: #ffe3c8; +} -li.api-status a.good { - color: #227b41; +/*------------------------------------------------------------------------------ + Dev Program +------------------------------------------------------------------------------*/ + +.program-info-column { + float: left; + position: relative; + margin: 20px 0 60px; + padding-left: 50px; + width: 415px; } -li.api-status a.minor { - color: #ed8b3f; +.program-info-column:first-child { + margin-right: 50px; } -li.api-status a.major { - color: #ad1a05; +.program-info-column h2 { + margin-bottom: 0; + font-size: 18px; } -li.api-status img { - float: left; - margin: 0 5px 0 0; +.program-info-column p { + margin-top: 5px; + font-size: 16px; + line-height: 1.5; + color: #666; +} + +.program-info-column .mega-octicon { + position: absolute; + left: 0; + top: 32px; + color: #333; } + +.program-info-column ul { + margin-left: 15px; +} + /* @end */ /********************/ @@ -1541,17 +1375,17 @@ li.api-status img { } #searchfield { - background-image: url(/shared/images/search@2x.png); + background-image: url(/images/search@2x.png); background-size: 13px 13px; } .cancel-search { - background-image: url(/shared/images/cancel@2x.png); + background-image: url(/images/cancel@2x.png); background-size: 14px 14px; } .sidebar-module .arrow-btn { - background-image: url(/shared/images/expand-arrows@2x.png); + background-image: url(/images/expand-arrows@2x.png); background-size: 73px 80px; } diff --git a/static/css/octicons.css b/static/css/octicons.css new file mode 100755 index 0000000000..04107edcf8 --- /dev/null +++ b/static/css/octicons.css @@ -0,0 +1,231 @@ +@font-face { + font-family: 'octicons'; + src: url('octicons.eot?#iefix') format('embedded-opentype'), + url('octicons.woff') format('woff'), + url('octicons.ttf') format('truetype'), + url('octicons.svg#octicons') format('svg'); + font-weight: normal; + font-style: normal; +} + +/* + +.octicon is optimized for 16px. +.mega-octicon is optimized for 32px but can be used larger. + +*/ +.octicon { + font: normal normal 16px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; +} +.mega-octicon { + font: normal normal 32px octicons; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; +} + +.octicon-alert:before { content: '\f02d'} /*  */ +.octicon-alignment-align:before { content: '\f08a'} /*  */ +.octicon-alignment-aligned-to:before { content: '\f08e'} /*  */ +.octicon-alignment-unalign:before { content: '\f08b'} /*  */ +.octicon-arrow-down:before { content: '\f03f'} /*  */ +.octicon-arrow-left:before { content: '\f040'} /*  */ +.octicon-arrow-right:before { content: '\f03e'} /*  */ +.octicon-arrow-small-down:before { content: '\f0a0'} /*  */ +.octicon-arrow-small-left:before { content: '\f0a1'} /*  */ +.octicon-arrow-small-right:before { content: '\f071'} /*  */ +.octicon-arrow-small-up:before { content: '\f09f'} /*  */ +.octicon-arrow-up:before { content: '\f03d'} /*  */ +.octicon-beer:before { content: '\f069'} /*  */ +.octicon-book:before { content: '\f007'} /*  */ +.octicon-bookmark:before { content: '\f07b'} /*  */ +.octicon-briefcase:before { content: '\f0d3'} /*  */ +.octicon-broadcast:before { content: '\f048'} /*  */ +.octicon-browser:before { content: '\f0c5'} /*  */ +.octicon-bug:before { content: '\f091'} /*  */ +.octicon-calendar:before { content: '\f068'} /*  */ +.octicon-check:before { content: '\f03a'} /*  */ +.octicon-checklist:before { content: '\f076'} /*  */ +.octicon-chevron-down:before { content: '\f0a3'} /*  */ +.octicon-chevron-left:before { content: '\f0a4'} /*  */ +.octicon-chevron-right:before { content: '\f078'} /*  */ +.octicon-chevron-up:before { content: '\f0a2'} /*  */ +.octicon-circle-slash:before { content: '\f084'} /*  */ +.octicon-circuit-board:before { content: '\f0d6'} /*  */ +.octicon-clippy:before { content: '\f035'} /*  */ +.octicon-clock:before { content: '\f046'} /*  */ +.octicon-cloud-download:before { content: '\f00b'} /*  */ +.octicon-cloud-upload:before { content: '\f00c'} /*  */ +.octicon-code:before { content: '\f05f'} /*  */ +.octicon-color-mode:before { content: '\f065'} /*  */ +.octicon-comment-add:before, +.octicon-comment:before { content: '\f02b'} /*  */ +.octicon-comment-discussion:before { content: '\f04f'} /*  */ +.octicon-credit-card:before { content: '\f045'} /*  */ +.octicon-dash:before { content: '\f0ca'} /*  */ +.octicon-dashboard:before { content: '\f07d'} /*  */ +.octicon-database:before { content: '\f096'} /*  */ +.octicon-device-camera:before { content: '\f056'} /*  */ +.octicon-device-camera-video:before { content: '\f057'} /*  */ +.octicon-device-desktop:before { content: '\f27c'} /*  */ +.octicon-device-mobile:before { content: '\f038'} /*  */ +.octicon-diff:before { content: '\f04d'} /*  */ +.octicon-diff-added:before { content: '\f06b'} /*  */ +.octicon-diff-ignored:before { content: '\f099'} /*  */ +.octicon-diff-modified:before { content: '\f06d'} /*  */ +.octicon-diff-removed:before { content: '\f06c'} /*  */ +.octicon-diff-renamed:before { content: '\f06e'} /*  */ +.octicon-ellipsis:before { content: '\f09a'} /*  */ +.octicon-eye-unwatch:before, +.octicon-eye-watch:before, +.octicon-eye:before { content: '\f04e'} /*  */ +.octicon-file-binary:before { content: '\f094'} /*  */ +.octicon-file-code:before { content: '\f010'} /*  */ +.octicon-file-directory:before { content: '\f016'} /*  */ +.octicon-file-media:before { content: '\f012'} /*  */ +.octicon-file-pdf:before { content: '\f014'} /*  */ +.octicon-file-submodule:before { content: '\f017'} /*  */ +.octicon-file-symlink-directory:before { content: '\f0b1'} /*  */ +.octicon-file-symlink-file:before { content: '\f0b0'} /*  */ +.octicon-file-text:before { content: '\f011'} /*  */ +.octicon-file-zip:before { content: '\f013'} /*  */ +.octicon-flame:before { content: '\f0d2'} /*  */ +.octicon-fold:before { content: '\f0cc'} /*  */ +.octicon-gear:before { content: '\f02f'} /*  */ +.octicon-gift:before { content: '\f042'} /*  */ +.octicon-gist:before { content: '\f00e'} /*  */ +.octicon-gist-secret:before { content: '\f08c'} /*  */ +.octicon-git-branch-create:before, +.octicon-git-branch-delete:before, +.octicon-git-branch:before { content: '\f020'} /*  */ +.octicon-git-commit:before { content: '\f01f'} /*  */ +.octicon-git-compare:before { content: '\f0ac'} /*  */ +.octicon-git-merge:before { content: '\f023'} /*  */ +.octicon-git-pull-request-abandoned:before, +.octicon-git-pull-request:before { content: '\f009'} /*  */ +.octicon-globe:before { content: '\f0b6'} /*  */ +.octicon-graph:before { content: '\f043'} /*  */ +.octicon-heart:before { content: '\2665'} /* ♥ */ +.octicon-history:before { content: '\f07e'} /*  */ +.octicon-home:before { content: '\f08d'} /*  */ +.octicon-horizontal-rule:before { content: '\f070'} /*  */ +.octicon-hourglass:before { content: '\f09e'} /*  */ +.octicon-hubot:before { content: '\f09d'} /*  */ +.octicon-inbox:before { content: '\f0cf'} /*  */ +.octicon-info:before { content: '\f059'} /*  */ +.octicon-issue-closed:before { content: '\f028'} /*  */ +.octicon-issue-opened:before { content: '\f026'} /*  */ +.octicon-issue-reopened:before { content: '\f027'} /*  */ +.octicon-jersey:before { content: '\f019'} /*  */ +.octicon-jump-down:before { content: '\f072'} /*  */ +.octicon-jump-left:before { content: '\f0a5'} /*  */ +.octicon-jump-right:before { content: '\f0a6'} /*  */ +.octicon-jump-up:before { content: '\f073'} /*  */ +.octicon-key:before { content: '\f049'} /*  */ +.octicon-keyboard:before { content: '\f00d'} /*  */ +.octicon-light-bulb:before { content: '\f000'} /*  */ +.octicon-link:before { content: '\f05c'} /*  */ +.octicon-link-external:before { content: '\f07f'} /*  */ +.octicon-list-ordered:before { content: '\f062'} /*  */ +.octicon-list-unordered:before { content: '\f061'} /*  */ +.octicon-location:before { content: '\f060'} /*  */ +.octicon-gist-private:before, +.octicon-mirror-private:before, +.octicon-git-fork-private:before, +.octicon-lock:before { content: '\f06a'} /*  */ +.octicon-log-in:before { content: '\f036'} /*  */ +.octicon-log-out:before { content: '\f032'} /*  */ +.octicon-logo-github:before { content: '\f092'} /*  */ +.octicon-mail:before { content: '\f03b'} /*  */ +.octicon-mail-read:before { content: '\f03c'} /*  */ +.octicon-mail-reply:before { content: '\f051'} /*  */ +.octicon-mark-github:before { content: '\f00a'} /*  */ +.octicon-markdown:before { content: '\f0c9'} /*  */ +.octicon-megaphone:before { content: '\f077'} /*  */ +.octicon-mention:before { content: '\f0be'} /*  */ +.octicon-microscope:before { content: '\f089'} /*  */ +.octicon-milestone:before { content: '\f075'} /*  */ +.octicon-mirror-public:before { content: '\f024'} /*  */ +.octicon-mortar-board:before { content: '\f0d7'} /* */ +.octicon-move-down:before { content: '\f0a8'} /*  */ +.octicon-move-left:before { content: '\f074'} /*  */ +.octicon-move-right:before { content: '\f0a9'} /*  */ +.octicon-move-up:before { content: '\f0a7'} /*  */ +.octicon-mute:before { content: '\f080'} /*  */ +.octicon-no-newline:before { content: '\f09c'} /*  */ +.octicon-octoface:before { content: '\f008'} /*  */ +.octicon-organization:before { content: '\f037'} /*  */ +.octicon-package:before { content: '\f0c4'} /*  */ +.octicon-paintcan:before { content: '\f0d1'} /*  */ +.octicon-pencil:before { content: '\f058'} /*  */ +.octicon-person-add:before, +.octicon-person-follow:before, +.octicon-person:before { content: '\f018'} /*  */ +.octicon-pin:before { content: '\f041'} /*  */ +.octicon-playback-fast-forward:before { content: '\f0bd'} /*  */ +.octicon-playback-pause:before { content: '\f0bb'} /*  */ +.octicon-playback-play:before { content: '\f0bf'} /*  */ +.octicon-playback-rewind:before { content: '\f0bc'} /*  */ +.octicon-plug:before { content: '\f0d4'} /*  */ +.octicon-repo-create:before, +.octicon-gist-new:before, +.octicon-file-directory-create:before, +.octicon-file-add:before, +.octicon-plus:before { content: '\f05d'} /*  */ +.octicon-podium:before { content: '\f0af'} /*  */ +.octicon-primitive-dot:before { content: '\f052'} /*  */ +.octicon-primitive-square:before { content: '\f053'} /*  */ +.octicon-pulse:before { content: '\f085'} /*  */ +.octicon-puzzle:before { content: '\f0c0'} /*  */ +.octicon-question:before { content: '\f02c'} /*  */ +.octicon-quote:before { content: '\f063'} /*  */ +.octicon-radio-tower:before { content: '\f030'} /*  */ +.octicon-repo-delete:before, +.octicon-repo:before { content: '\f001'} /*  */ +.octicon-repo-clone:before { content: '\f04c'} /*  */ +.octicon-repo-force-push:before { content: '\f04a'} /*  */ +.octicon-gist-fork:before, +.octicon-repo-forked:before { content: '\f002'} /*  */ +.octicon-repo-pull:before { content: '\f006'} /*  */ +.octicon-repo-push:before { content: '\f005'} /*  */ +.octicon-rocket:before { content: '\f033'} /*  */ +.octicon-rss:before { content: '\f034'} /*  */ +.octicon-ruby:before { content: '\f047'} /*  */ +.octicon-screen-full:before { content: '\f066'} /*  */ +.octicon-screen-normal:before { content: '\f067'} /*  */ +.octicon-search-save:before, +.octicon-search:before { content: '\f02e'} /*  */ +.octicon-server:before { content: '\f097'} /*  */ +.octicon-settings:before { content: '\f07c'} /*  */ +.octicon-split:before { content: '\f0c6'} /*  */ +.octicon-squirrel:before { content: '\f0b2'} /*  */ +.octicon-star-add:before, +.octicon-star-delete:before, +.octicon-star:before { content: '\f02a'} /*  */ +.octicon-steps:before { content: '\f0c7'} /*  */ +.octicon-stop:before { content: '\f08f'} /*  */ +.octicon-repo-sync:before, +.octicon-sync:before { content: '\f087'} /*  */ +.octicon-tag-remove:before, +.octicon-tag-add:before, +.octicon-tag:before { content: '\f015'} /*  */ +.octicon-telescope:before { content: '\f088'} /*  */ +.octicon-terminal:before { content: '\f0c8'} /*  */ +.octicon-three-bars:before { content: '\f05e'} /*  */ +.octicon-tools:before { content: '\f031'} /*  */ +.octicon-trashcan:before { content: '\f0d0'} /*  */ +.octicon-triangle-down:before { content: '\f05b'} /*  */ +.octicon-triangle-left:before { content: '\f044'} /*  */ +.octicon-triangle-right:before { content: '\f05a'} /*  */ +.octicon-triangle-up:before { content: '\f0aa'} /*  */ +.octicon-unfold:before { content: '\f039'} /*  */ +.octicon-unmute:before { content: '\f0ba'} /*  */ +.octicon-versions:before { content: '\f064'} /*  */ +.octicon-remove-close:before, +.octicon-x:before { content: '\f081'} /*  */ +.octicon-zap:before { content: '\26A1'} /* ⚡ */ diff --git a/static/css/octicons.eot b/static/css/octicons.eot new file mode 100755 index 0000000000..da731468de Binary files /dev/null and b/static/css/octicons.eot differ diff --git a/static/css/octicons.svg b/static/css/octicons.svg new file mode 100755 index 0000000000..0aa83aaac8 --- /dev/null +++ b/static/css/octicons.svg @@ -0,0 +1,195 @@ + + + + +(c) 2012-2014 GitHub + +Font License: SIL OFL 1.1 (http://scripts.sil.org/OFL) +Applies to all font files + +Code License: MIT (http://choosealicense.com/licenses/mit/) +Applies to all other files + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/css/octicons.ttf b/static/css/octicons.ttf new file mode 100755 index 0000000000..b6c3706f2c Binary files /dev/null and b/static/css/octicons.ttf differ diff --git a/static/css/octicons.woff b/static/css/octicons.woff new file mode 100755 index 0000000000..91d7333b73 Binary files /dev/null and b/static/css/octicons.woff differ diff --git a/shared/css/pygments.css b/static/css/pygments.css similarity index 100% rename from shared/css/pygments.css rename to static/css/pygments.css diff --git a/css/reset.css b/static/css/reset.css similarity index 100% rename from css/reset.css rename to static/css/reset.css diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000..cedb6140f4 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/images/add_github_autodeploy_service.png b/static/images/add_github_autodeploy_service.png new file mode 100644 index 0000000000..0a09f51f54 Binary files /dev/null and b/static/images/add_github_autodeploy_service.png differ diff --git a/static/images/add_heroku_autodeploy_service.png b/static/images/add_heroku_autodeploy_service.png new file mode 100644 index 0000000000..389b3942c6 Binary files /dev/null and b/static/images/add_heroku_autodeploy_service.png differ diff --git a/static/images/callout-earth-static.png b/static/images/callout-earth-static.png new file mode 100644 index 0000000000..f20e9e6d30 Binary files /dev/null and b/static/images/callout-earth-static.png differ diff --git a/shared/images/cancel.png b/static/images/cancel.png similarity index 100% rename from shared/images/cancel.png rename to static/images/cancel.png diff --git a/shared/images/cancel@2x.png b/static/images/cancel@2x.png similarity index 100% rename from shared/images/cancel@2x.png rename to static/images/cancel@2x.png diff --git a/static/images/deploy-keys.png b/static/images/deploy-keys.png new file mode 100644 index 0000000000..5208ba9997 Binary files /dev/null and b/static/images/deploy-keys.png differ diff --git a/static/images/electrocat.png b/static/images/electrocat.png new file mode 100644 index 0000000000..7a27fde088 Binary files /dev/null and b/static/images/electrocat.png differ diff --git a/static/images/electrocat@2x.png b/static/images/electrocat@2x.png new file mode 100644 index 0000000000..563905bf69 Binary files /dev/null and b/static/images/electrocat@2x.png differ diff --git a/shared/images/expand-arrows.png b/static/images/expand-arrows.png similarity index 100% rename from shared/images/expand-arrows.png rename to static/images/expand-arrows.png diff --git a/shared/images/expand-arrows@2x.png b/static/images/expand-arrows@2x.png similarity index 100% rename from shared/images/expand-arrows@2x.png rename to static/images/expand-arrows@2x.png diff --git a/images/feed-icon.png b/static/images/feed-icon.png similarity index 100% rename from images/feed-icon.png rename to static/images/feed-icon.png diff --git a/images/feed-icon@2x.png b/static/images/feed-icon@2x.png similarity index 100% rename from images/feed-icon@2x.png rename to static/images/feed-icon@2x.png diff --git a/static/images/gdp-callout-static.png b/static/images/gdp-callout-static.png new file mode 100644 index 0000000000..f20e9e6d30 Binary files /dev/null and b/static/images/gdp-callout-static.png differ diff --git a/shared/images/gundamcat.png b/static/images/gundamcat.png similarity index 100% rename from shared/images/gundamcat.png rename to static/images/gundamcat.png diff --git a/shared/images/gundamcat@2x.png b/static/images/gundamcat@2x.png similarity index 100% rename from shared/images/gundamcat@2x.png rename to static/images/gundamcat@2x.png diff --git a/static/images/header-animation-short-loop.gif b/static/images/header-animation-short-loop.gif new file mode 100644 index 0000000000..5238585ecd Binary files /dev/null and b/static/images/header-animation-short-loop.gif differ diff --git a/static/images/header-animation.gif b/static/images/header-animation.gif new file mode 100644 index 0000000000..7b20d910d8 Binary files /dev/null and b/static/images/header-animation.gif differ diff --git a/shared/images/header.png b/static/images/header.png similarity index 100% rename from shared/images/header.png rename to static/images/header.png diff --git a/shared/images/header@2x.png b/static/images/header@2x.png similarity index 100% rename from shared/images/header@2x.png rename to static/images/header@2x.png diff --git a/images/logo_developer.png b/static/images/logo_developer.png similarity index 100% rename from images/logo_developer.png rename to static/images/logo_developer.png diff --git a/images/logo_developer@2x.png b/static/images/logo_developer@2x.png similarity index 100% rename from images/logo_developer@2x.png rename to static/images/logo_developer@2x.png diff --git a/static/images/mark@2x.png b/static/images/mark@2x.png new file mode 100644 index 0000000000..ea6ff545a2 Binary files /dev/null and b/static/images/mark@2x.png differ diff --git a/static/images/oauth_prompt.png b/static/images/oauth_prompt.png new file mode 100644 index 0000000000..387d022505 Binary files /dev/null and b/static/images/oauth_prompt.png differ diff --git a/images/pagination_sample.png b/static/images/pagination_sample.png similarity index 100% rename from images/pagination_sample.png rename to static/images/pagination_sample.png diff --git a/static/images/payload_request_tab.png b/static/images/payload_request_tab.png new file mode 100644 index 0000000000..2fddc6d189 Binary files /dev/null and b/static/images/payload_request_tab.png differ diff --git a/static/images/payload_response_tab.png b/static/images/payload_response_tab.png new file mode 100644 index 0000000000..f2507841db Binary files /dev/null and b/static/images/payload_response_tab.png differ diff --git a/static/images/personal_token.png b/static/images/personal_token.png new file mode 100644 index 0000000000..4b9baa1dbd Binary files /dev/null and b/static/images/personal_token.png differ diff --git a/images/posts/create-repo-init.png b/static/images/posts/create-repo-init.png similarity index 100% rename from images/posts/create-repo-init.png rename to static/images/posts/create-repo-init.png diff --git a/images/posts/default-branch.png b/static/images/posts/default-branch.png similarity index 100% rename from images/posts/default-branch.png rename to static/images/posts/default-branch.png diff --git a/images/posts/submodule-links.png b/static/images/posts/submodule-links.png similarity index 100% rename from images/posts/submodule-links.png rename to static/images/posts/submodule-links.png diff --git a/images/professorcat.png b/static/images/professorcat.png similarity index 100% rename from images/professorcat.png rename to static/images/professorcat.png diff --git a/images/professorcat@2x.png b/static/images/professorcat@2x.png similarity index 100% rename from images/professorcat@2x.png rename to static/images/professorcat@2x.png diff --git a/static/images/rocketship.png b/static/images/rocketship.png new file mode 100644 index 0000000000..f6720a52a8 Binary files /dev/null and b/static/images/rocketship.png differ diff --git a/static/images/rocketship@2x.png b/static/images/rocketship@2x.png new file mode 100644 index 0000000000..4055ede1b6 Binary files /dev/null and b/static/images/rocketship@2x.png differ diff --git a/shared/images/search.png b/static/images/search.png similarity index 100% rename from shared/images/search.png rename to static/images/search.png diff --git a/shared/images/search@2x.png b/static/images/search@2x.png similarity index 100% rename from shared/images/search@2x.png rename to static/images/search@2x.png diff --git a/images/status-icon-good.png b/static/images/status-icon-good.png similarity index 100% rename from images/status-icon-good.png rename to static/images/status-icon-good.png diff --git a/images/status-icon-good@2x.png b/static/images/status-icon-good@2x.png similarity index 100% rename from images/status-icon-good@2x.png rename to static/images/status-icon-good@2x.png diff --git a/images/status-icon-major.png b/static/images/status-icon-major.png similarity index 100% rename from images/status-icon-major.png rename to static/images/status-icon-major.png diff --git a/images/status-icon-major@2x.png b/static/images/status-icon-major@2x.png similarity index 100% rename from images/status-icon-major@2x.png rename to static/images/status-icon-major@2x.png diff --git a/images/status-icon-minor.png b/static/images/status-icon-minor.png similarity index 100% rename from images/status-icon-minor.png rename to static/images/status-icon-minor.png diff --git a/images/status-icon-minor@2x.png b/static/images/status-icon-minor@2x.png similarity index 100% rename from images/status-icon-minor@2x.png rename to static/images/status-icon-minor@2x.png diff --git a/images/status-icon-unknown.png b/static/images/status-icon-unknown.png similarity index 100% rename from images/status-icon-unknown.png rename to static/images/status-icon-unknown.png diff --git a/images/status-icon-unknown@2x.png b/static/images/status-icon-unknown@2x.png similarity index 100% rename from images/status-icon-unknown@2x.png rename to static/images/status-icon-unknown@2x.png diff --git a/static/images/webhook_sample_url.png b/static/images/webhook_sample_url.png new file mode 100644 index 0000000000..8bffdeec12 Binary files /dev/null and b/static/images/webhook_sample_url.png differ diff --git a/static/images/webhook_secret_token.png b/static/images/webhook_secret_token.png new file mode 100644 index 0000000000..6d2074b6ac Binary files /dev/null and b/static/images/webhook_secret_token.png differ diff --git a/static/images/webhooks_recent_deliveries.png b/static/images/webhooks_recent_deliveries.png new file mode 100644 index 0000000000..3a742bfeae Binary files /dev/null and b/static/images/webhooks_recent_deliveries.png differ diff --git a/shared/js/documentation.js b/static/js/documentation.js similarity index 89% rename from shared/js/documentation.js rename to static/js/documentation.js index a4868ad47a..ce4000da31 100644 --- a/shared/js/documentation.js +++ b/static/js/documentation.js @@ -10,7 +10,7 @@ $(function() { $('#js-sidebar .js-topic a').each(function(){ if ($(this).parent('li').hasClass('disable')) $(this).parent('li').removeClass('disable') - + var url = $(this).attr('href').toString() var cleanDocUrl = docUrl[1] if(url.indexOf(cleanDocUrl) >= 0 && url.length == cleanDocUrl.length){ @@ -86,7 +86,7 @@ $(function() { // Dynamic year for footer copyright var currentYear = (new Date).getFullYear(); - $("#year").text( (new Date).getFullYear() ); + $.each($(".js-year"), (function() { $(this).text( currentYear ) })); // Grab API status $.getJSON('https://status.github.com/api/status.json?callback=?', function(data) { @@ -99,30 +99,30 @@ $(function() { $('.api-status').html(link); } }); - + // Add link anchors for headers with IDs $(".content h1, .content h2, .content h3, .content h4").each(function(e){ var id = $(this).attr("id"); if (!id) return; - + $(this).prepend(""); }); - + // #### Search #### var searchIndex, searchHits; - + // Load the JSON containing all pages // Has it been loaded before (and stored with localstorage)? if (localStorage['searchIndex']) { searchIndex = JSON.parse(localStorage['searchIndex']); - + if (localStorageHasExpired()) loadSearchIndex(); } else { loadSearchIndex(); } - + function loadSearchIndex() { $.getJSON('/search-index.json', function(data) { searchIndex = data["pages"]; @@ -130,13 +130,13 @@ $(function() { localStorage['updated'] = new Date().getTime(); }); } - + function localStorageHasExpired() { // Expires in one day (86400000 ms) if (new Date().getTime() - parseInt(localStorage['updated'],10) > 86400000) { return true; } - + return false; } @@ -145,26 +145,26 @@ $(function() { $("#search-container").addClass("active"); searchForString($("#searchfield").val()); } - + // On input change, update the search results $("#searchfield").on("input", function(e) { $(this).val().length > 0 ? $("#search-container").addClass("active") : $("#search-container").removeClass("active"); searchForString($(this).val()); }); - + // Global keyboard shortcuts $("body").keyup(function(e) { if (e.keyCode == 83) { // S key if ($("#searchfield").is(":focus")) return; - + e.preventDefault(); $("#searchfield").focus(); } }); - + // Keyboard support for the search field $("#searchfield").keyup(function(e) { if (e.keyCode == 27) { @@ -205,82 +205,113 @@ $(function() { $("#search-container .search-placeholder").click(function(e) { $("#searchfield").focus(); }); - + $(".cancel-search").click(function(e) { cancelSearch(); }); - + function cancelSearch() { $("#searchfield").val(""); $("#search-container").removeClass("active"); } - + function searchForString(searchString) { searchHits = []; searchString = searchString.toLowerCase(); - + // Search for string in all pages for (var i = 0; i < searchIndex.length; i++) { var page = searchIndex[i]; - + // Add the page to the array of hits if there's a match if (page.title.toLowerCase().indexOf(searchString) !== -1) { searchHits.push(page); } } - + renderResultsForSearch(searchString); } - + // Update the UI representation of the search hits function renderResultsForSearch(searchString){ $("#search-results").empty(); - + // Check if there are any results. If not, show placeholder and exit if (searchHits.length < 1) { $('
  • No results for
  • ').appendTo("#search-results").find("em").text(searchString); return; } - + // Render results (max 8) for (var i = 0; i < Math.min(searchHits.length, 8); i++) { var page = searchHits[i]; - + $('
  • ' + page.title + '' + page.section + '
  • ').appendTo("#search-results"); } - + // Select the first alternative $("#search-results li:first-child").addClass("selected"); } - + // Move the selected list item when hovering $("#search-results").on("mouseenter", "li", function(e) { $(this).parent().find(".selected").removeClass("selected").end().end() .addClass("selected"); }); - + function moveSearchSelectionUp() { $prev = $("#search-results .selected").prev(); if ($prev.length < 1) return; - + $("#search-results .selected").removeClass("selected"); $prev.addClass("selected"); } - + function moveSearchSelectionDown() { $next = $("#search-results .selected").next(); if ($next.length < 1) return; - + $("#search-results .selected").removeClass("selected"); $next.addClass("selected"); } - + function goToSelectedSearchResult() { var href = $("#search-results .selected a").attr("href"); if (href) window.location.href = href; } + // Earth animation + if ($('.dev-program').length) { + setTimeout(function() { + $('.earth').fadeOut(); + $('.earth-short-loop').show(); + }, 19 * 1000); // Let first loop run through 19 seconds + } + + // copy Help's image show/hide functionality in OLs + var dismissFullImage; + + $('ol img').each(function(index, elem) { + return $(elem).parent().prepend(elem); + }); + + $(document).on('click', 'ol img', function(event) { + var $fullImg, $img; + dismissFullImage(); + $img = $(event.currentTarget).clone(); + $fullImg = $('
    ').prepend($img); + $(this).closest('li').append($fullImg); + return $(document).on('click', '.js-full-image', function() { + dismissFullImage(); + return false; + }); + }); + + dismissFullImage = function() { + $(document).off('click', '.js-full-image', dismissFullImage); + return $('.js-full-image').remove(); + }; }); diff --git a/shared/js/jquery.js b/static/js/jquery.js similarity index 99% rename from shared/js/jquery.js rename to static/js/jquery.js index da4170647d..ce1b6b6e0b 100644 --- a/shared/js/jquery.js +++ b/static/js/jquery.js @@ -1,5 +1,4 @@ /*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license -//@ sourceMappingURL=jquery-1.10.2.min.map */ (function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="
    ",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
    a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
    t
    ",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="
    ",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t }({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/\s*$/g,At={option:[1,""],legend:[1,"
    ","
    "],area:[1,"",""],param:[1,"",""],thead:[1,"","
    "],tr:[2,"","
    "],col:[2,"","
    "],td:[3,"","
    "],_default:x.support.htmlSerialize?[0,"",""]:[1,"X
    ","
    "]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?""!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle); diff --git a/shared/js/retina.js b/static/js/retina.js similarity index 100% rename from shared/js/retina.js rename to static/js/retina.js diff --git a/search-index.json b/static/search-index.json similarity index 82% rename from search-index.json rename to static/search-index.json index ccd9dff712..33ea214483 100644 --- a/search-index.json +++ b/static/search-index.json @@ -17,7 +17,7 @@ }, { "url": "/v3/activity/events/types/", - "title": "Event Types", + "title": "Event Types & Payloads", "section": "API/Activity" }, { @@ -55,6 +55,36 @@ "title": "Emojis", "section": "API/Miscellaneous" }, + { + "url": "/v3/enterprise/", + "title": "Enterprise", + "section": "API/Enterprise " + }, + { + "url": "/v3/enterprise/admin_stats/", + "title": "Admin Stats", + "section": "API/Enterprise " + }, + { + "url": "/v3/enterprise/ldap/", + "title": "LDAP", + "section": "API/Enterprise " + }, + { + "url": "/v3/enterprise/license/", + "title": "License", + "section": "API/Enterprise " + }, + { + "url": "/v3/enterprise/management_console/", + "title": "Management Console", + "section": "API/Enterprise " + }, + { + "url": "/v3/enterprise/search_indexing/", + "title": "Search Indexing", + "section": "API/Enterprise " + }, { "url": "/v3/gists/", "title": "Gists", @@ -130,6 +160,11 @@ "title": "Issue Milestones", "section": "API/Issues" }, + { + "url": "/v3/licenses/", + "title": "Licenses", + "section": "API/Miscellaneous" + }, { "url": "/v3/markdown/", "title": "Markdown", @@ -155,11 +190,21 @@ "title": "OAuth", "section": "API/Overview" }, + { + "url": "/v3/oauth_authorizations/", + "title": "Authorizations", + "section": "API/Overview" + }, { "url": "/v3/orgs/", "title": "Organizations", "section": "API/Organizations" }, + { + "url": "/v3/orgs/hooks/", + "title": "Organization Webhooks", + "section": "API/Organizations" + }, { "url": "/v3/orgs/members/", "title": "Organization Members", @@ -227,7 +272,7 @@ }, { "url": "/v3/repos/hooks/", - "title": "Hooks", + "title": "Repository Webhooks", "section": "API/Repositories" }, { @@ -240,6 +285,11 @@ "title": "Merging", "section": "API/Repositories" }, + { + "url": "/v3/repos/pages/", + "title": "Pages", + "section": "API/Repositories" + }, { "url": "/v3/repos/releases/", "title": "Releases", @@ -275,6 +325,11 @@ "title": "Users", "section": "API/Users" }, + { + "url": "/v3/users/administration/", + "title": "User Administration", + "section": "API/Users" + }, { "url": "/v3/users/emails/", "title": "User Emails", @@ -296,4 +351,4 @@ "section": "API/Overview" } ] -} \ No newline at end of file +} diff --git a/tasks/enterprise.rake b/tasks/enterprise.rake new file mode 100644 index 0000000000..d0d48169dc --- /dev/null +++ b/tasks/enterprise.rake @@ -0,0 +1,48 @@ +require 'nokogiri' + +def setup + `git checkout gh-pages` + `git pull origin gh-pages` + + `git checkout -b #{BRANCH_NAME}` +end + +# we need to point links not to the root, but to the enterprise version root +# for assets and links +def rewrite_content(path) + Dir.glob("#{path}/**/*.html") do |html_file| + doc = Nokogiri::HTML(File.read(html_file)) + + # add '.enterprise' to `@class` in `body` + body = doc.search('body').first + unless body.nil? + classes = body.get_attribute('class').to_s.split(' ') + body.set_attribute('class', classes.push('enterprise').uniq.join(' ')) + end + + doc.css('a').each do |a| + a['href'] = "/enterprise/#{VERSION}#{a['href']}" if a['href'] =~ /^\// + end + + doc.css('link').each do |link| + link['href'] = "/enterprise/#{VERSION}#{link['href']}" if link['href'] =~ /^\// + end + + doc.css('script').each do |script| + script['src'] = "/enterprise/#{VERSION}#{script['src']}" if script['src'] =~ /^\// + end + + doc.css('img').each do |img| + img['src'] = "/enterprise/#{VERSION}#{img['src']}" if img['src'] =~ /^\// + end + + doc.search('//*[@class="not-enterprise"]').remove + File.open(html_file, 'w') { |file| file.write(doc.to_html) } + end + + Dir.glob("#{path}/**/*.css") do |css_file| + contents = File.read(css_file) + contents.gsub!(/url\(\/shared/, "url(/enterprise/#{VERSION}/shared") + File.open(css_file, 'w') { |file| file.write(contents) } + end +end \ No newline at end of file diff --git a/v3/activity/events/index.html b/v3/activity/events/index.html deleted file mode 100644 index 69911ba6f5..0000000000 --- a/v3/activity/events/index.html +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - Events | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Events

    - -

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

    - - - -

    Events are optimized for polling with the “ETag” header. If no new events have -been triggered, you will see a “304 Not Modified” response, and your current -rate limit will be untouched. There is also an “X-Poll-Interval” header that -specifies how often (in seconds) you are allowed to poll. In times of high -server load, the time may increase. Please obey the header.

    - -
    $ curl -I https://api.github.com/users/tater/events
    -HTTP/1.1 200 OK
    -X-Poll-Interval: 60
    -ETag: "a18c3bded88eb5dbb5c849a489412bf3"
    -
    -# The quotes around the ETag value are important
    -$ curl -I https://api.github.com/users/tater/events \
    -    -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
    -HTTP/1.1 304 Not Modified
    -X-Poll-Interval: 60
    -
    - -

    Events support pagination, -however the per_page option is unsupported. The fixed page size is 30 items. -Fetching up to ten pages is supported, for a total of 300 events.

    - -

    All Events have the same response format:

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "type": "Event",
    -    "public": true,
    -    "payload": {
    -    },
    -    "repo": {
    -      "id": 3,
    -      "name": "octocat/Hello-World",
    -      "url": "https://api.github.com/repos/octocat/Hello-World"
    -    },
    -    "actor": {
    -      "id": 1,
    -      "login": "octocat",
    -      "gravatar_id": "somehexcode",
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "url": "https://api.github.com/users/octocat"
    -    },
    -    "org": {
    -      "id": 1,
    -      "login": "github",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/orgs/github",
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -    },
    -    "created_at": "2011-09-06T17:26:27Z",
    -    "id": "12345"
    -  }
    -]
    - -

    List public events

    - -
    GET /events
    -
    - -

    List repository events

    - -
    GET /repos/:owner/:repo/events
    -
    - -

    List issue events for a repository

    - -

    Repository issue events have a different format than other events, -as documented in the Issue Events API.

    - -
    GET /repos/:owner/:repo/issues/events
    -
    - -

    List public events for a network of repositories

    - -
    GET /networks/:owner/: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
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/activity/events/types/index.html b/v3/activity/events/types/index.html deleted file mode 100644 index eb53fb18fe..0000000000 --- a/v3/activity/events/types/index.html +++ /dev/null @@ -1,1070 +0,0 @@ - - - - - - - - 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 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.

    - -

    This describes just the payload of an event. A full event will also -show the user that performed the event (actor), the repository, and the -organization (if applicable).

    - -

    Note that some of these events may not be rendered in timelines. -They’re only created for various internal and repository hooks.

    - - - -

    CommitCommentEvent

    - -

    Triggered when a commit comment is created.

    - -

    Hook name

    - -

    commit_comment

    - -

    Payload

    - -
    - - - - - - - - - - - - - - -
    KeyTypeDescription
    commentobjectThe comment itself.
    - -

    CreateEvent

    - -

    Represents a created repository, branch, or tag.

    - -

    Hook name

    - -

    create

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    ref_typestringThe object that was created. Can be one of “repository”, “branch”, or “tag”
    refstringThe git ref (or null if only a repository was created).
    master_branchstringThe name of the repository’s default branch (usually master).
    descriptionstringThe repository’s current description.
    - -

    DeleteEvent

    - -

    Represents a deleted branch or tag.

    - -

    Hook name

    - -

    delete

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    ref_typestringThe object that was deleted. Can be “branch” or “tag”.
    refstringThe full git ref.
    - -

    DeploymentEvent

    - -

    Represents a deployment.

    - -

    Hook name

    - -

    deployment

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    shastringThe commit SHA for which this deployment was created.
    namestringName of repository for this deployment, formatted as :owner/:repo.
    payloadstringThe optional extra information for this deployment.
    descriptionstringThe optional human-readable description added to the deployment.
    - -

    DeploymentStatusEvent

    - -

    Represents a deployment status.

    - -

    Hook name

    - -

    deployment_status

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    shastringThe commit SHA for the associated deployment.
    namestringName of repository for the associated deployment, formatted as :owner/:repo.
    statestringThe new state. Can be pending, success, failure, or error.
    payloadstringThe optional extra information for the associated deployment.
    target_urlstringThe optional link added to the status.
    descriptionstringThe optional human-readable description added to the status.
    - -

    DownloadEvent

    - -

    Triggered when a new download is created.

    - -

    Events of this type are no longer created, but it’s possible that they exist in timelines of some users.

    - -

    Hook name

    - -

    download

    - -

    Payload

    - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    downloadobjectThe download that was just created.
    - -

    FollowEvent

    - -

    Triggered when a user follows another user.

    - -

    Hook name

    - -

    follow

    - -

    Payload

    - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    targetobjectThe user that was just followed.
    - -

    ForkEvent

    - -

    Triggered when a user forks a repository.

    - -

    Hook name

    - -

    fork

    - -

    Payload

    - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    forkeeobjectThe created repository.
    - -

    ForkApplyEvent

    - -

    Triggered when a patch is applied in the Fork Queue.

    - -

    Events of this type are no longer created, but it’s possible that they exist in timelines of some users.

    - -

    Hook name

    - -

    fork_apply

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    headstringThe branch name the patch is applied to.
    beforestringSHA of the repository state before the patch.
    afterstringSHA of the repository state after the patch.
    - -

    GistEvent

    - -

    Triggered when a Gist is created or updated.

    - -

    Events of this type are no longer created, but it’s possible that they exist in timelines of some users.

    - -

    Hook name

    - -

    gist

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed. Can be “create” or “update”
    gistobjectThe gist itself.
    - -

    GollumEvent

    - -

    Triggered when a Wiki page is created or updated.

    - -

    Hook name

    - -

    gollum

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    pagesarrayThe pages that were updated.
    pages[][page_name]stringThe name of the page.
    pages[][title]stringThe current page title.
    pages[][action]stringThe action that was performed on the page. Can be “created” or “edited”.
    pages[][sha]stringThe latest commit SHA of the page.
    pages[][html_url]stringPoints to the HTML wiki page.
    - -

    IssueCommentEvent

    - -

    Triggered when an issue comment is created.

    - -

    Hook name

    - -

    issue_comment

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed on the comment. Currently, can only be “created”.
    issueobjectThe issue the comment belongs to.
    commentobjectThe comment itself.
    - -

    IssuesEvent

    - -

    Triggered when an issue is created, closed or reopened.

    - -

    Hook name

    - -

    issues

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed. Can be one of “opened”, “closed”, or “reopened”.
    issueobjectThe issue itself.
    - -

    MemberEvent

    - -

    Triggered when a user is added as a collaborator to a repository.

    - -

    Hook name

    - -

    member

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    memberobjectThe user that was added.
    actionstringThe action that was performed. Currently, can only be “added”.
    - -

    PublicEvent

    - -

    Triggered when a private repository is open sourced. Without a doubt: the best GitHub event.

    - -

    Hook name

    - -

    public

    - -

    Payload

    - -

    (empty payload)

    - -

    PullRequestEvent

    - -

    Triggered when a pull request is created, closed, reopened or synchronized.

    - -

    Hook name

    - -

    pull_request

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed. Can be one of “opened”, “closed”, “synchronize”, or “reopened”.
    numberintegerThe pull request number.
    pull_requestobjectThe pull request itself.
    - -

    PullRequestReviewCommentEvent

    - -

    Triggered when a comment is created on a portion of the unified diff of a pull request.

    - -

    Hook name

    - -

    pull_request_review_comment

    - -

    Payload

    - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    commentobjectThe comment itself.
    - -

    PushEvent

    - -

    Triggered when a repository branch is pushed to.

    - -

    Hook name

    - -

    push

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    headstringThe SHA of the HEAD commit on the repository.
    refstringThe full Git ref that was pushed. Example: “refs/heads/master”
    sizeintegerThe number of commits in the push.
    commitsarrayAn array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the Commits API to fetch additional commits.)
    commits[][sha]stringThe SHA of the commit.
    commits[][message]stringThe commit message.
    commits[][author]objectThe git author of the commit.
    commits[][author][name]stringThe git author’s name.
    commits[][author][email]stringThe git author’s email address.
    commits[][url]urlPoints to the commit API resource.
    commits[][distinct]booleanWhether this commit is distinct from any that have been pushed before.
    - -

    ReleaseEvent

    - -

    Triggered when a release is published.

    - -

    Hook name

    - -

    release

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed. Currently, can only be “published”.
    releaseobjectThe release itself.
    - -

    StatusEvent

    - -

    Triggered when the status of a Git commit changes.

    - -

    Hook name

    - -

    status

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    shastringThe Commit SHA.
    statestringThe new state. Can be pending, success, failure, or error.
    descriptionstringThe optional human-readable description added to the status.
    target_urlstringThe optional link added to the status.
    branchesarrayAn array of branch objects containing the status’ SHA. Each branch contains the given SHA, but the SHA may or may not be the head of the branch. The array includes a maximum of 10 branches.
    - -

    TeamAddEvent

    - -

    Triggered when a user is added to a team or when a repository is added to a team.

    - -

    Note: this event is created in users’ organization timelines.

    - -

    Hook name

    - -

    team_add

    - -

    Payload

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    teamobjectThe team that was modified. Note: older events may not include this in the payload.
    userobjectThe user that was added to this team.
    repoobjectThe repository that was added to this team.
    - -

    WatchEvent

    - -

    The WatchEvent is related to starring a repository, not watching. -See this API blog post for an explanation.

    - -

    The event’s actor is the user who starred a repository, and the -event’s repository is the repository that was starred.

    - -

    Hook name

    - -

    watch

    - -

    Payload

    - - - - - - - - - - - - - - - - -
    KeyTypeDescription
    actionstringThe action that was performed. Currently, can only be started.
    - - - - - - - - - - - - - - diff --git a/v3/activity/feeds/index.html b/v3/activity/feeds/index.html deleted file mode 100644 index ab6f7cf91f..0000000000 --- a/v3/activity/feeds/index.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - Feeds | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Feeds

    - - - -

    List Feeds

    - -

    GitHub provides several timeline resources in Atom format. The Feeds API -lists all the feeds available to the authenticating user:

    - -
      -
    • -Timeline: The GitHub global public timeline
    • -
    • -User: The public timeline for any user, using URI template -
    • -
    • -Current user public: The public timeline for the authenticated user
    • -
    • -Current user: The private timeline for the authenticated user
    • -
    • -Current user actor: The private timeline for activity created by the authenticated user
    • -
    • -Current user organization: The private timeline for the authenticated user for a given organization, using URI template -
    • -
    - -

    Note: Private feeds are only returned when authenticating via Basic -Auth since current feed URIs use the older, non revokable auth -tokens.

    - -
    GET /feeds
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "timeline_url": "https://github.com/timeline",
    -  "user_url": "https://github.com/{user}",
    -  "current_user_public": "https://github.com/defunkt",
    -  "current_user_url": "https://github.com/defunkt.private?token=abc123",
    -  "current_user_actor_url": "https://github.com/defunkt.private.actor?token=abc123",
    -  "current_user_organization_url": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
    -  "_links": {
    -    "timeline": {
    -      "href": "https://github.com/timeline",
    -      "type": "application/atom+xml"
    -    },
    -    "user": {
    -      "href": "https://github.com/{user}",
    -      "type": "application/atom+xml"
    -    },
    -    "current_user_public": {
    -      "href": "https://github.com/defunkt",
    -      "type": "application/atom+xml"
    -    },
    -    "current_user": {
    -      "href": "https://github.com/defunkt.private?token=abc123",
    -      "type": "application/atom+xml"
    -    },
    -    "current_user_actor": {
    -      "href": "https://github.com/defunkt.private.actor?token=abc123",
    -      "type": "application/atom+xml"
    -    },
    -    "current_user_organization": {
    -      "href": "https://github.com/organizations/{org}/defunkt.private.atom?token=abc123",
    -      "type": "application/atom+xml"
    -    }
    -  }
    -}
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/activity/index.html b/v3/activity/index.html deleted file mode 100644 index cd69c343a1..0000000000 --- a/v3/activity/index.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - - - Activity | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Activity

    - -

    Serving up the ‘social’ in Social Coding™, the Activity APIs provide access to -notifications, subscriptions, and timelines.

    - -

    Notifications

    - -

    Notifications of new comments are delivered to users. The Notifications -API lets you view these notifications and mark them as read.

    - -

    Starring

    - -

    Repository Starring is a feature that lets users bookmark repositories. Stars -are shown next to repositories to show an approximate level of interest. Stars -have no effect on notifications or the activity feed.

    - -

    Watching

    - -

    Watching a Repository registers the user to receive notifications on new -discussions, as well as events in the user’s activity feed.

    - -

    Events

    - -

    The Events API is a read-only interface to all the event -types that power the various activity streams on GitHub.

    - -

    Feeds

    - -

    List of Atom feeds available for the authenticating user.

    - - -
    - - - -
    - - - - - - - - diff --git a/v3/activity/notifications/index.html b/v3/activity/notifications/index.html deleted file mode 100644 index 399a5e7447..0000000000 --- a/v3/activity/notifications/index.html +++ /dev/null @@ -1,746 +0,0 @@ - - - - - - - - Notifications | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Notifications

    - - - -

    GitHub Notifications are powered by watched repositories. -Users receive notifications for discussions in repositories they watch -including:

    - -
      -
    • Issues and their comments
    • -
    • Pull Requests and their comments
    • -
    • Comments on any commits
    • -
    - -

    Notifications are also sent for discussions in unwatched repositories when the -user is involved including:

    - -
      -
    • @mentions
    • -
    • Issue assignments
    • -
    • Commits the user authors or commits
    • -
    • Any discussion in which the user actively participates
    • -
    - -

    All Notification API calls require the notifications or -repo API scopes. Doing this will give read-only access to -some Issue/Commit content. You will still need the “repo” scope to access -Issues and Commits from their respective endpoints.

    - -

    Notifications come back as “threads”. A Thread contains information about the -current discussion of an Issue/PullRequest/Commit.

    - -

    Notifications are optimized for polling with the “Last-Modified” header. If -there are no new notifications, you will see a “304 Not Modified” response, -leaving your current rate limit untouched. There is an “X-Poll-Interval” -header that specifies how often (in seconds) you are allowed to poll. In times -of high server load, the time may increase. Please obey the header.

    - -
    # Add authentication to your requests
    -$ curl -I https://api.github.com/notifications
    -HTTP/1.1 200 OK
    -Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
    -X-Poll-Interval: 60
    -
    -# Pass the Last-Modified header exactly
    -$ curl -I https://api.github.com/notifications
    -    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
    -HTTP/1.1 304 Not Modified
    -X-Poll-Interval: 60
    -
    - -

    Notification Reasons

    - -

    When retrieving responses from the Notifications API, each payload has a key titled -reason. These correspond to events that trigger a notification.

    - -

    Here’s a list of potential reasons for receiving a notification:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Reason NameDescription
    subscribedThe notification arrived because you’re watching the repository
    manualThe notification arrived because you’ve specifically decided to watch the item (via an Issue or Pull Request)
    authorThe notification arrived because you’ve created the item
    commentThe notification arrived because you’ve commented on the item
    mentionThe notification arrived because you were specifically @mentioned in the content
    team_mentionThe notification arrived because you were on a team that was mentioned (like @org/team)
    state_changeThe notification arrived because you changed the item state (like closing an Issue or merging a Pull Request)
    assignThe notification arrived because you were assigned to the Issue
    - -

    Note that the reason is modified on a per-thread basis, and can change, if the -reason on a later notification is different.

    - -

    For example, if you are the author of an issue, subsequent notifications on that -issue will have a reason of author. If you’re then @mentioned on the same -issue, the notifications you fetch thereafter will have a reason of mention. -The reason remains as mention, regardless of whether you’re ever mentioned again.

    - -

    List your notifications

    - -

    List all notifications for the current user, grouped by repository.

    - -
    GET /notifications
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    allbooleanIf true, show notifications marked as read. Default: false -
    participatingbooleanIf true, only shows notifications in which the user is directly participating or mentioned. Default: false -
    sincestringFilters out any notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: Time.now -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": "1",
    -    "repository": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World"
    -    },
    -    "subject": {
    -      "title": "Greetings",
    -      "url": "https://api.github.com/repos/pengwynn/octokit/issues/123",
    -      "latest_comment_url": "https://api.github.com/repos/pengwynn/octokit/issues/comments/123",
    -      "type": "Issue"
    -    },
    -    "reason": "subscribed",
    -    "unread": true,
    -    "updated_at": "2012-09-25T07:54:41-07:00",
    -    "last_read_at": "2012-09-25T07:54:41-07:00",
    -    "url": "https://api.github.com/notifications/threads/1"
    -  }
    -]
    - -

    List your notifications in a repository

    - -

    List all notifications for the current user.

    - -
    GET /repos/:owner/:repo/notifications
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    allbooleanIf true, show notifications marked as read. Default: false -
    participatingbooleanIf true, only shows notifications in which the user is directly participating or mentioned. Default: false -
    sincestringFilters out any notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: Time.now -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": "1",
    -    "repository": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World"
    -    },
    -    "subject": {
    -      "title": "Greetings",
    -      "url": "https://api.github.com/repos/pengwynn/octokit/issues/123",
    -      "latest_comment_url": "https://api.github.com/repos/pengwynn/octokit/issues/comments/123",
    -      "type": "Issue"
    -    },
    -    "reason": "subscribed",
    -    "unread": true,
    -    "updated_at": "2012-09-25T07:54:41-07:00",
    -    "last_read_at": "2012-09-25T07:54:41-07:00",
    -    "url": "https://api.github.com/notifications/threads/1"
    -  }
    -]
    - -

    Mark as read

    - -

    Marking a notification as “read” removes it from the default view -on GitHub.com.

    - -
    PUT /notifications
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    last_read_atstringDescribes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: Time.now -
    - -

    Response

    - -
    Status: 205 Reset Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Mark notifications as read in a repository

    - -

    Marking all notifications in a repository as “read” removes them -from the default view on GitHub.com.

    - -
    PUT /repos/:owner/:repo/notifications
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    last_read_atstringDescribes the last point that notifications were checked. Anything updated since this time will not be updated. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: Time.now -
    - -

    Response

    - -
    Status: 205 Reset Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    View a single thread

    - -
    GET /notifications/threads/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": "1",
    -  "repository": {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": false,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World"
    -  },
    -  "subject": {
    -    "title": "Greetings",
    -    "url": "https://api.github.com/repos/pengwynn/octokit/issues/123",
    -    "latest_comment_url": "https://api.github.com/repos/pengwynn/octokit/issues/comments/123",
    -    "type": "Issue"
    -  },
    -  "reason": "subscribed",
    -  "unread": true,
    -  "updated_at": "2012-09-25T07:54:41-07:00",
    -  "last_read_at": "2012-09-25T07:54:41-07:00",
    -  "url": "https://api.github.com/notifications/threads/1"
    -}
    - -

    Mark a thread as read

    - -
    PATCH /notifications/threads/:id
    -
    - -

    Response

    - -
    Status: 205 Reset Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Get a Thread Subscription

    - -

    This checks to see if the current user is subscribed to a thread. You can also -get a Repository subscription.

    - -
    GET /notifications/threads/:id/subscription
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "subscribed": true,
    -  "ignored": false,
    -  "reason": null,
    -  "created_at": "2012-10-06T21:34:12Z",
    -  "url": "https://api.github.com/notifications/threads/1/subscription",
    -  "thread_url": "https://api.github.com/notifications/threads/1"
    -}
    - -

    Set a Thread Subscription

    - -

    This lets you subscribe to a thread, or ignore it. Subscribing to a thread -is unnecessary if the user is already subscribed to the repository. Ignoring -a thread will mute all future notifications (until you comment or get -@mentioned).

    - -
    PUT /notifications/threads/:id/subscription
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    subscribedbooleanDetermines if notifications should be received from this thread
    ignoredbooleanDetermines if all notifications should be blocked from this thread
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "subscribed": true,
    -  "ignored": false,
    -  "reason": null,
    -  "created_at": "2012-10-06T21:34:12Z",
    -  "url": "https://api.github.com/notifications/threads/1/subscription",
    -  "thread_url": "https://api.github.com/notifications/threads/1"
    -}
    - -

    Delete a Thread Subscription

    - -
    DELETE /notifications/threads/:id/subscription
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/activity/starring/index.html b/v3/activity/starring/index.html deleted file mode 100644 index 38daf40cee..0000000000 --- a/v3/activity/starring/index.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - - Starring | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Starring

    - - - -

    Repository Starring is a feature that lets users bookmark repositories. Stars -are shown next to repositories to show an approximate level of interest. Stars -have no effect on notifications or the activity feed. For that, see Repository -Watching.

    - -

    Starring vs. Watching

    - -

    In August 2012, we changed the way watching -works on GitHub. Many API -client applications may be using the original “watcher” endpoints for accessing -this data. You can now start using the “star” endpoints instead (described -below). Check out the Watcher API Change post -for more details.

    - -

    List Stargazers

    - -
    GET /repos/:owner/:repo/stargazers
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    List repositories being starred

    - -

    List repositories being starred by a user.

    - -
    GET /users/:user/starred
    -
    - -

    List repositories being starred by the authenticated user.

    - -
    GET /user/starred
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sortstringOne of created (when the repository was starred) or updated (when it was last pushed to). Default: created -
    directionstringOne of asc (ascending) or desc (descending). Default: desc -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": false,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  }
    -]
    - -

    Check if you are starring a repository

    - -

    Requires for the user to be authenticated.

    - -
    GET /user/starred/:owner/:repo
    -
    - -

    Response if this repository is starred by you

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if this repository is not starred by you

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Star a repository

    - -

    Requires for the user to be authenticated.

    - -
    PUT /user/starred/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Unstar a repository

    - -

    Requires for the user to be authenticated.

    - -
    DELETE /user/starred/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/activity/watching/index.html b/v3/activity/watching/index.html deleted file mode 100644 index d82711197e..0000000000 --- a/v3/activity/watching/index.html +++ /dev/null @@ -1,486 +0,0 @@ - - - - - - - - Watching | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Watching

    - - - -

    Watching a Repository registers the user to receive notifications on new -discussions, as well as events in the user’s activity feed. See Repository -Starring for simple repository bookmarks.

    - -

    Watching vs. Starring

    - -

    In August 2012, we changed the way watching -works on GitHub. At the time -of that change, many API clients were already using the existing “watcher” -endpoints to access starring data. To avoid breaking those applications, the -legacy “watcher” endpoints continue to provide starring data.

    - -

    To provide access to watching data, the v3 Watcher API uses the “subscription” -endpoints described below. Check out the Watcher API Change -post for more details.

    - -

    List watchers

    - -
    GET /repos/:owner/:repo/subscribers
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    List repositories being watched

    - -

    List repositories being watched by a user.

    - -
    GET /users/:user/subscriptions
    -
    - -

    List repositories being watched by the authenticated user.

    - -
    GET /user/subscriptions
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": false,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  }
    -]
    - -

    Get a Repository Subscription

    - -
    GET /repos/:owner/:repo/subscription
    -
    - -

    Response if you are subscribed to the repository

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "subscribed": true,
    -  "ignored": false,
    -  "reason": null,
    -  "created_at": "2012-10-06T21:34:12Z",
    -  "url": "https://api.github.com/repos/octocat/example/subscription",
    -  "repository_url": "https://api.github.com/repos/octocat/example"
    -}
    - -

    Response if you are not subscribed to the repository

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Set a Repository Subscription

    - -
    PUT /repos/:owner/:repo/subscription
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    subscribedbooleanDetermines if notifications should be received from this repository.
    ignoredbooleanDetermines if all notifications should be blocked from this repository.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "subscribed": true,
    -  "ignored": false,
    -  "reason": null,
    -  "created_at": "2012-10-06T21:34:12Z",
    -  "url": "https://api.github.com/repos/octocat/example/subscription",
    -  "repository_url": "https://api.github.com/repos/octocat/example"
    -}
    - -

    Delete a Repository Subscription

    - -
    DELETE /repos/:owner/:repo/subscription
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Check if you are watching a repository (LEGACY)

    - -

    Requires for the user to be authenticated.

    - -
    GET /user/subscriptions/:owner/:repo
    -
    - -

    Response if this repository is watched by you

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if this repository is not watched by you

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Watch a repository (LEGACY)

    - -

    Requires for the user to be authenticated.

    - -
    PUT /user/subscriptions/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Stop watching a repository (LEGACY)

    - -

    Requires for the user to be authenticated.

    - -
    DELETE /user/subscriptions/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/auth/index.html b/v3/auth/index.html deleted file mode 100644 index 9bae2b4629..0000000000 --- a/v3/auth/index.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - Other Authentication Methods | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Other Authentication Methods

    - - - -

    While the API provides multiple methods for authentication, we strongly -recommend using OAuth for production applications. The other -methods provided are intended to be used for scripts or testing (i.e., cases -where full OAuth would be overkill). Third party applications that rely on -GitHub for authentication should not ask for or collect GitHub credentials. -Instead, they should use the OAuth web flow.

    - -

    Basic Authentication

    - -

    The API supports Basic Authentication as defined in -RFC2617 with a few slight differences. -The main difference is that the RFC requires unauthenticated requests to be -answered with 401 Unauthorized responses. In many places, this would disclose -the existence of user data. Instead, the GitHub API responds with 404 Not Found. -This may cause problems for HTTP libraries that assume a 401 Unauthorized -response. The solution is to manually craft the Authorization header.

    - -

    Via Username and Password

    - -

    To use Basic Authentication with the GitHub API, simply send the username and -password associated with the account.

    - -

    For example, if you’re accessing the API via cURL, the following command -would authenticate you if you replace <username> with your GitHub username. -(cURL will prompt you to enter the password.)

    - -
    -$ curl -u <username> https://api.github.com/user
    -
    - -

    Via OAuth Tokens

    - -

    Alternatively, you can authenticate using personal access -tokens or OAuth tokens. To do so, provide the token as -the username and provide a blank password or a password of x-oauth-basic. If -you’re accessing the API via cURL, replace <token> with your OAuth token in -the following command:

    - -
    -$ curl -u <token>:x-oauth-basic https://api.github.com/user
    -
    - -

    This approach is useful if your tools only support Basic Authentication but you -want to take advantage of OAuth access token security features.

    - -

    Working with two-factor authentication

    - -

    For users with two-factor authentication enabled, Basic Authentication requires -an extra step. When you attempt to authenticate with Basic Authentication, the -server will respond with a 401 and an X-GitHub-OTP: required;:2fa-type -header. This indicates that a two-factor authentication code is needed (in -addition to the username and password). The :2fa-type in this header indicates -whether the account receives its two-factor authentication codes via SMS or via -an application.

    - -

    In addition to the Basic Authentication credentials, you must send the user’s -authentication code (i.e., one-time password) in the X-GitHub-OTP header. -Because these authentication codes expire quickly, we recommend using the -Authorizations API to create an access token and using that -token to authenticate via OAuth for most API access.

    - -

    Alternately, you can create access tokens from the Personal Access Token -section of your application settings page.

    - - -
    - - - -
    - - - - - - - - diff --git a/v3/emojis/index.html b/v3/emojis/index.html deleted file mode 100644 index e9c2cbe840..0000000000 --- a/v3/emojis/index.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - Emojis | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Emojis

    - -

    Lists all the emojis available to use on GitHub.

    - -
    GET /emojis
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "+1": "https://github.global.ssl.fastly.net/images/icons/emoji/+1.png?v5",
    -  "-1": "https://github.global.ssl.fastly.net/images/icons/emoji/-1.png?v5",
    -  "100": "https://github.global.ssl.fastly.net/images/icons/emoji/100.png?v5",
    -  "1234": "https://github.global.ssl.fastly.net/images/icons/emoji/1234.png?v5",
    -  "8ball": "https://github.global.ssl.fastly.net/images/icons/emoji/8ball.png?v5",
    -  "a": "https://github.global.ssl.fastly.net/images/icons/emoji/a.png?v5",
    -  "ab": "https://github.global.ssl.fastly.net/images/icons/emoji/ab.png?v5"
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/gists/comments/index.html b/v3/gists/comments/index.html deleted file mode 100644 index c65ea81d29..0000000000 --- a/v3/gists/comments/index.html +++ /dev/null @@ -1,467 +0,0 @@ - - - - - - - - Gist Comments | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Comments

    - - - -

    Gist Comments use these custom media types. -You can read more about the use of media types in the API -here.

    - -

    List comments on a gist

    - -
    GET /gists/:gist_id/comments
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/gists/5fdb90f9c62f2fc08aca/comments/1",
    -    "body": "Just commenting for the sake of commenting",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "created_at": "2011-04-18T23:23:56Z",
    -    "updated_at": "2011-04-18T23:23:56Z"
    -  }
    -]
    - -

    Get a single comment

    - -
    GET /gists/:gist_id/comments/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/gists/5fdb90f9c62f2fc08aca/comments/1",
    -  "body": "Just commenting for the sake of commenting",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-18T23:23:56Z",
    -  "updated_at": "2011-04-18T23:23:56Z"
    -}
    - -

    Create a comment

    - -
    POST /gists/:gist_id/comments
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The comment text.
    - -
    {
    -  "body": "Just commenting for the sake of commenting"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/gists/comments/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/gists/5fdb90f9c62f2fc08aca/comments/1",
    -  "body": "Just commenting for the sake of commenting",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-18T23:23:56Z",
    -  "updated_at": "2011-04-18T23:23:56Z"
    -}
    - -

    Edit a comment

    - -
    PATCH /gists/:gist_id/comments/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The comment text.
    - -
    {
    -  "body": "Just commenting for the sake of commenting"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/gists/5fdb90f9c62f2fc08aca/comments/1",
    -  "body": "Just commenting for the sake of commenting",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-18T23:23:56Z",
    -  "updated_at": "2011-04-18T23:23:56Z"
    -}
    - -

    Delete a comment

    - -
    DELETE /gists/:gist_id/comments/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Custom media types

    - -

    These are the supported media types for gist comments. You can read more about the -use of media types in the API here.

    - -
    application/vnd.github.VERSION.raw+json
    -application/vnd.github.VERSION.text+json
    -application/vnd.github.VERSION.html+json
    -application/vnd.github.VERSION.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/gists/index.html b/v3/gists/index.html deleted file mode 100644 index fa6e7a657a..0000000000 --- a/v3/gists/index.html +++ /dev/null @@ -1,901 +0,0 @@ - - - - - - - - Gists | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Gists

    - - - -

    Authentication

    - -

    You can read public gists and create them for anonymous users without a token; however, to read or write gists on a user’s behalf the gist OAuth scope is required.

    - - - -

    List gists

    - -

    List a user’s gists:

    - -
    GET /users/:user/gists
    -
    - -

    List the authenticated user’s gists or if called anonymously, this will -return all public gists:

    - -
    GET /gists
    -
    - -

    List all public gists:

    - -
    GET /gists/public
    -
    - -

    List the authenticated user’s starred gists:

    - -
    GET /gists/starred
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sincestringA timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Only gists updated at or after this time are returned.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/gists/52d1088bfa3942b7d9e9",
    -    "forks_url": "https://api.github.com/gists/138441fbfbb83b69eb88/forks",
    -    "commits_url": "https://api.github.com/gists/527d2cbfe0b72a450755/commits",
    -    "id": "1",
    -    "description": "description of gist",
    -    "public": true,
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "files": {
    -      "ring.erl": {
    -        "size": 932,
    -        "filename": "ring.erl",
    -        "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl",
    -        "type": "text/plain",
    -        "language": "Erlang"
    -      }
    -    },
    -    "comments": 0,
    -    "comments_url": "https://api.github.com/gists/276c6fc7a6b1d997f727/comments/",
    -    "html_url": "https://gist.github.com/1",
    -    "git_pull_url": "git://gist.github.com/1.git",
    -    "git_push_url": "git@gist.github.com:1.git",
    -    "created_at": "2010-04-14T02:15:15Z",
    -    "updated_at": "2011-06-20T11:34:15Z"
    -  }
    -]
    - -

    Get a single gist

    - -
    GET /gists/:id
    -
    - -

    Response

    - -
    -

    - Note: When using the v3 media type, the user attribute is renamed to owner. -

    -
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/gists/52d1088bfa3942b7d9e9",
    -  "forks_url": "https://api.github.com/gists/138441fbfbb83b69eb88/forks",
    -  "commits_url": "https://api.github.com/gists/527d2cbfe0b72a450755/commits",
    -  "id": "1",
    -  "description": "description of gist",
    -  "public": true,
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "files": {
    -    "size": 932,
    -    "filename": "ring.erl",
    -    "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl",
    -    "type": "text/plain",
    -    "language": "Erlang",
    -    "content": "contents of gist"
    -  },
    -  "comments": 0,
    -  "comments_url": "https://api.github.com/gists/276c6fc7a6b1d997f727/comments/",
    -  "html_url": "https://gist.github.com/1",
    -  "git_pull_url": "git://gist.github.com/1.git",
    -  "git_push_url": "git@gist.github.com:1.git",
    -  "created_at": "2010-04-14T02:15:15Z",
    -  "updated_at": "2011-06-20T11:34:15Z",
    -  "forks": [
    -    {
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "url": "https://api.github.com/gists/cc146e60027bd8167f0c",
    -      "id": 1,
    -      "created_at": "2011-04-14T16:00:49Z",
    -      "updated_at": "2011-04-14T16:00:49Z"
    -    }
    -  ],
    -  "history": [
    -    {
    -      "url": "https://api.github.com/gists/89270403532ee5c32714",
    -      "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "change_status": {
    -        "deletions": 0,
    -        "additions": 180,
    -        "total": 180
    -      },
    -      "committed_at": "2010-04-14T02:15:15Z"
    -    }
    -  ]
    -}
    - -

    Create a gist

    - -
    POST /gists
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    fileshash -Required. Files that make up this gist.
    descriptionstringA description of the gist.
    publicbooleanIndicates whether the gist is public. Default: false -
    - -

    The keys in the files hash are the string filename, and the value is another hash with a key of content, and a value of the file contents. For example:

    - -
    {
    -  "description": "the description for this gist",
    -  "public": true,
    -  "files": {
    -    "file1.txt": {
    -      "content": "String file contents"
    -    }
    -  }
    -}
    - -

    Note: Don’t name your files “gistfile” with a numerical suffix. This is the -format of the automatic naming scheme that Gist uses internally.

    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/gists/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/gists/52d1088bfa3942b7d9e9",
    -  "forks_url": "https://api.github.com/gists/138441fbfbb83b69eb88/forks",
    -  "commits_url": "https://api.github.com/gists/527d2cbfe0b72a450755/commits",
    -  "id": "1",
    -  "description": "description of gist",
    -  "public": true,
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "files": {
    -    "size": 932,
    -    "filename": "ring.erl",
    -    "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl",
    -    "type": "text/plain",
    -    "language": "Erlang",
    -    "content": "contents of gist"
    -  },
    -  "comments": 0,
    -  "comments_url": "https://api.github.com/gists/276c6fc7a6b1d997f727/comments/",
    -  "html_url": "https://gist.github.com/1",
    -  "git_pull_url": "git://gist.github.com/1.git",
    -  "git_push_url": "git@gist.github.com:1.git",
    -  "created_at": "2010-04-14T02:15:15Z",
    -  "updated_at": "2011-06-20T11:34:15Z",
    -  "forks": [
    -    {
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "url": "https://api.github.com/gists/cc146e60027bd8167f0c",
    -      "id": 1,
    -      "created_at": "2011-04-14T16:00:49Z",
    -      "updated_at": "2011-04-14T16:00:49Z"
    -    }
    -  ],
    -  "history": [
    -    {
    -      "url": "https://api.github.com/gists/89270403532ee5c32714",
    -      "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "change_status": {
    -        "deletions": 0,
    -        "additions": 180,
    -        "total": 180
    -      },
    -      "committed_at": "2010-04-14T02:15:15Z"
    -    }
    -  ]
    -}
    - -

    Edit a gist

    - -
    PATCH /gists/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    descriptionstringA description of the gist.
    fileshashFiles that make up this gist.
    contentstringUpdated file contents.
    filenamestringNew name for this file.
    - -

    The keys in the files hash are the string filename. The value is another hash with a key of content (indicating the new contents), or filename (indicating the new filename). For example:

    - -
    {
    -  "description": "the description for this gist",
    -  "files": {
    -    "file1.txt": {
    -      "content": "updated file contents"
    -    },
    -    "old_name.txt": {
    -      "filename": "new_name.txt",
    -      "content": "modified contents"
    -    },
    -    "new_file.txt": {
    -      "content": "a new file"
    -    },
    -    "delete_this_file.txt": null
    -  }
    -}
    - -

    NOTE: All files from the previous version of the gist are carried over by -default if not included in the hash. Deletes can be performed by -including the filename with a null hash.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/gists/52d1088bfa3942b7d9e9",
    -  "forks_url": "https://api.github.com/gists/138441fbfbb83b69eb88/forks",
    -  "commits_url": "https://api.github.com/gists/527d2cbfe0b72a450755/commits",
    -  "id": "1",
    -  "description": "description of gist",
    -  "public": true,
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "files": {
    -    "size": 932,
    -    "filename": "ring.erl",
    -    "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl",
    -    "type": "text/plain",
    -    "language": "Erlang",
    -    "content": "contents of gist"
    -  },
    -  "comments": 0,
    -  "comments_url": "https://api.github.com/gists/276c6fc7a6b1d997f727/comments/",
    -  "html_url": "https://gist.github.com/1",
    -  "git_pull_url": "git://gist.github.com/1.git",
    -  "git_push_url": "git@gist.github.com:1.git",
    -  "created_at": "2010-04-14T02:15:15Z",
    -  "updated_at": "2011-06-20T11:34:15Z",
    -  "forks": [
    -    {
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "url": "https://api.github.com/gists/cc146e60027bd8167f0c",
    -      "id": 1,
    -      "created_at": "2011-04-14T16:00:49Z",
    -      "updated_at": "2011-04-14T16:00:49Z"
    -    }
    -  ],
    -  "history": [
    -    {
    -      "url": "https://api.github.com/gists/89270403532ee5c32714",
    -      "version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "change_status": {
    -        "deletions": 0,
    -        "additions": 180,
    -        "total": 180
    -      },
    -      "committed_at": "2010-04-14T02:15:15Z"
    -    }
    -  ]
    -}
    - -

    Star a gist

    - -
    PUT /gists/:id/star
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Unstar a gist

    - -
    DELETE /gists/:id/star
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Check if a gist is starred

    - -
    GET /gists/:id/star
    -
    - -

    Response if gist is starred

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if gist is not starred

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Fork a gist

    - -
    POST /gists/:id/forks
    -
    - -

    Note: This was previously /gists/:id/fork

    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/gists/2
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/gists/52d1088bfa3942b7d9e9",
    -  "forks_url": "https://api.github.com/gists/138441fbfbb83b69eb88/forks",
    -  "commits_url": "https://api.github.com/gists/527d2cbfe0b72a450755/commits",
    -  "id": "1",
    -  "description": "description of gist",
    -  "public": true,
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "files": {
    -    "ring.erl": {
    -      "size": 932,
    -      "filename": "ring.erl",
    -      "raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/ring.erl",
    -      "type": "text/plain",
    -      "language": "Erlang"
    -    }
    -  },
    -  "comments": 0,
    -  "comments_url": "https://api.github.com/gists/276c6fc7a6b1d997f727/comments/",
    -  "html_url": "https://gist.github.com/1",
    -  "git_pull_url": "git://gist.github.com/1.git",
    -  "git_push_url": "git@gist.github.com:1.git",
    -  "created_at": "2010-04-14T02:15:15Z",
    -  "updated_at": "2011-06-20T11:34:15Z"
    -}
    - -

    Delete a gist

    - -
    DELETE /gists/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/git/blobs/index.html b/v3/git/blobs/index.html deleted file mode 100644 index a39cbd6336..0000000000 --- a/v3/git/blobs/index.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - - Git Blobs | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Blobs

    - - - -

    Since blobs can be any arbitrary binary data, the input and responses -for the blob API takes an encoding parameter that can be either utf-8 -or base64. If your data cannot be losslessly sent as a UTF-8 string, -you can base64 encode it.

    - -

    Blobs leverage these custom media types. You can -read more about the use of media types in the API here.

    - -

    Get a Blob

    - -
    GET /repos/:owner/:repo/git/blobs/:sha
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "content": "Content of the blob",
    -  "encoding": "utf-8",
    -  "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15",
    -  "size": 100
    -}
    - -

    Create a Blob

    - -
    POST /repos/:owner/:repo/git/blobs
    -
    - -

    Input

    - -
    {
    -  "content": "Content of the blob",
    -  "encoding": "utf-8"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/git/:owner/:repo/blob/:sha
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15"
    -}
    - -

    Custom media types

    - -

    These are the supported media types for blobs. You can read more about the -use of media types in the API here.

    - -
    application/json
    -application/vnd.github.VERSION.raw
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/git/commits/index.html b/v3/git/commits/index.html deleted file mode 100644 index c733272186..0000000000 --- a/v3/git/commits/index.html +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - Git Commits | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Commits

    - - - -

    Get a Commit

    - -
    GET /repos/:owner/:repo/git/commits/:sha
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
    -  "author": {
    -    "date": "2010-04-10T14:10:01-07:00",
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "committer": {
    -    "date": "2010-04-10T14:10:01-07:00",
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "message": "added readme, because im a good github citizen\n",
    -  "tree": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
    -    "sha": "691272480426f78a0138979dd3ce63b77f706feb"
    -  },
    -  "parents": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -      "sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5"
    -    }
    -  ]
    -}
    - -

    Create a Commit

    - -
    POST /repos/:owner/:repo/git/commits
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    messagestring -Required. The commit message
    treestring -Required. The SHA of the tree object this commit points to
    parents -array of strings -Required. The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided.
    - -

    Optional Parameters

    - -

    You can provide an additional commiter parameter, which is a hash containing -information about the committer. Or, you can provide an author parameter, which -is a hash containing information about the author.

    - -

    The committer section is optional and will be filled with the author -data if omitted. If the author section is omitted, it will be filled -in with the authenticated user’s information and the current date.

    - -

    Both the author and commiter parameters have the same keys:

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe name of the author (or commiter) of the commit
    emailstringThe email of the author (or commiter) of the commit
    datestringIndicates when this commit was authored (or committed). This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Example Input

    - -
    {
    -  "message": "my commit message",
    -  "author": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com",
    -    "date": "2008-07-09T16:13:30+12:00"
    -  },
    -  "parents": [
    -    "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
    -  ],
    -  "tree": "827efc6d56897b048c772eb4087f854f46256132"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/git/:owner/:repo/commit/:sha
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
    -  "author": {
    -    "date": "2008-07-09T16:13:30+12:00",
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "committer": {
    -    "date": "2008-07-09T16:13:30+12:00",
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "message": "my commit message",
    -  "tree": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132",
    -    "sha": "827efc6d56897b048c772eb4087f854f46256132"
    -  },
    -  "parents": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0",
    -      "sha": "7d1b31e74ee336d15cbd21741bc88a537ed063a0"
    -    }
    -  ]
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/git/index.html b/v3/git/index.html deleted file mode 100644 index 6fcebebb26..0000000000 --- a/v3/git/index.html +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - Git Data | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Git Data

    - -

    The Git Database API gives you access to read and write raw Git objects -to your Git database on GitHub and to list and update your references -(branch heads and tags).

    - -

    This basically allows you to reimplement a lot of Git functionality over -our API - by creating raw objects directly into the database and updating -branch references you could technically do just about anything that Git -can do without having Git installed.

    - -

    Git DB API functions will return a 409 Conflict if the git repository for a Repository is empty -or unavailable. This typically means it is being created still. Contact -Support if this response status persists.

    - -

    git db

    - -

    For more information on the Git object database, please read the -Git Internals chapter of -the Pro Git book.

    - -

    As an example, if you wanted to commit a change to a file in your -repository, you would:

    - -
      -
    • get the current commit object
    • -
    • retrieve the tree it points to
    • -
    • retrieve the content of the blob object that tree has for that particular file path
    • -
    • change the content somehow and post a new blob object with that new content, getting a blob SHA back
    • -
    • post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back
    • -
    • create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back
    • -
    • update the reference of your branch to point to the new commit SHA
    • -
    - -

    It might seem complex, but it’s actually pretty simple when you understand -the model and it opens up a ton of things you could potentially do with the API.

    - -
    - - - -
    - - - - - - - - diff --git a/v3/git/refs/index.html b/v3/git/refs/index.html deleted file mode 100644 index c316b0653a..0000000000 --- a/v3/git/refs/index.html +++ /dev/null @@ -1,442 +0,0 @@ - - - - - - - - Git Refs | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    References

    - - - -

    Get a Reference

    - -
    GET /repos/:owner/:repo/git/refs/:ref
    -
    - -

    The ref in the URL must be formatted as heads/branch, not just branch. For example, the call to get the data for a branch named skunkworkz/featureA would be:

    - -
    GET /repos/:owner/:repo/git/refs/heads/skunkworkz/featureA
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "ref": "refs/heads/sc/featureA",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA",
    -  "object": {
    -    "type": "commit",
    -    "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
    -  }
    -}
    - -

    Get all References

    - -
    GET /repos/:owner/:repo/git/refs
    -
    - -

    This will return an array of all the references on the system, including -things like notes and stashes if they exist on the server. Anything in -the namespace, not just heads and tags, though that would be the -most common.

    - -

    You can also request a sub-namespace. For example, to get all the tag -references, you can call:

    - -
    GET /repos/:owner/:repo/git/refs/tags
    -
    - -

    For a full refs listing, you’ll get something that looks like:

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "ref": "refs/heads/master",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/master",
    -    "object": {
    -      "type": "commit",
    -      "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
    -    }
    -  },
    -  {
    -    "ref": "refs/heads/gh-pages",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/gh-pages",
    -    "object": {
    -      "type": "commit",
    -      "sha": "612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/612077ae6dffb4d2fbd8ce0cccaa58893b07b5ac"
    -    }
    -  },
    -  {
    -    "ref": "refs/tags/v0.0.1",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.0.1",
    -    "object": {
    -      "type": "tag",
    -      "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac"
    -    }
    -  }
    -]
    - -

    Create a Reference

    - -
    POST /repos/:owner/:repo/git/refs
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    reftypeThe name of the fully qualified reference (ie: refs/heads/master). If it doesn’t start with ‘refs’ and have at least two slashes, it will be rejected.
    shatypeThe SHA1 value to set this reference to
    - -

    Input

    - -
    {
    -  "ref": "refs/heads/master",
    -  "sha": "827efc6d56897b048c772eb4087f854f46256132"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "ref": "refs/heads/sc/featureA",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA",
    -  "object": {
    -    "type": "commit",
    -    "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
    -  }
    -}
    - -

    Update a Reference

    - -
    PATCH /repos/:owner/:repo/git/refs/:ref
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    shatypeThe SHA1 value to set this reference to
    forcebooleanIndicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to false will make sure you’re not overwriting work. Default: false -
    - -

    Input

    - -
    {
    -  "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd",
    -  "force": true
    -}
    - -

    Response

    - -
    Status: 200 OK
    -Location: https://api.github.com/git/:owner/:repo/commit/:sha
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "ref": "refs/heads/sc/featureA",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/heads/sc/featureA",
    -  "object": {
    -    "type": "commit",
    -    "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd"
    -  }
    -}
    - -

    Delete a Reference

    - -
    DELETE /repos/:owner/:repo/git/refs/:ref
    -
    - -

    Example: Deleting a branch:

    - -
    DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a
    -
    - -

    Example: Deleting a tag:

    - -
    DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/git/tags/index.html b/v3/git/tags/index.html deleted file mode 100644 index d557457931..0000000000 --- a/v3/git/tags/index.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - Git Tags | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Tags

    - - - -

    This tags API only deals with tag objects - so only annotated tags, not -lightweight tags.

    - -

    Get a Tag

    - -
    GET /repos/:owner/:repo/git/tags/:sha
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "tag": "v0.0.1",
    -  "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac",
    -  "message": "initial version\n",
    -  "tagger": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com",
    -    "date": "2011-06-17T14:53:35-07:00"
    -  },
    -  "object": {
    -    "type": "commit",
    -    "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
    -  }
    -}
    - -

    Create a Tag Object

    - -

    Note that creating a tag object does not create the reference that -makes a tag in Git. If you want to create an annotated tag in Git, -you have to do this call to create the tag object, and then -create the refs/tags/[tag] reference. -If you want to create a lightweight tag, you only have to -create the tag reference - this call -would be unnecessary.

    - -
    POST /repos/:owner/:repo/git/tags
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tagstringThe tag
    messagestringThe tag message
    objectstringThe SHA of the git object this is tagging
    typestringThe type of the object we’re tagging. Normally this is a commit but it can also be a tree or a blob.
    taggerhashA hash with information about the individual creating the tag.
    - -

    The tagger hash contains the following keys:

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe name of the author of the tag
    emailstringThe email of the author of the tag
    datestringWhen this object was tagged. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Example Input

    - -
    {
    -  "tag": "v0.0.1",
    -  "message": "initial version\n",
    -  "object": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
    -  "type": "commit",
    -  "tagger": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com",
    -    "date": "2011-06-17T14:53:35-07:00"
    -  }
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/:owner/:repo/git/tags/:sha
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "tag": "v0.0.1",
    -  "sha": "940bd336248efae0f9ee5bc7b2d5c985887b16ac",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac",
    -  "message": "initial version\n",
    -  "tagger": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com",
    -    "date": "2011-06-17T14:53:35-07:00"
    -  },
    -  "object": {
    -    "type": "commit",
    -    "sha": "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c"
    -  }
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/git/trees/index.html b/v3/git/trees/index.html deleted file mode 100644 index e019712361..0000000000 --- a/v3/git/trees/index.html +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - Git Trees | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Trees

    - - - -

    Get a Tree

    - -
    GET /repos/:owner/:repo/git/trees/:sha
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
    -  "tree": [
    -    {
    -      "path": "file.rb",
    -      "mode": "100644",
    -      "type": "blob",
    -      "size": 30,
    -      "sha": "44b4fc6d56897b048c772eb4087f854f46256132",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132"
    -    },
    -    {
    -      "path": "subdir",
    -      "mode": "040000",
    -      "type": "tree",
    -      "sha": "f484d249c660418515fb01c2b9662073663c242e",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e"
    -    },
    -    {
    -      "path": "exec_file",
    -      "mode": "100755",
    -      "type": "blob",
    -      "size": 75,
    -      "sha": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
    -    }
    -  ]
    -}
    - -

    Get a Tree Recursively

    - -
    GET /repos/:owner/:repo/git/trees/:sha?recursive=1
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "fc6274d15fa3ae2ab983129fb037999f264ba9a7",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7",
    -  "tree": [
    -    {
    -      "path": "subdir/file.txt",
    -      "mode": "100644",
    -      "type": "blob",
    -      "size": 132,
    -      "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
    -    }
    -  ]
    -}
    - -

    Create a Tree

    - -

    The tree creation API will take nested entries as well. If both a -tree and a nested path modifying that tree are specified, it will -overwrite the contents of that tree with the new path contents and write -a new tree out.

    - -
    POST /repos/:owner/:repo/git/trees
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tree -array of hashes -Required. Objects (of path, mode, type, and sha) specifying a tree structure
    base_treestringThe SHA1 of the tree you want to update with new data. If you don’t set this, the commit will be created on top of everything; however, it will only contain your change, the rest of your files will show up as deleted.
    - -

    The tree parameter takes the following keys:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pathstringThe file referenced in the tree
    modestringThe file mode; one of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit), or 120000 for a blob that specifies the path of a symlink
    typestringEither blob, tree, or commit -
    shastringThe SHA1 checksum ID of the object in the tree
    contentstringThe content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or tree.sha.
    - -

    Input

    - -
    {
    -  "base_tree": "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
    -  "tree": [
    -    {
    -      "path": "file.rb",
    -      "mode": "100644",
    -      "type": "blob",
    -      "sha": "44b4fc6d56897b048c772eb4087f854f46256132"
    -    }
    -  ]
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/:owner/:repo/git/trees/:sha
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "cd8274d15fa3ae2ab983129fb037999f264ba9a7",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/trees/cd8274d15fa3ae2ab983129fb037999f264ba9a7",
    -  "tree": [
    -    {
    -      "path": "file.rb",
    -      "mode": "100644",
    -      "type": "blob",
    -      "size": 132,
    -      "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
    -    }
    -  ]
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/gitignore/index.html b/v3/gitignore/index.html deleted file mode 100644 index 06a2eb8364..0000000000 --- a/v3/gitignore/index.html +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - - Gitignore | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Gitignore

    - - - -

    When you create a new GitHub repository via the API, you can specify a -.gitignore template to apply to the repository upon creation. The -.gitignore Templates API lists and fetches templates from the GitHub .gitignore repository.

    - -

    Listing available templates

    - -

    List all templates available to pass as an option when creating a repository.

    - -
    GET /gitignore/templates
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  "Actionscript",
    -  "Android",
    -  "AppceleratorTitanium",
    -  "Autotools",
    -  "Bancha",
    -  "C",
    -  "C++"
    -]
    - -

    Get a single template

    - -

    The API also allows fetching the source of a single template.

    - -
    GET /gitignore/templates/C
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "name": "C",
    -  "source": "# Object files\n*.o\n\n# Libraries\n*.lib\n*.a\n\n# Shared objects (inc. Windows DLLs)\n*.dll\n*.so\n*.so.*\n*.dylib\n\n# Executables\n*.exe\n*.out\n*.app\n"
    -}
    - -

    Use the raw media type to get the raw contents.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    -# Object files
    -*.o
    -
    -# Libraries
    -*.lib
    -*.a
    -
    -# Shared objects (inc. Windows DLLs)
    -*.dll
    -*.so
    -*.so.*
    -*.dylib
    -
    -# Executables
    -*.exe
    -*.out
    -*.app
    -
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/index.html b/v3/index.html deleted file mode 100644 index a397b8f0d6..0000000000 --- a/v3/index.html +++ /dev/null @@ -1,920 +0,0 @@ - - - - - - - - GitHub API v3 - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Overview

    - -

    This describes the resources that make up the official GitHub API v3. If you have any problems or requests please contact -support.

    - - - -

    Current Version

    - -

    There are two versions of the GitHub API: beta and v3. By default, all requests receive the beta version:

    - -
    Accept: application/vnd.github.beta+json
    -
    - -

    Soon, v3 will become the default version. Check out the blog post for details.

    - -

    We encourage you to request a specific version via the Accept header.

    - -

    Schema

    - -

    All API access is over HTTPS, and accessed from the api.github.com -domain (or through yourdomain.com/api/v3/ for enterprise). All data is -sent and received as JSON.

    - -
    -$ curl -i https://api.github.com/users/octocat/orgs
    -
    -HTTP/1.1 200 OK
    -Server: nginx
    -Date: Fri, 12 Oct 2012 23:33:14 GMT
    -Content-Type: application/json; charset=utf-8
    -Connection: keep-alive
    -Status: 200 OK
    -ETag: "a00049ba79152d03380c34652f2cb612"
    -X-GitHub-Media-Type: github.beta
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4987
    -X-RateLimit-Reset: 1350085394
    -Content-Length: 5
    -Cache-Control: max-age=0, private, must-revalidate
    -X-Content-Type-Options: nosniff
    -
    -[]
    -
    - -

    Blank fields are included as null instead of being omitted.

    - -

    All timestamps are returned in ISO 8601 format:

    - -
    YYYY-MM-DDTHH:MM:SSZ
    -
    - -

    Summary Representations

    - -

    When you fetch a list of resources, the response includes a subset of the -attributes for that resource. This is the “summary” representation of the -resource. (Some attributes are computationally expensive for the API to provide. -For performance reasons, the summary representation excludes those attributes. -To obtain those attributes, fetch the “detailed” representation.)

    - -

    Example: When you get a list of repositories, you get the summary -representation of each repository. Here, we fetch the list of repositories owned -by the octokit organization:

    - -
    GET /orgs/octokit/repos
    -
    - -

    Detailed Representations

    - -

    When you fetch an individual resource, the response typically includes all -attributes for that resource. This is the “detailed” representation of the -resource. (Note that authorization sometimes influences the amount of detail -included in the representation.)

    - -

    Example: When you get an individual repository, you get the detailed -representation of the repository. Here, we fetch the -octokit/octokit.rb repository:

    - -
    GET /repos/octokit/octokit.rb
    -
    - -

    The documentation provides an example response for each API method. The example -response illustrates all attributes that are returned by that method.

    - -

    Parameters

    - -

    Many API methods take optional parameters. For GET requests, any parameters not -specified as a segment in the path can be passed as an HTTP query string -parameter:

    - -
    -$ curl -i "https://api.github.com/repos/mojombo/jekyll/issues?state=closed"
    -
    - -

    In this example, the ‘mojombo’ and ‘jekyll’ values are provided for the :owner -and :repo parameters in the path while :state is passed in the query -string.

    - -

    For POST, PATCH, PUT, and DELETE requests, parameters not included in the URL should be encoded as JSON -with a Content-Type of ‘application/x-www-form-urlencoded’:

    - -
    -$ curl -i -u username -d '{"scopes":["public_repo"]}' https://api.github.com/authorizations
    -
    - -

    Client Errors

    - -

    There are three possible types of client errors on API calls that -receive request bodies:

    - -
      -
    1. -

      Sending invalid JSON will result in a 400 Bad Request response.

      - -
       HTTP/1.1 400 Bad Request
      - Content-Length: 35
      -
      - {"message":"Problems parsing JSON"}
      -
      -
    2. -
    3. -

      Sending the wrong type of JSON values will result in a 400 Bad -Request response.

      - -
       HTTP/1.1 400 Bad Request
      - Content-Length: 40
      -
      - {"message":"Body should be a JSON Hash"}
      -
      -
    4. -
    5. -

      Sending invalid fields will result in a 422 Unprocessable Entity -response.

      - -
       HTTP/1.1 422 Unprocessable Entity
      - Content-Length: 149
      -
      - {
      -   "message": "Validation Failed",
      -   "errors": [
      -     {
      -       "resource": "Issue",
      -       "field": "title",
      -       "code": "missing_field"
      -     }
      -   ]
      - }
      -
      -
    6. -
    - -

    All error objects have resource and field properties so that your client -can tell what the problem is. There’s also an error code to let you -know what is wrong with the field. These are the possible validation error -codes:

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Error NameDescription
    missingThis means a resource does not exist.
    missing_fieldThis means a required field on a resource has not been set.
    invalidThis means the formatting of a field is invalid. The documentation for that resource should be able to give you more specific information.
    already_existsThis means another resource has the same value as this field. This can happen in resources that must have some unique key (such as Label names).
    - -

    If resources have custom validation errors, they will be documented with the resource.

    - -

    HTTP Redirects

    - -

    API v3 uses HTTP redirection where appropriate. Clients should assume that any -request may result in a redirection. Receiving an HTTP redirection is not an -error and clients should follow that redirect. Redirect responses will have a -Location header field which contains the URI of the resource to which the -client should repeat the requests.

    - - - - - - - - - - - - - - - - - - -
    Status CodeDescription
    301Permanent redirection. The URI you used to make the request has been superseded by the one specified in the Location header field. This and all future requests to this resource should be directed to the new URI.
    -302, 307 -Temporary redirection. The request should be repeated verbatim to the URI specified in the Location header field but clients should continue to use the original URI for future requests.
    - -

    Other redirection status codes may be used in accordance with the HTTP 1.1 spec.

    - -

    HTTP Verbs

    - -

    Where possible, API v3 strives to use appropriate HTTP verbs for each -action.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VerbDescription
    HEADCan be issued against any resource to get just the HTTP header info.
    GETUsed for retrieving resources.
    POSTUsed for creating resources, or performing custom actions (such as merging a pull request).
    PATCHUsed for updating resources with partial JSON data. For instance, an Issue resource has title and body attributes. A PATCH request may accept one or more of the attributes to update the resource. PATCH is a relatively new and uncommon HTTP verb, so resource endpoints also accept POST requests.
    PUTUsed for replacing resources or collections. For PUT requests with no body attribute, be sure to set the Content-Length header to zero.
    DELETEUsed for deleting resources.
    - -

    Authentication

    - -

    There are three ways to authenticate through GitHub API v3. Requests that -require authentication will return 404 Not Found, instead of -403 Forbidden, in some places. This is to prevent the accidental leakage -of private repositories to unauthorized users.

    - -

    Basic Authentication

    - -
    -$ curl -u "username" https://api.github.com
    -
    - -

    OAuth2 Token (sent in a header)

    - -
    -$ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com
    -
    - -

    OAuth2 Token (sent as a parameter)

    - -
    -$ curl https://api.github.com/?access_token=OAUTH-TOKEN
    -
    - -

    Read more about OAuth2. Note that OAuth2 tokens can be acquired -programmatically, for applications that -are not websites.

    - -

    OAuth2 Key/Secret

    - -
    -$ curl https://api.github.com/users/whatever?client_id=xxxx&client_secret=yyyy
    -
    - -

    This should only be used in server to server scenarios. Don’t leak your -OAuth application’s client secret to your users. Read more about -unauthenticated rate limiting.

    - -

    Failed login limit

    - -

    Authenticating with invalid credentials will return 401 Unauthorized:

    - -
    -$ curl -i https://api.github.com -u foo:bar
    -
    -HTTP/1.1 401 Unauthorized
    -
    -{
    -  "message": "Bad credentials",
    -  "documentation_url": "http://developer.github.com/v3"
    -}
    -
    - -

    After detecting several requests with invalid credentials within a short period, -the API will temporarily reject all authentication attempts for that user -(including ones with valid credentials) with 403 Forbidden:

    - -
    -$ curl -i https://api.github.com -u valid_username:valid_password
    -
    -HTTP/1.1 403 Forbidden
    -
    -{
    -  "message": "Maximum number of login attempts exceeded. Please try again later.",
    -  "documentation_url": "http://developer.github.com/v3"
    -}
    -
    - -

    Hypermedia

    - -

    All resources may have one or more *_url properties linking to other -resources. These are meant to provide explicit URLs so that proper API clients -don’t need to construct URLs on their own. It is highly recommended that API -clients use these. Doing so will make future upgrades of the API easier for -developers. All URLs are expected to be proper RFC 6570 URI templates.

    - -

    You can then expand these templates using something like the uri_template -gem:

    - -
    >> tmpl = URITemplate.new('/notifications{?since,all,participating}')
    ->> tmpl.expand
    -=> "/notifications"
    -
    ->> tmpl.expand :all => 1
    -=> "/notifications?all=1"
    -
    ->> tmpl.expand :all => 1, :participating => 1
    -=> "/notifications?all=1&participating=1"
    -
    - -

    Pagination

    - -

    Requests that return multiple items will be paginated to 30 items by -default. You can specify further pages with the ?page parameter. For some -resources, you can also set a custom page size up to 100 with the ?per_page parameter. -Note that for technical reasons not all endpoints respect the ?per_page parameter, -see events for example.

    - -
    -$ curl https://api.github.com/user/repos?page=2&per_page=100
    -
    - -

    Note that page numbering is 1-based and that omitting the ?page -parameter will return the first page.

    - -

    For more information on pagination, check out our guide on Traversing with Pagination.

    - - - -

    The pagination info is included in the Link -header. It is important to -follow these Link header values instead of constructing your own URLs. In some -instances, such as in the Commits -API, pagination is based on -SHA1 and not on page number.

    - -
    Link: <https://api.github.com/user/repos?page=3&per_page=100>; rel="next",
    -  <https://api.github.com/user/repos?page=50&per_page=100>; rel="last"
    -
    - -

    Linebreak is included for readability.

    - -

    The possible rel values are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    nextShows the URL of the immediate next page of results.
    lastShows the URL of the last page of results.
    firstShows the URL of the first page of results.
    prevShows the URL of the immediate previous page of results.
    - -

    Rate Limiting

    - -

    For requests using Basic Authentication or OAuth, you can make up to 5,000 -requests per hour. For unauthenticated requests, the rate limit allows you to -make up to 60 requests per hour. (The Search API has custom rate limit -rules.)

    - -

    You can check the returned HTTP headers of any API request to see your current -rate limit status:

    - -
    -$ curl -i https://api.github.com/users/whatever
    -
    -HTTP/1.1 200 OK
    -Date: Mon, 01 Jul 2013 17:27:06 GMT
    -Status: 200 OK
    -X-RateLimit-Limit: 60
    -X-RateLimit-Remaining: 56
    -X-RateLimit-Reset: 1372700873
    -
    - -

    The headers tell you everything you need to know about your current rate limit status:

    - - - - - - - - - - - - - - - - - - - - - - -
    Header NameDescription
    X-RateLimit-LimitThe maximum number of requests that the consumer is permitted to make per hour.
    X-RateLimit-RemainingThe number of requests remaining in the current rate limit window.
    X-RateLimit-ResetThe time at which the current rate limit window resets in UTC epoch seconds.
    - -

    If you need the time in a different format, any modern programming language can get the job done. For example, if you open up the console on your web browser, you can easily get the reset time as a JavaScript Date object.

    - -
    new Date(1372700873 * 1000)
    -// => Mon Jul 01 2013 13:47:53 GMT-0400 (EDT)
    - -

    Once you go over the rate limit you will receive an error response:

    - -
    -HTTP/1.1 403 Forbidden
    -Date: Tue, 20 Aug 2013 14:50:41 GMT
    -Status: 403 Forbidden
    -X-RateLimit-Limit: 60
    -X-RateLimit-Remaining: 0
    -X-RateLimit-Reset: 1377013266
    -
    -{
    -    "message": "API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting for details."
    -}
    -
    - -

    You can also check your rate limit status without incurring an -API hit. -

    - -

    Unauthenticated rate limited requests

    - -

    If you need to make unauthenticated calls but need to use a higher rate limit -associated with your OAuth application, you can send over your client ID and -secret in the query string.

    - -
    -$ curl -i https://api.github.com/users/whatever?client_id=xxxxxxxxxxxxxx&client_secret=yyyyyyyyyyyyyyyyyyyyy
    -
    -HTTP/1.1 200 OK
    -Date: Mon, 01 Jul 2013 17:27:06 GMT
    -Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4966
    -X-RateLimit-Reset: 1372700873
    -
    - -

    This method should only be used for server-to-server calls. You should never -share your client secret with anyone or include it in client-side browser code.

    - -

    Staying within the rate limit

    - -

    If you are using Basic Authentication or OAuth, and you are exceeding -your rate limit, you can likely fix the issue by caching API responses -and using conditional requests.

    - -

    If you’re using conditional requests and still exceeding your rate -limit, please contact us to request a -higher rate limit for your OAuth application.

    - -

    User Agent Required

    - -

    All API requests MUST include a valid User-Agent header. Requests with no User-Agent -header will be rejected. We request that you use your GitHub username, or the name of your -application, for the User-Agent header value. This allows us to contact you if there are problems.

    - -

    Here’s an example:

    - -
    -User-Agent: Awesome-Octocat-App
    -
    - -

    If you provide an invalid User-Agent header, you will receive a 403 Forbidden response:

    - -
    -$ curl -iH 'User-Agent: ' https://api.github.com/meta
    -HTTP/1.0 403 Forbidden
    -Connection: close
    -Content-Type: text/html
    -
    -Request forbidden by administrative rules.
    -Please make sure your request has a User-Agent header.
    -Check https://developer.github.com for other possible causes.
    -
    - -

    Conditional requests

    - -

    Most responses return an ETag header. Many responses also return a Last-Modified header. You can use the values -of these headers to make subsequent requests to those resources using the -If-None-Match and If-Modified-Since headers, respectively. If the resource -has not changed, the server will return a 304 Not Modified. Also note: making -a conditional request and receiving a 304 response does not count against your -Rate Limit, so we encourage you to use it whenever possible.

    - -
    -$ curl -i https://api.github.com/user
    -HTTP/1.1 200 OK
    -Cache-Control: private, max-age=60
    -ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
    -Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
    -Status: 200 OK
    -Vary: Accept, Authorization, Cookie
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4996
    -X-RateLimit-Reset: 1372700873
    -
    -$ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"'
    -HTTP/1.1 304 Not Modified
    -Cache-Control: private, max-age=60
    -ETag: "644b5b0155e6404a9cc4bd9d8b1ae730"
    -Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
    -Status: 304 Not Modified
    -Vary: Accept, Authorization, Cookie
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4996
    -X-RateLimit-Reset: 1372700873
    -
    -$ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT"
    -HTTP/1.1 304 Not Modified
    -Cache-Control: private, max-age=60
    -Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT
    -Status: 304 Not Modified
    -Vary: Accept, Authorization, Cookie
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4996
    -X-RateLimit-Reset: 1372700873
    -
    - -

    Cross Origin Resource Sharing

    - -

    The API supports Cross Origin Resource Sharing (CORS) for AJAX requests. -you can read the CORS W3C working draft, or -this intro from the -HTML 5 Security Guide.

    - -

    Here’s a sample request sent from a browser hitting -http://example.com:

    - -
    $ curl -i https://api.github.com -H "Origin: http://example.com"
    -HTTP/1.1 302 Found
    -
    - -

    Any domain that is registered as an OAuth Application is accepted. -Here’s a sample request for a browser hitting Travis CI:

    - -
    $ curl -i https://api.github.com -H "Origin: http://travis-ci.org"
    -HTTP/1.1 302 Found
    -Access-Control-Allow-Origin: *
    -Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
    -Access-Control-Allow-Credentials: true
    -
    - -

    This is what the CORS preflight request looks like:

    - -
    $ curl -i https://api.github.com -H "Origin: http://travis-ci.org" -X OPTIONS
    -HTTP/1.1 204 No Content
    -Access-Control-Allow-Origin: *
    -Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With
    -Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE
    -Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes
    -Access-Control-Max-Age: 86400
    -Access-Control-Allow-Credentials: true
    -
    - -

    JSON-P Callbacks

    - -

    You can send a ?callback parameter to any GET call to have the results -wrapped in a JSON function. This is typically used when browsers want -to embed GitHub content in web pages by getting around cross domain -issues. The response includes the same data output as the regular API, -plus the relevant HTTP Header information.

    - -
    -$ curl https://api.github.com?callback=foo
    -
    -foo({
    -  "meta": {
    -    "status": 200,
    -    "X-RateLimit-Limit": "5000",
    -    "X-RateLimit-Remaining": "4966",
    -    "X-RateLimit-Reset": "1372700873",
    -    "Link": [ // pagination headers and other links
    -      ["https://api.github.com?page=2", {"rel": "next"}]
    -    ]
    -  },
    -  "data": {
    -    // the data
    -  }
    -})
    -
    - -

    You can write a JavaScript handler to process the callback like this:

    - -
    function foo(response) {
    -  var meta = response.meta
    -  var data = response.data
    -  console.log(meta)
    -  console.log(data)
    -}
    - -

    All of the headers are the same String value as the HTTP Headers with one -notable exception: Link. Link headers are pre-parsed for you and come -through as an array of [url, options] tuples.

    - -

    A link that looks like this:

    - -
    Link: <url1>; rel="next", <url2>; rel="foo"; bar="baz"
    -
    - -

    … will look like this in the Callback output:

    - -
    {
    -  "Link": [
    -    [
    -      "url1",
    -      {
    -        "rel": "next"
    -      }
    -    ],
    -    [
    -      "url2",
    -      {
    -        "rel": "foo",
    -        "bar": "baz"
    -      }
    -    ]
    -  ]
    -}
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/assignees/index.html b/v3/issues/assignees/index.html deleted file mode 100644 index ec3ac20838..0000000000 --- a/v3/issues/assignees/index.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - Issue Assignees | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Assignees

    - - - -

    List assignees

    - -

    This call lists all the available assignees (owner + collaborators) to which -issues may be assigned.

    - -
    GET /repos/:owner/:repo/assignees
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Check assignee

    - -

    You may also check to see if a particular user is an assignee for a repository.

    - -
    GET /repos/:owner/:repo/assignees/:assignee
    -
    - -

    Response

    - -

    If the given assignee login belongs to an assignee for the repository, a -204 header with no content is returned.

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Otherwise a 404 status code is returned.

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/comments/index.html b/v3/issues/comments/index.html deleted file mode 100644 index 536b8180e8..0000000000 --- a/v3/issues/comments/index.html +++ /dev/null @@ -1,568 +0,0 @@ - - - - - - - - Issue Comments | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Comments

    - - - -

    The Issue Comments API supports listing, viewing, editing, and creating -comments on issues and pull requests.

    - -

    Issue Comments use these custom media types. -You can read more about the use of media types in the API -here.

    - -

    List comments on an issue

    - -
    GET /repos/:owner/:repo/issues/:number/comments
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
    -    "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    -    "body": "Me too",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z"
    -  }
    -]
    - -

    List comments in a repository

    - -
    GET /repos/:owner/:repo/issues/comments
    -
    - -

    By default, Issue Comments are ordered by ascending ID.

    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sortstringEither created or updated. Default: created -
    directionstringEither asc or desc. Ignored without the sort parameter.
    sincestringOnly comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -    "id": 1,
    -    "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -    "path": "file1.txt",
    -    "position": 1,
    -    "original_position": 4,
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "body": "Great stuff",
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z",
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -    "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -    "_links": {
    -      "self": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -      },
    -      "html": {
    -        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -      },
    -      "pull_request": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -      }
    -    }
    -  }
    -]
    - -

    Get a single comment

    - -
    GET /repos/:owner/:repo/issues/comments/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    -  "body": "Me too",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Create a comment

    - -
    POST /repos/:owner/:repo/issues/:number/comments
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The contents of the comment.
    - -
    {
    -  "body": "a new comment"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/user/repo/issues/comments/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    -  "body": "Me too",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Edit a comment

    - -
    PATCH /repos/:owner/:repo/issues/comments/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The contents of the comment.
    - -
    {
    -  "body": "String"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347#issuecomment-1",
    -  "body": "Me too",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Delete a comment

    - -
    DELETE /repos/:owner/:repo/issues/comments/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Custom media types

    - -

    These are the supported media types for issue comments. You can read more -about the use of media types in the API here.

    - -
    application/vnd.github.VERSION.raw+json
    -application/vnd.github.VERSION.text+json
    -application/vnd.github.VERSION.html+json
    -application/vnd.github.VERSION.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/events/index.html b/v3/issues/events/index.html deleted file mode 100644 index 32b9ba5fbe..0000000000 --- a/v3/issues/events/index.html +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - Issue Events | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Events

    - - - -

    Records various events that occur around an Issue or Pull Request. This is -useful both for display on issue/pull request information pages and also to -determine who should be notified of comments.

    - -

    Attributes

    - -
    -
    actor
    -
    Always the User that generated the event.
    -
    commit_id
    -
    The String SHA of a commit that referenced this Issue
    -
    event
    -
    Identifies the actual type of Event that occurred.
    -
    - -

    Events

    - -
    -
    closed
    -
    The issue was closed by the actor. When the commit_id is present, it -identifies the commit that closed the issue using “closes / fixes #NN” -syntax.
    -
    reopened
    -
    The issue was reopened by the actor.
    -
    subscribed
    -
    The actor subscribed to receive notifications for an issue.
    -
    merged
    -
    The issue was merged by the actor. The commit_id attribute is the SHA1 of -the HEAD commit that was merged.
    -
    referenced
    -
    The issue was referenced from a commit message. The commit_id attribute is -the commit SHA1 of where that happened.
    -
    mentioned
    -
    The actor was @mentioned in an issue body.
    -
    assigned
    -
    The issue was assigned to the actor.
    -
    - -

    List events for an issue

    - -
    GET /repos/:owner/:repo/issues/:issue_number/events
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/events/1",
    -    "actor": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "event": "closed",
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "created_at": "2011-04-14T16:00:49Z"
    -  }
    -]
    - -

    List events for a repository

    - -
    GET /repos/:owner/:repo/issues/events
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/events/1",
    -    "actor": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "event": "closed",
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "issue": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -      "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -      "number": 1347,
    -      "state": "open",
    -      "title": "Found a bug",
    -      "body": "I'm having a problem with this.",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "labels": [
    -        {
    -          "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -          "name": "bug",
    -          "color": "f29513"
    -        }
    -      ],
    -      "assignee": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "milestone": {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -        "number": 1,
    -        "state": "open",
    -        "title": "v1.0",
    -        "description": "",
    -        "creator": {
    -          "login": "octocat",
    -          "id": 1,
    -          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -          "gravatar_id": "somehexcode",
    -          "url": "https://api.github.com/users/octocat",
    -          "html_url": "https://github.com/octocat",
    -          "followers_url": "https://api.github.com/users/octocat/followers",
    -          "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -          "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -          "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -          "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -          "organizations_url": "https://api.github.com/users/octocat/orgs",
    -          "repos_url": "https://api.github.com/users/octocat/repos",
    -          "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -          "received_events_url": "https://api.github.com/users/octocat/received_events",
    -          "type": "User",
    -          "site_admin": false
    -        },
    -        "open_issues": 4,
    -        "closed_issues": 8,
    -        "created_at": "2011-04-10T20:09:31Z",
    -        "due_on": null
    -      },
    -      "comments": 0,
    -      "pull_request": {
    -        "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -        "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -        "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -      },
    -      "closed_at": null,
    -      "created_at": "2011-04-22T13:33:48Z",
    -      "updated_at": "2011-04-22T13:33:48Z"
    -    }
    -  }
    -]
    - -

    Get a single event

    - -
    GET /repos/:owner/:repo/issues/events/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/events/1",
    -  "actor": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "event": "closed",
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "issue": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -    "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -    "number": 1347,
    -    "state": "open",
    -    "title": "Found a bug",
    -    "body": "I'm having a problem with this.",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "labels": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -        "name": "bug",
    -        "color": "f29513"
    -      }
    -    ],
    -    "assignee": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "milestone": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -      "number": 1,
    -      "state": "open",
    -      "title": "v1.0",
    -      "description": "",
    -      "creator": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "open_issues": 4,
    -      "closed_issues": 8,
    -      "created_at": "2011-04-10T20:09:31Z",
    -      "due_on": null
    -    },
    -    "comments": 0,
    -    "pull_request": {
    -      "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -      "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -      "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -    },
    -    "closed_at": null,
    -    "created_at": "2011-04-22T13:33:48Z",
    -    "updated_at": "2011-04-22T13:33:48Z"
    -  }
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/index.html b/v3/issues/index.html deleted file mode 100644 index 8146f43cd0..0000000000 --- a/v3/issues/index.html +++ /dev/null @@ -1,1042 +0,0 @@ - - - - - - - - Issues | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Issues

    - - - -

    Issues use these custom media types. You can -read more about the use of media types in the API here.

    - -

    List issues

    - -

    List all issues across all the authenticated user’s visible repositories -including owned repositories, member repositories, and organization -repositories:

    - -
    GET /issues
    -
    - -

    List all issues across owned and member repositories for the authenticated user:

    - -
    GET /user/issues
    -
    - -

    List all issues for a given organization for the authenticated user:

    - -
    GET /orgs/:org/issues
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    filterstringIndicates which sorts of issues to return. Can be one of:
    * assigned: Issues assigned to you
    * created: Issues created by you
    * mentioned: Issues mentioning you
    * subscribed: Issues you’re subscribed to updates for
    * all: All issues the authenticated user can see, regardless of participation or creation
    Default: assigned -
    statestringIndicates the state of the issues to return. Can be either open or closed. Default: open -
    labelsstringA list of comma separated label names. Example: bug,ui,@high -
    sortstringWhat to sort results by. Can be either created, updated, comments. Default: created -
    directionstringThe direction of the sort. Can be either asc or desc. Default: desc -
    sincestringOnly issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -    "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -    "number": 1347,
    -    "state": "open",
    -    "title": "Found a bug",
    -    "body": "I'm having a problem with this.",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "labels": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -        "name": "bug",
    -        "color": "f29513"
    -      }
    -    ],
    -    "assignee": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "milestone": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -      "number": 1,
    -      "state": "open",
    -      "title": "v1.0",
    -      "description": "",
    -      "creator": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "open_issues": 4,
    -      "closed_issues": 8,
    -      "created_at": "2011-04-10T20:09:31Z",
    -      "due_on": null
    -    },
    -    "comments": 0,
    -    "pull_request": {
    -      "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -      "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -      "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -    },
    -    "closed_at": null,
    -    "created_at": "2011-04-22T13:33:48Z",
    -    "updated_at": "2011-04-22T13:33:48Z"
    -  }
    -]
    - -

    List issues for a repository

    - -
    GET /repos/:owner/:repo/issues
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    milestone -integer or string -If an integer is passed, it should refer to a milestone number. If the string * is passed, issues with any milestone are accepted. If the string none is passed, issues without milestones are returned. Default: * -
    statestringIndicates the state of the issues to return. Can be either open or closed. Default: open -
    assigneestringCan be the name of a user. Pass in none for issues with no assigned user, and * for issues assigned to any user. Default: * -
    creatorstringThe user that created the issue.
    mentionedstringA user that’s mentioned in the issue.
    labelsstringA list of comma separated label names. Example: bug,ui,@high -
    sortstringWhat to sort results by. Can be either created, updated, comments. Default: created -
    directionstringThe direction of the sort. Can be either asc or desc. Default: desc -
    sincestringOnly issues updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -    "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -    "number": 1347,
    -    "state": "open",
    -    "title": "Found a bug",
    -    "body": "I'm having a problem with this.",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "labels": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -        "name": "bug",
    -        "color": "f29513"
    -      }
    -    ],
    -    "assignee": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "milestone": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -      "number": 1,
    -      "state": "open",
    -      "title": "v1.0",
    -      "description": "",
    -      "creator": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "open_issues": 4,
    -      "closed_issues": 8,
    -      "created_at": "2011-04-10T20:09:31Z",
    -      "due_on": null
    -    },
    -    "comments": 0,
    -    "pull_request": {
    -      "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -      "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -      "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -    },
    -    "closed_at": null,
    -    "created_at": "2011-04-22T13:33:48Z",
    -    "updated_at": "2011-04-22T13:33:48Z"
    -  }
    -]
    - -

    Get a single issue

    - -
    GET /repos/:owner/:repo/issues/:number
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -  "number": 1347,
    -  "state": "open",
    -  "title": "Found a bug",
    -  "body": "I'm having a problem with this.",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "labels": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -      "name": "bug",
    -      "color": "f29513"
    -    }
    -  ],
    -  "assignee": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "milestone": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -    "number": 1,
    -    "state": "open",
    -    "title": "v1.0",
    -    "description": "",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "open_issues": 4,
    -    "closed_issues": 8,
    -    "created_at": "2011-04-10T20:09:31Z",
    -    "due_on": null
    -  },
    -  "comments": 0,
    -  "pull_request": {
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -    "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -    "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -  },
    -  "closed_at": null,
    -  "created_at": "2011-04-22T13:33:48Z",
    -  "updated_at": "2011-04-22T13:33:48Z"
    -}
    - -
    -

    - Note: Every pull request is an issue, but not every issue is a pull request. When using the v3 media type, if the issue is not a pull request, the response omits the pull_request attribute. -

    -
    - -

    Create an issue

    - -

    Any user with pull access to a repository can create an issue.

    - -
    POST /repos/:owner/:repo/issues
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestring -Required. The title of the issue.
    bodystringThe contents of the issue.
    assigneestringLogin for the user that this issue should be assigned to. NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. -
    milestonenumberMilestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise. -
    labels -array of strings -Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise. -
    - -

    Example

    - -
    {
    -  "title": "Found a bug",
    -  "body": "I'm having a problem with this.",
    -  "assignee": "octocat",
    -  "milestone": 1,
    -  "labels": [
    -    "Label1",
    -    "Label2"
    -  ]
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/user/repo/issues/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -  "number": 1347,
    -  "state": "open",
    -  "title": "Found a bug",
    -  "body": "I'm having a problem with this.",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "labels": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -      "name": "bug",
    -      "color": "f29513"
    -    }
    -  ],
    -  "assignee": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "milestone": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -    "number": 1,
    -    "state": "open",
    -    "title": "v1.0",
    -    "description": "",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "open_issues": 4,
    -    "closed_issues": 8,
    -    "created_at": "2011-04-10T20:09:31Z",
    -    "due_on": null
    -  },
    -  "comments": 0,
    -  "pull_request": {
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -    "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -    "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -  },
    -  "closed_at": null,
    -  "created_at": "2011-04-22T13:33:48Z",
    -  "updated_at": "2011-04-22T13:33:48Z"
    -}
    - -

    Edit an issue

    - -

    Issue owners and users with push access can edit an issue.

    - -
    PATCH /repos/:owner/:repo/issues/:number
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestring -Required. The title of the issue.
    bodystringThe contents of the issue.
    assigneestringLogin for the user that this issue should be assigned to.
    statestringState of the issue. Either open or closed.
    milestonenumberMilestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise. -
    labels -array of strings -Labels to associate with this issue. Pass one or more Labels to replace the set of Labels on this Issue. Send an empty array ([]) to clear all Labels from the Issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise. -
    - -

    Example

    - -
    {
    -  "title": "Found a bug",
    -  "body": "I'm having a problem with this.",
    -  "assignee": "octocat",
    -  "milestone": 1,
    -  "state": "open",
    -  "labels": [
    -    "Label1",
    -    "Label2"
    -  ]
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
    -  "html_url": "https://github.com/octocat/Hello-World/issues/1347",
    -  "number": 1347,
    -  "state": "open",
    -  "title": "Found a bug",
    -  "body": "I'm having a problem with this.",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "labels": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -      "name": "bug",
    -      "color": "f29513"
    -    }
    -  ],
    -  "assignee": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "milestone": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -    "number": 1,
    -    "state": "open",
    -    "title": "v1.0",
    -    "description": "",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "open_issues": 4,
    -    "closed_issues": 8,
    -    "created_at": "2011-04-10T20:09:31Z",
    -    "due_on": null
    -  },
    -  "comments": 0,
    -  "pull_request": {
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1347",
    -    "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
    -    "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
    -  },
    -  "closed_at": null,
    -  "created_at": "2011-04-22T13:33:48Z",
    -  "updated_at": "2011-04-22T13:33:48Z"
    -}
    - -

    Custom media types

    - -

    These are the supported media types for issues. You can read more about the -use of media types in the API here.

    - -
    application/vnd.github.VERSION.raw+json
    -application/vnd.github.VERSION.text+json
    -application/vnd.github.VERSION.html+json
    -application/vnd.github.VERSION.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/labels/index.html b/v3/issues/labels/index.html deleted file mode 100644 index 74924b00a3..0000000000 --- a/v3/issues/labels/index.html +++ /dev/null @@ -1,501 +0,0 @@ - - - - - - - - Issue Labels | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Labels

    - - - -

    List all labels for this repository

    - -
    GET /repos/:owner/:repo/labels
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -    "name": "bug",
    -    "color": "f29513"
    -  }
    -]
    - -

    Get a single label

    - -
    GET /repos/:owner/:repo/labels/:name
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -  "name": "bug",
    -  "color": "f29513"
    -}
    - -

    Create a label

    - -
    POST /repos/:owner/:repo/labels
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the label.
    colorstring -Required. A 6 character hex code, without the leading #, identifying the color.
    - -
    {
    -  "name": "API",
    -  "color": "FFFFFF"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/user/repo/labels/foo
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -  "name": "bug",
    -  "color": "f29513"
    -}
    - -

    Update a label

    - -
    PATCH /repos/:owner/:repo/labels/:name
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the label.
    colorstring -Required. A 6 character hex code, without the leading #, identifying the color.
    - -
    {
    -  "name": "API",
    -  "color": "FFFFFF"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -  "name": "bug",
    -  "color": "f29513"
    -}
    - -

    Delete a label

    - -
    DELETE /repos/:owner/:repo/labels/:name
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    List labels on an issue

    - -
    GET /repos/:owner/:repo/issues/:number/labels
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -    "name": "bug",
    -    "color": "f29513"
    -  }
    -]
    - -

    Add labels to an issue

    - -
    POST /repos/:owner/:repo/issues/:number/labels
    -
    - -

    Input

    - -
    [
    -  "Label1",
    -  "Label2"
    -]
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -    "name": "bug",
    -    "color": "f29513"
    -  }
    -]
    - -

    Remove a label from an issue

    - -
    DELETE /repos/:owner/:repo/issues/:number/labels/:name
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Replace all labels for an issue

    - -
    PUT /repos/:owner/:repo/issues/:number/labels
    -
    - -

    Input

    - -
    [
    -  "Label1",
    -  "Label2"
    -]
    - -

    Sending an empty array ([]) will remove all Labels from the Issue.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -    "name": "bug",
    -    "color": "f29513"
    -  }
    -]
    - -

    Remove all labels from an issue

    - -
    DELETE /repos/:owner/:repo/issues/:number/labels
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Get labels for every issue in a milestone

    - -
    GET /repos/:owner/:repo/milestones/:number/labels
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    -    "name": "bug",
    -    "color": "f29513"
    -  }
    -]
    - -
    - - - -
    - - - - - - - - diff --git a/v3/issues/milestones/index.html b/v3/issues/milestones/index.html deleted file mode 100644 index 4f21886e73..0000000000 --- a/v3/issues/milestones/index.html +++ /dev/null @@ -1,542 +0,0 @@ - - - - - - - - Issue Milestones | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Milestones

    - - - -

    List milestones for a repository

    - -
    GET /repos/:owner/:repo/milestones
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    statestringThe state of the milestone. Either open or closed. Default: open -
    sortstringWhat to sort results by. Either due_date or completeness. Default: due_date -
    directionstringThe direction of the sort. Either asc or desc. Default: asc -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -    "number": 1,
    -    "state": "open",
    -    "title": "v1.0",
    -    "description": "",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "open_issues": 4,
    -    "closed_issues": 8,
    -    "created_at": "2011-04-10T20:09:31Z",
    -    "due_on": null
    -  }
    -]
    - -

    Get a single milestone

    - -
    GET /repos/:owner/:repo/milestones/:number
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -  "number": 1,
    -  "state": "open",
    -  "title": "v1.0",
    -  "description": "",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "open_issues": 4,
    -  "closed_issues": 8,
    -  "created_at": "2011-04-10T20:09:31Z",
    -  "due_on": null
    -}
    - -

    Create a milestone

    - -
    POST /repos/:owner/:repo/milestones
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestring -Required. The title of the milestone.
    statestringThe state of the milestone. Either open or closed. Default: open -
    descriptionstringA description of the milestone.
    due_onstringThe milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Example

    - -
    {
    -  "title": "String",
    -  "state": "open or closed",
    -  "description": "String",
    -  "due_on": "2012-10-09T23:39:01Z"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/user/repo/milestones/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -  "number": 1,
    -  "state": "open",
    -  "title": "v1.0",
    -  "description": "",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "open_issues": 4,
    -  "closed_issues": 8,
    -  "created_at": "2011-04-10T20:09:31Z",
    -  "due_on": null
    -}
    - -

    Update a milestone

    - -
    PATCH /repos/:owner/:repo/milestones/:number
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestringThe title of the milestone.
    statestringThe state of the milestone. Either open or closed. Default: open -
    descriptionstringA description of the milestone.
    due_onstringThe milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Example

    - -
    {
    -  "title": "String",
    -  "state": "open or closed",
    -  "description": "String",
    -  "due_on": "Time"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
    -  "number": 1,
    -  "state": "open",
    -  "title": "v1.0",
    -  "description": "",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "open_issues": 4,
    -  "closed_issues": 8,
    -  "created_at": "2011-04-10T20:09:31Z",
    -  "due_on": null
    -}
    - -

    Delete a milestone

    - -
    DELETE /repos/:owner/:repo/milestones/:number
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/markdown/index.html b/v3/markdown/index.html deleted file mode 100644 index 46ffe38e53..0000000000 --- a/v3/markdown/index.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - Markdown | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Markdown

    - - - -

    Render an arbitrary Markdown document

    - -
    POST /markdown
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    textstring -Required.The Markdown text to render
    modestringThe rendering mode. Can be either:
    * markdown to render a document as plain Markdown, just like README files are rendered.
    * gfm to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.
    Default: markdown -
    contextstringThe repository context. Only taken into account when rendering as gfm -
    - -

    Example

    - -
    {
    -  "text": "Hello world github/linguist#1 **cool**, and #1!",
    -  "mode": "gfm",
    -  "context": "github/gollum"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -Content-Type: text/html
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    -
    <p>Hello world <a href="http://github.com/github/linguist/issues/1" class="issue-link" title="This is a simple issue">github/linguist#1</a> <strong>cool</strong>, and <a href="http://github.com/github/gollum/issues/1" class="issue-link" title="This is another issue">#1</a>!</p>
    - -

    Render a Markdown document in raw mode

    - -
    POST /markdown/raw
    -
    - -

    Parameters

    - -

    The raw API is not JSON-based. It takes a Markdown document as plaintext (text/plain or text/x-markdown) and renders it as plain Markdown without a repository context (just like a README.md file is rendered – this is the simplest way to preview a readme online).

    - -

    Response

    - -
    Status: 200 OK
    -Content-Type: text/html
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    -
    <p>Hello world github/linguist#1 <strong>cool</strong>, and #1!</p>
    - -
    - - - -
    - - - - - - - - diff --git a/v3/media/index.html b/v3/media/index.html deleted file mode 100644 index a615e103e0..0000000000 --- a/v3/media/index.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - Media Types | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Media Types

    - - - -

    Custom media types are used in the API to let consumers choose the format -of the data they wish to receive. This is done by adding one or more of -the following types to the Accept header when you make a request. Media types -are specific to resources, allowing them to change independently and support -formats that other resources don’t.

    - -

    All GitHub media types look like this:

    - -
    application/vnd.github[.version].param[+json]
    -
    - -

    The most basic media types the API supports are:

    - -
    application/json
    -application/vnd.github+json
    -
    - -

    Neither of these specify a version, so you will always get the current default -JSON representation of resources. If you’re building an application and -care about the stability of the API, specify a version like so:

    - -
    application/vnd.github.v3+json
    -
    - -

    If you’re specifying a property (such as full/raw/etc defined below), -put the version before the property:

    - -
    application/vnd.github.v3.raw+json
    -
    - -

    You can check the current version through every response’s headers. Look -for the X-GitHub-Media-Type header:

    - -
    $ curl https://api.github.com/users/technoweenie -I
    -HTTP/1.1 200 OK
    -X-GitHub-Media-Type: github.beta
    -
    -$ curl https://api.github.com/users/technoweenie -I \
    -  -H "Accept: application/vnd.github.full+json"
    -HTTP/1.1 200 OK
    -X-GitHub-Media-Type: github.beta; param=full; format=json
    -
    -$ curl https://api.github.com/users/technoweenie -I \
    -  -H "Accept: application/vnd.github.v3.full+json"
    -HTTP/1.1 200 OK
    -X-GitHub-Media-Type: github.v3; param=full; format=json
    -
    - -

    Beta, v3, and the Future

    - -

    If you don’t specify a version in the Accept header, you’ll -get the beta version (as shown above) by default.

    - -

    Soon, v3 will become the default version. (Check out -the blog post for -details.) We recommend that you start using v3 now. To get that version today, -explicitly request the API v3 media type in the Accept header:

    - -
    application/vnd.github.v3+json
    -
    - -

    Check out version docs for the full list of differences between beta and v3.

    - -

    Comment Body Properties

    - -

    The body of a comment can be written in GitHub Flavored Markdown. -Issues, Issue Comments, Pull Request Comments, and Gist Comments all -accept these same media types:

    - -

    Raw

    - -
    application/vnd.github.VERSION.raw+json
    -
    - -

    Return the raw markdown body. Response will include body. This is the -default if you do not pass any specific media type.

    - -

    Text

    - -
    application/vnd.github.VERSION.text+json
    -
    - -

    Return a text only representation of the markdown body. Response will -include body_text.

    - -

    HTML

    - -
    application/vnd.github.VERSION.html+json
    -
    - -

    Return HTML rendered from the body’s markdown. Response will include -body_html.

    - -

    Full

    - -
    application/vnd.github.VERSION.full+json
    -
    - -

    Return raw, text and HTML representations. Response will include body, -body_text, and body_html:

    - -

    Git Blob Properties

    - -

    The following media types are allowed when getting a blob:

    - -

    JSON

    - -
    application/vnd.github.VERSION+json
    -application/json
    -
    - -

    Return JSON representation of the blob with content as a base64 -encoded string. This is the default if nothing is passed.

    - -

    Raw

    - -
    application/vnd.github.VERSION.raw
    -
    - -

    Return the raw blob data.

    - -

    Commits, Commit comparison, and Pull Requests

    - -

    The Commit, Commit Comparison, and Pull Request resources support -diff and patch formats:

    - -

    diff

    - -
    application/vnd.github.VERSION.diff
    -
    - -

    patch

    - -
    application/vnd.github.VERSION.patch
    -
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/meta/index.html b/v3/meta/index.html deleted file mode 100644 index c755c30e70..0000000000 --- a/v3/meta/index.html +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - Meta | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Meta

    - -

    This endpoint provides information about GitHub.com, the service. -Or, if you access this endpoint on your organization’s GitHub Enterprise installation, this endpoint provides information about that installation.

    - -
    GET /meta
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "hooks": [
    -    "127.0.0.1/32"
    -  ],
    -  "git": [
    -    "127.0.0.1/32"
    -  ],
    -  "verifiable_password_authentication": true
    -}
    - -

    Body

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    hooks -array of strings -An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from on GitHub.com. Subscribe to the API Changes blog or follow @GitHubAPI on Twitter to get updated when this list changes.
    git -array of strings -An Array of IP addresses in CIDR format specifying the Git servers for GitHub.com.
    verifiable_password_authenticationbooleanWhether authentication with username and password is supported. (GitHub Enterprise instances using CAS or OAuth for authentication will return false. Features like Basic Authentication with a username and password, sudo mode, and two-factor authentication are not supported on these servers.)
    - -
    - - - -
    - - - - - - - - diff --git a/v3/misc/index.html b/v3/misc/index.html deleted file mode 100644 index d6c217e424..0000000000 --- a/v3/misc/index.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - Miscellaneous | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Miscellaneous

    - -

    This is a miscellaneous set of APIs which provide access to top level GitHub resources and info.

    - -

    Emojis

    - -

    The Emojis API lets you list all the emojis available to use on -GitHub.

    - -

    Gitignore

    - -

    The Gitignore API gives you access to the available gitignore -templates.

    - -

    Markdown

    - -

    The Markdown API lets you render Markdown documents.

    - -

    Meta

    - -

    The Meta API provides information about GitHub.com (the service) or your -organization’s GitHub Enterprise installation.

    - -

    Rate Limit

    - -

    The Rate Limit API lets you check your current rate limit -status at any time.

    - - -
    - - - -
    - - - - - - - - diff --git a/v3/oauth/index.html b/v3/oauth/index.html deleted file mode 100644 index edeec73957..0000000000 --- a/v3/oauth/index.html +++ /dev/null @@ -1,963 +0,0 @@ - - - - - - - - OAuth | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    OAuth

    - - - -

    OAuth2 is a protocol that lets external apps request authorization to -private details in a user’s GitHub account without getting their -password. This is preferred over Basic Authentication because tokens can -be limited to specific types of data, and can be revoked by users at any -time.

    - -

    All developers need to register their -application before getting -started. A registered OAuth application is assigned a unique Client ID -and Client Secret. The Client Secret should not be shared.

    - -

    Web Application Flow

    - -

    This is a description of the OAuth2 flow from 3rd party web sites.

    - -

    1. Redirect users to request GitHub access

    - -
    GET https://github.com/login/oauth/authorize
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    client_idstring -Required. The client ID you received from GitHub when you registered.
    redirect_uristringThe URL in your app where users will be sent after authorization. See details below about redirect urls.
    scopestringA comma separated list of scopes. If not provided, scope defaults to an empty list of scopes for users that don’t have a valid token for the app. For users who do already have a valid token for the app, the user won’t be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the same scopes that were used last time the user completed the flow.
    statestringAn unguessable random string. It is used to protect against cross-site request forgery attacks.
    - -

    2. GitHub redirects back to your site

    - -

    If the user accepts your request, GitHub redirects back to your site -with a temporary code in a code parameter as well as the state you provided in -the previous step in a state parameter. If the states don’t match, the request -has been created by a third party and the process should be aborted.

    - -

    Exchange this for an access token:

    - -
    POST https://github.com/login/oauth/access_token
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    client_idstring -Required. The client ID you received from GitHub when you registered.
    client_secretstring -Required. The client secret you received from GitHub when you registered.
    codestring -Required. The code you received as a response to Step 1.
    redirect_uristringThe URL in your app where users will be sent after authorization. See details below about redirect urls.
    - -

    Response

    - -

    By default, the response will take the following form:

    - -
    access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer
    -
    - -

    You can also receive the content in different formats depending on the Accept -header:

    - -
    Accept: application/json
    -{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a", "scope":"repo,gist", "token_type":"bearer"}
    -
    -Accept: application/xml
    -<OAuth>
    -  <token_type>bearer</token_type>
    -  <scope>repo,gist</scope>
    -  <access_token>e72e16c7e42f292c6912e7710c838347ae178b4a</access_token>
    -</OAuth>
    -
    - -

    Requested scopes vs. granted scopes

    - -

    The scope attribute lists scopes attached to the token that were granted by -the user. Normally, these scopes will be identical to what you requested. -However, users will soon be able to edit their scopes, effectively -granting your application less access than you originally requested. Also, users -will also be able to edit token scopes after the OAuth flow completed. -You should be aware of this possibility and adjust your application’s behavior -accordingly.

    - -

    It is important to handle error cases where a user chooses to grant you -less access than you originally requested. For example, applications can warn -or otherwise communicate with their users that they will see reduced -functionality or be unable to perform some actions.

    - -

    Also, applications can always send users back through the flow again to get -additional permission, but don’t forget that users can always say no.

    - -

    Check out the Basics of Authentication guide which -provides tips on handling modifiable token scopes.

    - -

    3. Use the access token to access the API

    - -

    The access token allows you to make requests to the API on a behalf of a user.

    - -
    GET https://api.github.com/user?access_token=...
    -
    - -

    Non-Web Application Flow

    - -

    Use Basic Authentication to create an OAuth2 -token using the interface below. With -this technique, a username and password need not be stored permanently, and the -user can revoke access at any time. (Make sure to understand how to work with -two-factor authentication if -you or your users have two-factor authentication enabled.)

    - -

    Redirect URLs

    - -

    The redirect_uri parameter is optional. If left out, GitHub will -redirect users to the callback URL configured in the OAuth Application -settings. If provided, the redirect URL’s host and port must exactly -match the callback URL. The redirect URL’s path must reference a -subdirectory of the callback URL.

    - -
    CALLBACK: http://example.com/path
    -
    -GOOD: https://example.com/path
    -GOOD: http://example.com/path/subdir/other
    -BAD:  http://example.com/bar
    -BAD:  http://example.com/
    -BAD:  http://example.com:8080/path
    -BAD:  http://oauth.example.com:8080/path
    -BAD:  http://example.org
    -
    - -

    Scopes

    - -

    Scopes let you specify exactly what type of access you need. Scopes limit -access for OAuth tokens. They do not grant any additional permission beyond -that which the user already has.

    - -

    For the web flow, requested scopes will be displayed to the user on the -authorize form.

    - -

    Check headers to see what OAuth scopes you have, and what the API action -accepts.

    - -
    $ curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/users/technoweenie -I
    -HTTP/1.1 200 OK
    -X-OAuth-Scopes: repo, user
    -X-Accepted-OAuth-Scopes: user
    -
    - -

    X-OAuth-Scopes lists the scopes your token has authorized. -X-Accepted-OAuth-Scopes lists the scopes that the action checks for.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    (no scope)Public read-only access (includes public user profile info, public repo info, and gists)
    userRead/write access to profile info only. Note: this scope includes user:email and user:follow.
    user:emailRead access to a user’s email addresses.
    user:followAccess to follow or unfollow other users.
    public_repoRead/write access to public repos and organizations.
    repoRead/write access to public and private repos and organizations.
    repo:statusRead/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code. The repo and public_repo scopes already include access to commit status for private and public repositories, respectively.
    delete_repoDelete access to adminable repositories.
    notificationsRead access to a user’s notifications. repo is accepted too.
    gistWrite access to gists.
    - -

    NOTE: Your application can request the scopes in the initial redirection. You -can specify multiple scopes by separating them with a comma:

    - -
    https://github.com/login/oauth/authorize?
    -  client_id=...&
    -  scope=user,public_repo
    -
    - -

    OAuth Authorizations API

    - -

    There is an API for users to manage their own tokens. You can only access your -own tokens, and only via Basic Authentication. -(Make sure to understand how to work with two-factor -authentication if you or your -users have two-factor authentication enabled.)

    - -

    List your authorizations

    - -
    GET /authorizations
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/authorizations/1",
    -    "scopes": [
    -      "public_repo"
    -    ],
    -    "token": "abc123",
    -    "app": {
    -      "url": "http://my-github-app.com",
    -      "name": "my github app",
    -      "client_id": "abcde12345fghij67890"
    -    },
    -    "note": "optional note",
    -    "note_url": "http://optional/note/url",
    -    "updated_at": "2011-09-06T20:39:23Z",
    -    "created_at": "2011-09-06T17:26:27Z"
    -  }
    -]
    - -

    Get a single authorization

    - -
    GET /authorizations/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z"
    -}
    - -

    Create a new authorization

    - -

    If you need a small number of tokens, implementing the web flow -can be cumbersome. Instead, tokens can be created using the Authorizations API using -Basic Authentication. To create tokens for a particular OAuth application, you -must provide its client ID and secret, found on the OAuth application settings -page, linked from your OAuth applications listing on GitHub. OAuth tokens -can also be created through the web UI via the Application settings page. -Read more about these tokens on the GitHub Help page.

    - -
    POST /authorizations
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    scopesarrayA list of scopes that this authorization is in.
    notestringA note to remind you what the OAuth token is for.
    note_urlstringA URL to remind you what app the OAuth token is for.
    client_idstringThe 20 character OAuth app client key for which to create the token.
    client_secretstringThe 40 character OAuth app client secret for which to create the token.
    - -
    {
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "note": "admin script"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/authorizations/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z"
    -}
    - -

    Get-or-create an authorization for a specific app

    - -

    This method will create a new authorization for the specified OAuth application, -only if an authorization for that application doesn’t already exist for the -user. (The URL includes the 20 character client ID for the OAuth app that is -requesting the token.) It returns the user’s token for the application if one -exists. Otherwise, it creates one.

    - -
    PUT /authorizations/clients/:client_id
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    client_secretstringThe 40 character OAuth app client secret associated with the client ID specified in the URL.
    scopesarrayA list of scopes that this authorization is in.
    notestringA note to remind you what the OAuth token is for.
    note_urlstringA URL to remind you what app the OAuth token is for.
    - -
    {
    -  "client_secret": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "note": "admin script"
    -}
    - -

    Response if returning a new token

    - -
    Status: 201 Created
    -Location: https://api.github.com/authorizations/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z"
    -}
    - -

    Response if returning an existing token

    - -
    Status: 200 OK
    -Location: https://api.github.com/authorizations/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z"
    -}
    - -

    Update an existing authorization

    - -
    PATCH /authorizations/:id
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    scopesarrayReplaces the authorization scopes with these.
    add_scopesarrayA list of scopes to add to this authorization.
    remove_scopesarrayA list of scopes to remove from this authorization.
    notestringA note to remind you what the OAuth token is for.
    note_urlstringA URL to remind you what app the OAuth token is for.
    - -

    You can only send one of these scope keys at a time.

    - -
    {
    -  "add_scopes": [
    -    "repo"
    -  ],
    -  "note": "admin script"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z"
    -}
    - -

    Delete an authorization

    - -
    DELETE /authorizations/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Check an authorization

    - -

    OAuth applications can use a special API method for checking OAuth token -validity without running afoul of normal rate limits for failed login attempts. -Authentication works differently with this particular endpoint. You must use -Basic Authentication when accessing it, where the username is the OAuth -application client_id and the password is its client_secret. Invalid tokens -will return 404 NOT FOUND.

    - -
    GET /applications/:client_id/tokens/:access_token
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/authorizations/1",
    -  "scopes": [
    -    "public_repo"
    -  ],
    -  "token": "abc123",
    -  "app": {
    -    "url": "http://my-github-app.com",
    -    "name": "my github app",
    -    "client_id": "abcde12345fghij67890"
    -  },
    -  "note": "optional note",
    -  "note_url": "http://optional/note/url",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    Revoke all authorizations for an application

    - -

    OAuth application owners can revoke every token for an OAuth application. You -must use Basic Authentication when calling -this method. The username is the OAuth application client_id and the password -is its client_secret. Tokens are revoked via a background job, and it might -take a few minutes for the process to complete.

    - -
    DELETE /applications/:client_id/tokens
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Revoke an authorization for an application

    - -

    OAuth application owners can also revoke a single token for an OAuth -application. You must use Basic Authentication -for this method, where the username is the OAuth application client_id and - the password is its client_secret.

    - -
    DELETE /applications/:client_id/tokens/:access_token
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    More Information

    - -

    It can be a little tricky to get started with OAuth. Here are a few -links that might be of help:

    - - - - -
    - - - -
    - - - - - - - - diff --git a/v3/orgs/index.html b/v3/orgs/index.html deleted file mode 100644 index 7967e42374..0000000000 --- a/v3/orgs/index.html +++ /dev/null @@ -1,385 +0,0 @@ - - - - - - - - Organizations | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Organizations

    - - - -

    List User Organizations

    - -

    List all public organizations for an unauthenticated user. Lists private and public organizations for authenticated users.

    - -
    GET /users/:user/orgs
    -
    - -

    List public and private organizations for the authenticated user.

    - -
    GET /user/orgs
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "github",
    -    "id": 1,
    -    "url": "https://api.github.com/orgs/github",
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -  }
    -]
    - -

    Get an Organization

    - -
    GET /orgs/:org
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "login": "github",
    -  "id": 1,
    -  "url": "https://api.github.com/orgs/github",
    -  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -  "name": "github",
    -  "company": "GitHub",
    -  "blog": "https://github.com/blog",
    -  "location": "San Francisco",
    -  "email": "octocat@github.com",
    -  "public_repos": 2,
    -  "public_gists": 1,
    -  "followers": 20,
    -  "following": 0,
    -  "html_url": "https://github.com/octocat",
    -  "created_at": "2008-01-14T04:33:35Z",
    -  "type": "Organization"
    -}
    - -

    Edit an Organization

    - -
    PATCH /orgs/:org
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    billing_emailstringBilling email address. This address is not publicized.
    companystringThe company name.
    emailstringThe publicly visible email address.
    locationstringThe location.
    namestringThe shorthand name of the company.
    - -

    Example

    - -
    {
    -  "billing_email": "support@github.com",
    -  "blog": "https://github.com/blog",
    -  "company": "GitHub",
    -  "email": "support@github.com",
    -  "location": "San Francisco",
    -  "name": "github"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "login": "github",
    -  "id": 1,
    -  "url": "https://api.github.com/orgs/github",
    -  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -  "name": "github",
    -  "company": "GitHub",
    -  "blog": "https://github.com/blog",
    -  "location": "San Francisco",
    -  "email": "octocat@github.com",
    -  "public_repos": 2,
    -  "public_gists": 1,
    -  "followers": 20,
    -  "following": 0,
    -  "html_url": "https://github.com/octocat",
    -  "created_at": "2008-01-14T04:33:35Z",
    -  "type": "Organization",
    -  "total_private_repos": 100,
    -  "owned_private_repos": 100,
    -  "private_gists": 81,
    -  "disk_usage": 10000,
    -  "collaborators": 8,
    -  "billing_email": "support@github.com",
    -  "plan": {
    -    "name": "Medium",
    -    "space": 400,
    -    "private_repos": 20
    -  }
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/orgs/members/index.html b/v3/orgs/members/index.html deleted file mode 100644 index 5f0d5872f0..0000000000 --- a/v3/orgs/members/index.html +++ /dev/null @@ -1,435 +0,0 @@ - - - - - - - - Organization Members | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Members

    - - - -

    Members list

    - -

    List all users who are members of an organization. A member is a user that -belongs to at least 1 team in the organization. If the authenticated user is -also an owner of this organization then both concealed and public members will -be returned. If the requester is not an owner of the organization the query -will be redirected to the public members list.

    - -
    GET /orgs/:org/members
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    filterstringFilter members returned in the list. Can be one of:
    * 2fa_disabled: Members without two-factor authentication enabled. Available for owners of organizations with private repositories.
    * all: All members the authenticated user can see.

    Default: all -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Response if requester is not an organization member

    - -
    Status: 302 Found
    -Location: https://api.github.com/orgs/github/public_members
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Check membership

    - -

    Check if a user is, publicly or privately, a member of the organization.

    - -
    GET /orgs/:org/members/:user
    -
    - -

    Response if requester is an organization member and user is a member

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if requester is an organization member and user is not a member

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if requester is not an organization member and is inquiring about themselves

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if requester is not an organization member

    - -
    Status: 302 Found
    -Location: https://api.github.com/orgs/github/public_members/pezra
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Add a member

    - -

    To add someone as a member to an org, you must add them to a -team.

    - -

    Remove a member

    - -

    Removing a user from this list will remove them from all teams and -they will no longer have any access to the organization’s repositories.

    - -
    DELETE /orgs/:org/members/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Public members list

    - -

    Members of an organization can choose to have their membership -publicized or not.

    - -
    GET /orgs/:org/public_members
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Check public membership

    - -
    GET /orgs/:org/public_members/:user
    -
    - -

    Response if user is a public member

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if user is not a public member

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Publicize a user’s membership

    - -

    The user can publicize their own membership. -(A user cannot publicize the membership for another user.)

    - -
    PUT /orgs/:org/public_members/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Conceal a user’s membership

    - -
    DELETE /orgs/:org/public_members/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/orgs/teams/index.html b/v3/orgs/teams/index.html deleted file mode 100644 index ae6d4bc7ca..0000000000 --- a/v3/orgs/teams/index.html +++ /dev/null @@ -1,706 +0,0 @@ - - - - - - - - Organization Teams | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Teams

    - - - -

    All actions against teams require at a minimum an authenticated user who -is a member of the Owners team in the :org being managed. Additionally, -OAuth users require “user” scope.

    - -

    List teams

    - -
    GET /orgs/:org/teams
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/teams/1",
    -    "name": "Owners",
    -    "id": 1
    -  }
    -]
    - -

    Get team

    - -
    GET /teams/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/teams/1",
    -  "name": "Owners",
    -  "id": 1,
    -  "permission": "admin",
    -  "members_count": 3,
    -  "repos_count": 10,
    -  "organization": {
    -    "login": "github",
    -    "id": 1,
    -    "url": "https://api.github.com/orgs/github",
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -  }
    -}
    - -

    Create team

    - -

    In order to create a team, the authenticated user must be an owner of -:org.

    - -
    POST /orgs/:org/teams
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the team.
    repo_names -array of strings -The repositories to add the team to.
    permissionstringThe permission to grant the team. Can be one of:
    * pull - team members can pull, but not push to or administer these repositories.
    * push - team members can pull and push, but not administer these repositories.
    * admin - team members can pull, push and administer these repositories.
    Default: pull -
    - -

    Example

    - -
    {
    -  "name": "new team",
    -  "permission": "push",
    -  "repo_names": [
    -    "github/dotfiles"
    -  ]
    -}
    - -

    Response

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/teams/1",
    -  "name": "Owners",
    -  "id": 1,
    -  "permission": "admin",
    -  "members_count": 3,
    -  "repos_count": 10,
    -  "organization": {
    -    "login": "github",
    -    "id": 1,
    -    "url": "https://api.github.com/orgs/github",
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -  }
    -}
    - -

    Edit team

    - -

    In order to edit a team, the authenticated user must be an owner of -the org that the team is associated with.

    - -
    PATCH /teams/:id
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the team.
    permissionstringThe permission to grant the team. Can be one of:
    * pull - team members can pull, but not push to or administer these repositories.
    * push - team members can pull and push, but not administer these repositories.
    * admin - team members can pull, push and administer these repositories. Default: pull -
    - -

    Example

    - -
    {
    -  "name": "new team name",
    -  "permission": "push"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/teams/1",
    -  "name": "Owners",
    -  "id": 1,
    -  "permission": "admin",
    -  "members_count": 3,
    -  "repos_count": 10,
    -  "organization": {
    -    "login": "github",
    -    "id": 1,
    -    "url": "https://api.github.com/orgs/github",
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -  }
    -}
    - -

    Delete team

    - -

    In order to delete a team, the authenticated user must be an owner of -the org that the team is associated with.

    - -
    DELETE /teams/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    List team members

    - -

    In order to list members in a team, the authenticated user must be a -member of the team.

    - -
    GET /teams/:id/members
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Get team member

    - -

    In order to get if a user is a member of a team, the authenticated user -must be a member of the team.

    - -
    GET /teams/:id/members/:user
    -
    - -

    Response if user is a member

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if user is not a member

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Add team member

    - -

    In order to add a user to a team, the authenticated user must have -‘admin’ permissions to the team or be an owner of the org that the team -is associated with.

    - -
    PUT /teams/:id/members/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    If you attempt to add an organization to a team, you will get this:

    - -
    Status: 422 Unprocessable Entity
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "message": "Validation Failed",
    -  "errors": [
    -    {
    -      "code": "org",
    -      "field": "user",
    -      "resource": "TeamMember"
    -    }
    -  ]
    -}
    - -

    Remove team member

    - -

    In order to remove a user from a team, the authenticated user must have -‘admin’ permissions to the team or be an owner of the org that the team -is associated with. -NOTE: This does not delete the user, it just remove them from the team.

    - -
    DELETE /teams/:id/members/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    List team repos

    - -
    GET /teams/:id/repos
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": false,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  }
    -]
    - -

    Check if a team manages a repository

    - -
    GET /teams/:id/repos/:owner/:repo
    -
    - -

    Response if repository is managed by this team

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if repository is not managed by this team

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Add team repository

    - -

    In order to add a repository to a team, the authenticated user must be an -owner of the org that the team is associated with. Also, the repository must -be owned by the organization, or a direct fork of a repository owned by the -organization.

    - -
    PUT /teams/:id/repos/:org/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    If you attempt to add a repository to a team that is not owned by the -organization, you get:

    - -
    Status: 422 Unprocessable Entity
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "message": "Validation Failed",
    -  "errors": [
    -    {
    -      "code": "not_owned",
    -      "field": "repository",
    -      "resource": "TeamMember"
    -    }
    -  ]
    -}
    - -

    Remove team repository

    - -

    In order to remove a repository from a team, the authenticated user must be an -owner of the org that the team is associated with. -NOTE: This does not delete the repository, it just removes it from the team.

    - -
    DELETE /teams/:id/repos/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    List user teams

    - -

    List all of the teams across all of the organizations to which the -authenticated user belongs. This method requires user or repo -scope when authenticating via OAuth.

    - -
    GET /user/teams
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/teams/1",
    -    "name": "Owners",
    -    "id": 1,
    -    "permission": "admin",
    -    "members_count": 3,
    -    "repos_count": 10,
    -    "organization": {
    -      "login": "github",
    -      "id": 1,
    -      "url": "https://api.github.com/orgs/github",
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif"
    -    }
    -  }
    -]
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/pulls/comments/index.html b/v3/pulls/comments/index.html deleted file mode 100644 index 7b4ba55889..0000000000 --- a/v3/pulls/comments/index.html +++ /dev/null @@ -1,701 +0,0 @@ - - - - - - - - Review Comments | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Review Comments

    - - - -

    Pull Request Review Comments are comments on a portion of the unified -diff. These are separate from Commit Comments (which are applied -directly to a commit, outside of the Pull Request view), and Issue -Comments (which do not reference a portion of the unified diff).

    - -

    Pull Request Review Comments use these custom media -types. You can read more about the use of media types in the API -here.

    - -

    List comments on a pull request

    - -
    GET /repos/:owner/:repo/pulls/:number/comments
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -    "id": 1,
    -    "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -    "path": "file1.txt",
    -    "position": 1,
    -    "original_position": 4,
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "body": "Great stuff",
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z",
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -    "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -    "_links": {
    -      "self": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -      },
    -      "html": {
    -        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -      },
    -      "pull_request": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -      }
    -    }
    -  }
    -]
    - -

    List comments in a repository

    - -
    GET /repos/:owner/:repo/pulls/comments
    -
    - -

    By default, Review Comments are ordered by ascending ID.

    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sortstringCan be either created or updated. Default: created -
    directionstringCan be either asc or desc. Ignored without sort parameter.
    sincestringOnly comments updated at or after this time are returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -    "id": 1,
    -    "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -    "path": "file1.txt",
    -    "position": 1,
    -    "original_position": 4,
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "body": "Great stuff",
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z",
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -    "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -    "_links": {
    -      "self": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -      },
    -      "html": {
    -        "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -      },
    -      "pull_request": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -      }
    -    }
    -  }
    -]
    - -

    Get a single comment

    - -
    GET /repos/:owner/:repo/pulls/comments/:number
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -  "id": 1,
    -  "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -  "path": "file1.txt",
    -  "position": 1,
    -  "original_position": 4,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "body": "Great stuff",
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -  "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -    },
    -    "pull_request": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    }
    -  }
    -}
    - -

    Create a comment

    - -
    POST /repos/:owner/:repo/pulls/:number/comments
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The text of the comment
    commit_idstring -Required. The SHA of the commit to comment on.
    pathstring -Required. The relative path of the file to comment on.
    positionnumber -Required. The line index in the diff to comment on.
    - -

    Example

    - -
    {
    -  "body": "Nice change",
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "path": "file1.txt",
    -  "position": 4
    -}
    - -

    Alternative Input

    - -

    Instead of passing commit_id, path, and position you can reply to -an existing Pull Request Comment like this:

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The text of the comment
    in_reply_tonumber -Required. The comment id to reply to.
    - -

    Example

    - -
    {
    -  "body": "Nice change",
    -  "in_reply_to": 4
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/:owner/:repo/pulls/comments/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -  "id": 1,
    -  "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -  "path": "file1.txt",
    -  "position": 1,
    -  "original_position": 4,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "body": "Great stuff",
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -  "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -    },
    -    "pull_request": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    }
    -  }
    -}
    - -

    Edit a comment

    - -
    PATCH /repos/:owner/:repo/pulls/comments/:number
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The text of the comment
    - -

    Example

    - -
    {
    -  "body": "Nice change"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
    -  "id": 1,
    -  "diff_hunk": "@@ -16,33 +16,40 @@ public class Connection : IConnection...",
    -  "path": "file1.txt",
    -  "position": 1,
    -  "original_position": 4,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "original_commit_id": "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "body": "Great stuff",
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1",
    -  "pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1"
    -    },
    -    "pull_request": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    }
    -  }
    -}
    - -

    Delete a comment

    - -
    DELETE /repos/:owner/:repo/pulls/comments/:number
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Custom media types

    - -

    These are the supported media types for pull request review comments. You can -read more about the use of media types in the API here.

    - -
    application/vnd.github.VERSION.raw+json
    -application/vnd.github.VERSION.text+json
    -application/vnd.github.VERSION.html+json
    -application/vnd.github.VERSION.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/pulls/index.html b/v3/pulls/index.html deleted file mode 100644 index 55b610f80c..0000000000 --- a/v3/pulls/index.html +++ /dev/null @@ -1,1520 +0,0 @@ - - - - - - - - Pull Requests | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Pull Requests

    - - - -

    The Pull Request API allows you to list, view, edit, create, and even merge -pull requests. Comments on pull requests can be managed via the Issue -Comments API.

    - -

    Pull Requests use these custom media types. You -can read more about the use of media types in the API -here.

    - - - -

    Pull Requests have these possible link relations:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    selfThe API location of this Pull Request.
    htmlThe HTML location of this Pull Request.
    issueThe API location of this Pull Request’s Issue.
    commentsThe API location of this Pull Request’s Issue comments.
    review_commentsThe API location of this Pull Request’s Review comments.
    commitsThe API location of this Pull Request’s commits.
    statusesThe API location of this Pull Request’s commit statuses, which are the statuses of its head branch.
    - -

    List pull requests

    - -
    GET /repos/:owner/:repo/pulls
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    statestringEither open or closed to filter by state. Default: open -
    headstringFilter pulls by head user and branch name in the format of user:ref-name. Example: github:new-script-format.
    basestringFilter pulls by base branch name. Example: gh-pages.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -    "html_url": "https://github.com/octocat/Hello-World/pull/1",
    -    "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
    -    "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
    -    "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1",
    -    "commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits",
    -    "review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments",
    -    "comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments",
    -    "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "number": 1,
    -    "state": "open",
    -    "title": "new-feature",
    -    "body": "Please pull these awesome changes",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:01:12Z",
    -    "closed_at": "2011-01-26T19:01:12Z",
    -    "merged_at": "2011-01-26T19:01:12Z",
    -    "head": {
    -      "label": "new-topic",
    -      "ref": "new-topic",
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "repo": {
    -        "id": 1296269,
    -        "owner": {
    -          "login": "octocat",
    -          "id": 1,
    -          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -          "gravatar_id": "somehexcode",
    -          "url": "https://api.github.com/users/octocat",
    -          "html_url": "https://github.com/octocat",
    -          "followers_url": "https://api.github.com/users/octocat/followers",
    -          "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -          "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -          "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -          "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -          "organizations_url": "https://api.github.com/users/octocat/orgs",
    -          "repos_url": "https://api.github.com/users/octocat/repos",
    -          "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -          "received_events_url": "https://api.github.com/users/octocat/received_events",
    -          "type": "User",
    -          "site_admin": false
    -        },
    -        "name": "Hello-World",
    -        "full_name": "octocat/Hello-World",
    -        "description": "This your first repo!",
    -        "private": false,
    -        "fork": false,
    -        "url": "https://api.github.com/repos/octocat/Hello-World",
    -        "html_url": "https://github.com/octocat/Hello-World",
    -        "clone_url": "https://github.com/octocat/Hello-World.git",
    -        "git_url": "git://github.com/octocat/Hello-World.git",
    -        "ssh_url": "git@github.com:octocat/Hello-World.git",
    -        "svn_url": "https://svn.github.com/octocat/Hello-World",
    -        "mirror_url": "git://git.example.com/octocat/Hello-World",
    -        "homepage": "https://github.com",
    -        "language": null,
    -        "forks_count": 9,
    -        "stargazers_count": 80,
    -        "watchers_count": 80,
    -        "size": 108,
    -        "default_branch": "master",
    -        "master_branch": "master",
    -        "open_issues_count": 0,
    -        "pushed_at": "2011-01-26T19:06:43Z",
    -        "created_at": "2011-01-26T19:01:12Z",
    -        "updated_at": "2011-01-26T19:14:43Z"
    -      }
    -    },
    -    "base": {
    -      "label": "master",
    -      "ref": "master",
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "user": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "repo": {
    -        "id": 1296269,
    -        "owner": {
    -          "login": "octocat",
    -          "id": 1,
    -          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -          "gravatar_id": "somehexcode",
    -          "url": "https://api.github.com/users/octocat",
    -          "html_url": "https://github.com/octocat",
    -          "followers_url": "https://api.github.com/users/octocat/followers",
    -          "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -          "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -          "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -          "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -          "organizations_url": "https://api.github.com/users/octocat/orgs",
    -          "repos_url": "https://api.github.com/users/octocat/repos",
    -          "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -          "received_events_url": "https://api.github.com/users/octocat/received_events",
    -          "type": "User",
    -          "site_admin": false
    -        },
    -        "name": "Hello-World",
    -        "full_name": "octocat/Hello-World",
    -        "description": "This your first repo!",
    -        "private": false,
    -        "fork": false,
    -        "url": "https://api.github.com/repos/octocat/Hello-World",
    -        "html_url": "https://github.com/octocat/Hello-World",
    -        "clone_url": "https://github.com/octocat/Hello-World.git",
    -        "git_url": "git://github.com/octocat/Hello-World.git",
    -        "ssh_url": "git@github.com:octocat/Hello-World.git",
    -        "svn_url": "https://svn.github.com/octocat/Hello-World",
    -        "mirror_url": "git://git.example.com/octocat/Hello-World",
    -        "homepage": "https://github.com",
    -        "language": null,
    -        "forks_count": 9,
    -        "stargazers_count": 80,
    -        "watchers_count": 80,
    -        "size": 108,
    -        "default_branch": "master",
    -        "master_branch": "master",
    -        "open_issues_count": 0,
    -        "pushed_at": "2011-01-26T19:06:43Z",
    -        "created_at": "2011-01-26T19:01:12Z",
    -        "updated_at": "2011-01-26T19:14:43Z"
    -      }
    -    },
    -    "_links": {
    -      "self": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -      },
    -      "html": {
    -        "href": "https://github.com/octocat/Hello-World/pull/1"
    -      },
    -      "issue": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/issues/1"
    -      },
    -      "comments": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments"
    -      },
    -      "review_comments": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments"
    -      },
    -      "commits": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits"
    -      },
    -      "statuses": {
    -        "href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    },
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    }
    -  }
    -]
    - -

    Get a single pull request

    - -
    GET /repos/:owner/:repo/pulls/:number
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1",
    -  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
    -  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
    -  "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1",
    -  "commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits",
    -  "review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments",
    -  "comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments",
    -  "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "number": 1,
    -  "state": "open",
    -  "title": "new-feature",
    -  "body": "Please pull these awesome changes",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:01:12Z",
    -  "closed_at": "2011-01-26T19:01:12Z",
    -  "merged_at": "2011-01-26T19:01:12Z",
    -  "head": {
    -    "label": "new-topic",
    -    "ref": "new-topic",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "base": {
    -    "label": "master",
    -    "ref": "master",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1"
    -    },
    -    "issue": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1"
    -    },
    -    "comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments"
    -    },
    -    "review_comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments"
    -    },
    -    "commits": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits"
    -    },
    -    "statuses": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -    }
    -  },
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
    -  "merged": false,
    -  "mergeable": true,
    -  "merged_by": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "comments": 10,
    -  "commits": 3,
    -  "additions": 100,
    -  "deletions": 3,
    -  "changed_files": 5
    -}
    - -

    Mergability

    - -

    Each time the pull request receives new commits, GitHub creates a merge commit -to test whether the pull request can be automatically merged into the base -branch. (This test commit is not added to the base branch or the head branch.) -The merge_commit_sha attribute holds the SHA of the test merge commit; -however, this attribute is deprecated and is scheduled for -removal in the next version of the API. The Boolean mergeable attribute will -remain to indicate whether the pull request can be automatically merged.

    - -

    Alternative Response Formats

    - -

    Pass the appropriate media type to fetch diff and patch formats.

    - -

    Create a pull request

    - -
    POST /repos/:owner/:repo/pulls
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestring -Required. The title of the pull request.
    headstring -Required. The branch (or git ref) where your changes are implemented.
    basestring -Required. The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
    bodystringThe contents of the pull request.
    - -

    NOTE: head and base can be either a sha or a branch name. Typically you -would namespace head with a user like this: username:branch.

    - -

    Example

    - -
    {
    -  "title": "Amazing new feature",
    -  "body": "Please pull this in!",
    -  "head": "octocat:new-feature",
    -  "base": "master"
    -}
    - -

    Alternative Input

    - -

    You can also create a Pull Request from an existing Issue by passing an -Issue number instead of title and body.

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    issuenumber -Required. The issue number in this repository to turn into a Pull Request.
    - -

    Example

    - -
    {
    -  "issue": "5",
    -  "head": "octocat:new-feature",
    -  "base": "master"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/user/repo/pulls/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1",
    -  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
    -  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
    -  "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1",
    -  "commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits",
    -  "review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments",
    -  "comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments",
    -  "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "number": 1,
    -  "state": "open",
    -  "title": "new-feature",
    -  "body": "Please pull these awesome changes",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:01:12Z",
    -  "closed_at": "2011-01-26T19:01:12Z",
    -  "merged_at": "2011-01-26T19:01:12Z",
    -  "head": {
    -    "label": "new-topic",
    -    "ref": "new-topic",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "base": {
    -    "label": "master",
    -    "ref": "master",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1"
    -    },
    -    "issue": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1"
    -    },
    -    "comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments"
    -    },
    -    "review_comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments"
    -    },
    -    "commits": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits"
    -    },
    -    "statuses": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -    }
    -  },
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    Update a pull request

    - -
    PATCH /repos/:owner/:repo/pulls/:number
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    titlestringThe title of the pull request.
    bodystringThe contents of the pull request.
    statestringState of this Pull Request. Either open or closed.
    - -

    Example

    - -
    {
    -  "title": "new title",
    -  "body": "updated body",
    -  "state": "open"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1",
    -  "html_url": "https://github.com/octocat/Hello-World/pull/1",
    -  "diff_url": "https://github.com/octocat/Hello-World/pulls/1.diff",
    -  "patch_url": "https://github.com/octocat/Hello-World/pulls/1.patch",
    -  "issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1",
    -  "commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits",
    -  "review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments",
    -  "comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments",
    -  "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "number": 1,
    -  "state": "open",
    -  "title": "new-feature",
    -  "body": "Please pull these awesome changes",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:01:12Z",
    -  "closed_at": "2011-01-26T19:01:12Z",
    -  "merged_at": "2011-01-26T19:01:12Z",
    -  "head": {
    -    "label": "new-topic",
    -    "ref": "new-topic",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "base": {
    -    "label": "master",
    -    "ref": "master",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "repo": {
    -      "id": 1296269,
    -      "owner": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "name": "Hello-World",
    -      "full_name": "octocat/Hello-World",
    -      "description": "This your first repo!",
    -      "private": false,
    -      "fork": false,
    -      "url": "https://api.github.com/repos/octocat/Hello-World",
    -      "html_url": "https://github.com/octocat/Hello-World",
    -      "clone_url": "https://github.com/octocat/Hello-World.git",
    -      "git_url": "git://github.com/octocat/Hello-World.git",
    -      "ssh_url": "git@github.com:octocat/Hello-World.git",
    -      "svn_url": "https://svn.github.com/octocat/Hello-World",
    -      "mirror_url": "git://git.example.com/octocat/Hello-World",
    -      "homepage": "https://github.com",
    -      "language": null,
    -      "forks_count": 9,
    -      "stargazers_count": 80,
    -      "watchers_count": 80,
    -      "size": 108,
    -      "default_branch": "master",
    -      "master_branch": "master",
    -      "open_issues_count": 0,
    -      "pushed_at": "2011-01-26T19:06:43Z",
    -      "created_at": "2011-01-26T19:01:12Z",
    -      "updated_at": "2011-01-26T19:14:43Z"
    -    }
    -  },
    -  "_links": {
    -    "self": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1"
    -    },
    -    "html": {
    -      "href": "https://github.com/octocat/Hello-World/pull/1"
    -    },
    -    "issue": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1"
    -    },
    -    "comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/issues/1/comments"
    -    },
    -    "review_comments": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/comments"
    -    },
    -    "commits": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/pulls/1/commits"
    -    },
    -    "statuses": {
    -      "href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -    }
    -  },
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    List commits on a pull request

    - -
    GET /repos/:owner/:repo/pulls/:number/commits
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "commit": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "author": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "committer": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "message": "Fix all the bugs",
    -      "tree": {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    },
    -    "author": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "committer": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    ]
    -  }
    -]
    - -

    Note: The response includes a maximum of 250 commits. If you are working with a pull request larger than that, you can use the Commit List API to enumerate all commits in the pull request.

    - -

    List pull requests files

    - -
    GET /repos/:owner/:repo/pulls/:number/files
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "sha": "bbcd538c8e72b8c175046e27cc8f907076331401",
    -    "filename": "file1.txt",
    -    "status": "added",
    -    "additions": 103,
    -    "deletions": 21,
    -    "changes": 124,
    -    "blob_url": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    -    "raw_url": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    -    "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
    -  }
    -]
    - -

    Get if a pull request has been merged

    - -
    GET /repos/:owner/:repo/pulls/:number/merge
    -
    - -

    Response if pull request has been merged

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if pull request has not been merged

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Merge a pull request (Merge Button™)

    - -
    PUT /repos/:owner/:repo/pulls/:number/merge
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    commit_messagestringThe message that will be used for the merge commit
    - -

    Response if merge was successful

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "merged": true,
    -  "message": "Pull Request successfully merged"
    -}
    - -

    Response if merge cannot be performed

    - -
    Status: 405 Method not allowed
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": null,
    -  "merged": false,
    -  "message": "Failure reason"
    -}
    - -

    Custom media types

    - -

    These are the supported media types for pull requests. You can read more about the -use of media types in the API here.

    - -
    application/vnd.github.VERSION.raw+json
    -application/vnd.github.VERSION.text+json
    -application/vnd.github.VERSION.html+json
    -application/vnd.github.VERSION.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/rate_limit/index.html b/v3/rate_limit/index.html deleted file mode 100644 index ad3a1b8318..0000000000 --- a/v3/rate_limit/index.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - - - Rate Limit | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Rate Limit

    - -

    The overview documentation describes the rate limit rules. -You can check your current rate limit status at any time using the Rate Limit -API described below.

    - -

    Get your current rate limit status

    - -

    Note: Accessing this endpoint does not count against your rate limit.

    - -
    GET /rate_limit
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    -X-RateLimit-Reset: 1372700873
    - -
    {
    -  "resources": {
    -    "core": {
    -      "limit": 5000,
    -      "remaining": 4999,
    -      "reset": 1372700873
    -    },
    -    "search": {
    -      "limit": 20,
    -      "remaining": 18,
    -      "reset": 1372697452
    -    }
    -  },
    -  "rate": {
    -    "limit": 5000,
    -    "remaining": 4999,
    -    "reset": 1372700873
    -  }
    -}
    -


    - -

    Understanding Your Rate Limit Status

    - -

    The Search API has a custom rate limit, separate from -the rate limit governing the rest of the API. For that reason, the response -(shown above) categorizes your rate limit by resource. Within the "resources" -hash, the "search" hash provides your rate limit status for the -Search API. The "core" hash provides your rate limit status for -all the rest of the API.

    - -

    Deprecation Notice

    - -

    The "rate" hash (shown at the bottom of the response above) is -deprecated and is scheduled for removal in the next -version of the API.

    - -

    If you’re writing new API client code (or updating your existing code), you -should use the "core" hash instead of the "rate" hash. The "core" hash -contains the same information that is present in the "rate" hash.

    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/collaborators/index.html b/v3/repos/collaborators/index.html deleted file mode 100644 index c080490273..0000000000 --- a/v3/repos/collaborators/index.html +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - Collaborators | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Collaborators

    - - - -

    List collaborators

    - -
    GET /repos/:owner/:repo/collaborators
    -
    - -

    When authenticating as an organization owner of an organization-owned -repository, all organization owners are included in the list of collaborators. -Otherwise, only users with access to the repository are returned in the -collaborators list.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Check if a user is a collaborator

    - -
    GET /repos/:owner/:repo/collaborators/:user
    -
    - -

    Response if user is a collaborator

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if user is not a collaborator

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Add user as a collaborator

    - -
    PUT /repos/:owner/:repo/collaborators/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Remove user as a collaborator

    - -
    DELETE /repos/:owner/:repo/collaborators/:user
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/comments/index.html b/v3/repos/comments/index.html deleted file mode 100644 index 554e340c5d..0000000000 --- a/v3/repos/comments/index.html +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - - - Comments | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Comments

    - - - -

    List commit comments for a repository

    - -

    Commit Comments use these custom media types. You can -read more about the use of media types in the API here.

    - -

    Comments are ordered by ascending ID.

    - -
    GET /repos/:owner/:repo/comments
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/comments/1",
    -    "id": 1,
    -    "body": "Great stuff",
    -    "path": "file1.txt",
    -    "position": 4,
    -    "line": 14,
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z"
    -  }
    -]
    - -

    List comments for a single commit

    - -
    GET /repos/:owner/:repo/commits/:sha/comments
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/comments/1",
    -    "id": 1,
    -    "body": "Great stuff",
    -    "path": "file1.txt",
    -    "position": 4,
    -    "line": 14,
    -    "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "user": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "created_at": "2011-04-14T16:00:49Z",
    -    "updated_at": "2011-04-14T16:00:49Z"
    -  }
    -]
    - -

    Create a commit comment

    - -
    POST /repos/:owner/:repo/commits/:sha/comments
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    shastring -Required. The SHA of the commit to comment on.
    bodystring -Required. The contents of the comment.
    pathstringRelative path of the file to comment on.
    positionnumberLine index in the diff to comment on.
    linenumber -Deprecated. Use position parameter instead. Line number in the file to comment on.
    - -

    Example

    - -
    {
    -  "body": "Nice change",
    -  "path": "file1.txt",
    -  "position": 4,
    -  "line": null
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/user/repo/comments/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/comments/1",
    -  "id": 1,
    -  "body": "Great stuff",
    -  "path": "file1.txt",
    -  "position": 4,
    -  "line": 14,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Get a single commit comment

    - -
    GET /repos/:owner/:repo/comments/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/comments/1",
    -  "id": 1,
    -  "body": "Great stuff",
    -  "path": "file1.txt",
    -  "position": 4,
    -  "line": 14,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Update a commit comment

    - -
    PATCH /repos/:owner/:repo/comments/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bodystring -Required. The contents of the comment
    - -

    Example

    - -
    {
    -  "body": "Nice change"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1",
    -  "url": "https://api.github.com/repos/octocat/Hello-World/comments/1",
    -  "id": 1,
    -  "body": "Great stuff",
    -  "path": "file1.txt",
    -  "position": 4,
    -  "line": 14,
    -  "commit_id": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "user": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "created_at": "2011-04-14T16:00:49Z",
    -  "updated_at": "2011-04-14T16:00:49Z"
    -}
    - -

    Delete a commit comment

    - -
    DELETE /repos/:owner/:repo/comments/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Custom media types

    - -

    These are the supported media types for commit comments. You can read more -about the use of media types in the API here.

    - -
    application/vnd.github-commitcomment.raw+json
    -application/vnd.github-commitcomment.text+json
    -application/vnd.github-commitcomment.html+json
    -application/vnd.github-commitcomment.full+json
    -
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/commits/index.html b/v3/repos/commits/index.html deleted file mode 100644 index d2936015a1..0000000000 --- a/v3/repos/commits/index.html +++ /dev/null @@ -1,636 +0,0 @@ - - - - - - - - Commits | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Commits

    - - - -

    The Repo Commits API supports listing, viewing, and comparing commits in a repository.

    - -

    List commits on a repository

    - -
    GET /repos/:owner/:repo/commits
    -
    - -

    A special note on pagination: Due to the way Git works, commits are paginated -based on SHA instead of page number. Please follow the link headers as outlined -in the pagination overview -instead of constructing page links yourself.

    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    shastringSHA or branch to start listing commits from.
    pathstringOnly commits containing this file path will be returned.
    authorstringGitHub login, name, or email by which to filter by commit author
    sincestringOnly commits after this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    untilstringOnly commits before this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/repositories/417862/commits?top=master&last_sha=4f9890864feb48296917c2fcf3682d8dc3adf16a>; rel="next"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "commit": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "author": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "committer": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "message": "Fix all the bugs",
    -      "tree": {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    },
    -    "author": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "committer": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    ]
    -  }
    -]
    - -

    Get a single commit

    - -
    GET /repos/:owner/:repo/commits/:sha
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -  "commit": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "author": {
    -      "name": "Monalisa Octocat",
    -      "email": "support@github.com",
    -      "date": "2011-04-14T16:00:49Z"
    -    },
    -    "committer": {
    -      "name": "Monalisa Octocat",
    -      "email": "support@github.com",
    -      "date": "2011-04-14T16:00:49Z"
    -    },
    -    "message": "Fix all the bugs",
    -    "tree": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -    }
    -  },
    -  "author": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "committer": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "parents": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -    }
    -  ],
    -  "stats": {
    -    "additions": 104,
    -    "deletions": 4,
    -    "total": 108
    -  },
    -  "files": [
    -    {
    -      "filename": "file1.txt",
    -      "additions": 10,
    -      "deletions": 2,
    -      "changes": 12,
    -      "status": "modified",
    -      "raw_url": "https://github.com/octocat/Hello-World/raw/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt",
    -      "blob_url": "https://github.com/octocat/Hello-World/blob/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt",
    -      "patch": "@@ -29,7 +29,7 @@\n....."
    -    }
    -  ]
    -}
    - -

    Note: Diffs with binary data will have no ‘patch’ property. Pass the -appropriate media type to fetch diff and -patch formats.

    - -

    Compare two commits

    - -
    GET /repos/:owner/:repo/compare/:base...:head
    -
    - -

    Response

    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/compare/master...topic",
    -  "html_url": "https://github.com/octocat/Hello-World/compare/master...topic",
    -  "permalink_url": "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17",
    -  "diff_url": "https://github.com/octocat/Hello-World/compare/master...topic.diff",
    -  "patch_url": "https://github.com/octocat/Hello-World/compare/master...topic.patch",
    -  "base_commit": {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -    "commit": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "author": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "committer": {
    -        "name": "Monalisa Octocat",
    -        "email": "support@github.com",
    -        "date": "2011-04-14T16:00:49Z"
    -      },
    -      "message": "Fix all the bugs",
    -      "tree": {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    },
    -    "author": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "committer": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -      }
    -    ]
    -  },
    -  "status": "behind",
    -  "ahead_by": 1,
    -  "behind_by": 2,
    -  "total_commits": 1,
    -  "commits": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "commit": {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -        "author": {
    -          "name": "Monalisa Octocat",
    -          "email": "support@github.com",
    -          "date": "2011-04-14T16:00:49Z"
    -        },
    -        "committer": {
    -          "name": "Monalisa Octocat",
    -          "email": "support@github.com",
    -          "date": "2011-04-14T16:00:49Z"
    -        },
    -        "message": "Fix all the bugs",
    -        "tree": {
    -          "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -          "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -        }
    -      },
    -      "author": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "committer": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      },
    -      "parents": [
    -        {
    -          "url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -          "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
    -        }
    -      ]
    -    }
    -  ],
    -  "files": [
    -    {
    -      "sha": "bbcd538c8e72b8c175046e27cc8f907076331401",
    -      "filename": "file1.txt",
    -      "status": "added",
    -      "additions": 103,
    -      "deletions": 21,
    -      "changes": 124,
    -      "blob_url": "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    -      "raw_url": "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt",
    -      "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "patch": "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test"
    -    }
    -  ]
    -}
    - -

    Pass the appropriate media type to fetch diff and patch formats.

    - -

    Working with large comparisons

    - -

    The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the Commit List API to enumerate all commits in the range.

    - -

    For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range.

    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/contents/index.html b/v3/repos/contents/index.html deleted file mode 100644 index 1b5a48026e..0000000000 --- a/v3/repos/contents/index.html +++ /dev/null @@ -1,943 +0,0 @@ - - - - - - - - Contents | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Contents

    - - - -

    These API methods let you retrieve the contents of files within a repository as -Base64 encoded content. See media types for requesting raw format.

    - -

    Get the README

    - -

    This method returns the preferred README for a repository.

    - -
    GET /repos/:owner/:repo/readme
    -
    - -

    READMEs support a custom media type for getting the raw content.

    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    refstringThe name of the commit/branch/tag. Default: the repository’s default branch (usually master)
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "type": "file",
    -  "encoding": "base64",
    -  "size": 5362,
    -  "name": "README.md",
    -  "path": "README.md",
    -  "content": "encoded content ...",
    -  "sha": "3d21ec53a331a6f037a91c368710b99387d012c1",
    -  "url": "https://api.github.com/repos/pengwynn/octokit/contents/README.md",
    -  "git_url": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
    -  "html_url": "https://github.com/pengwynn/octokit/blob/master/README.md",
    -  "_links": {
    -    "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
    -    "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md",
    -    "html": "https://github.com/pengwynn/octokit/blob/master/README.md"
    -  }
    -}
    - -

    Get contents

    - -

    This method returns the contents of a file or directory in a repository.

    - -
    GET /repos/:owner/:repo/contents/:path
    -
    - -

    Files and symlinks support a custom media type for getting the raw content. -Directories and submodules do not support custom media types.

    - -

    Notes:

    - -
      -
    • To get a repository’s contents recursively, you can recursively get the tree.
    • -
    • This API supports files up to 1 megabyte in size.
    • -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pathstringThe content path.
    refstringThe name of the commit/branch/tag. Default: the repository’s default branch (usually master)
    - -

    Response if content is a file

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "type": "file",
    -  "encoding": "base64",
    -  "size": 5362,
    -  "name": "README.md",
    -  "path": "README.md",
    -  "content": "encoded content ...",
    -  "sha": "3d21ec53a331a6f037a91c368710b99387d012c1",
    -  "url": "https://api.github.com/repos/pengwynn/octokit/contents/README.md",
    -  "git_url": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
    -  "html_url": "https://github.com/pengwynn/octokit/blob/master/README.md",
    -  "_links": {
    -    "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
    -    "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md",
    -    "html": "https://github.com/pengwynn/octokit/blob/master/README.md"
    -  }
    -}
    - -

    Response if content is a directory

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "type": "file",
    -    "size": 625,
    -    "name": "octokit.rb",
    -    "path": "lib/octokit.rb",
    -    "sha": "fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
    -    "url": "https://api.github.com/repos/pengwynn/octokit/contents/lib/octokit.rb",
    -    "git_url": "https://api.github.com/repos/pengwynn/octokit/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
    -    "html_url": "https://github.com/pengwynn/octokit/blob/master/lib/octokit.rb",
    -    "_links": {
    -      "self": "https://api.github.com/repos/pengwynn/octokit/contents/lib/octokit.rb",
    -      "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/fff6fe3a23bf1c8ea0692b4a883af99bee26fd3b",
    -      "html": "https://github.com/pengwynn/octokit/blob/master/lib/octokit.rb"
    -    }
    -  },
    -  {
    -    "type": "dir",
    -    "size": 0,
    -    "name": "octokit",
    -    "path": "lib/octokit",
    -    "sha": "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
    -    "url": "https://api.github.com/repos/pengwynn/octokit/contents/lib/octokit",
    -    "git_url": "https://api.github.com/repos/pengwynn/octokit/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
    -    "html_url": "https://github.com/pengwynn/octokit/tree/master/lib/octokit",
    -    "_links": {
    -      "self": "https://api.github.com/repos/pengwynn/octokit/contents/lib/octokit",
    -      "git": "https://api.github.com/repos/pengwynn/octokit/git/trees/a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d",
    -      "html": "https://github.com/pengwynn/octokit/tree/master/lib/octokit"
    -    }
    -  }
    -]
    - -

    Note: When listing the contents of a directory, submodules have their “type” -specified as “file”. Logically, the value should be “submodule”. This behavior -exists in API v3 for backwards compatibility purposes. -In the next major version of the API, the type will be returned as “submodule”.

    - - - -

    If the requested :path points to a symlink, and the symlink’s target is a normal file in the repository, then the API responds with the content of the file (in the format shown above).

    - -

    Otherwise, the API responds with a hash describing the symlink itself:

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "type": "symlink",
    -  "target": "/path/to/symlink/target",
    -  "size": 23,
    -  "name": "some-symlink",
    -  "path": "bin/some-symlink",
    -  "sha": "452a98979c88e093d682cab404a3ec82babebb48",
    -  "url": "https://api.github.com/repos/pengwynn/octokit/contents/bin/some-symlink",
    -  "git_url": "https://api.github.com/repos/pengwynn/octokit/git/blobs/452a98979c88e093d682cab404a3ec82babebb48",
    -  "html_url": "https://github.com/pengwynn/octokit/blob/master/bin/some-symlink",
    -  "_links": {
    -    "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/452a98979c88e093d682cab404a3ec82babebb48",
    -    "self": "https://api.github.com/repos/pengwynn/octokit/contents/bin/some-symlink",
    -    "html": "https://github.com/pengwynn/octokit/blob/master/bin/some-symlink"
    -  }
    -}
    - -

    Response if content is a submodule

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "type": "submodule",
    -  "submodule_git_url": "git://github.com/jquery/qunit.git",
    -  "size": 0,
    -  "name": "qunit",
    -  "path": "test/qunit",
    -  "sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
    -  "url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
    -  "git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
    -  "html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
    -  "_links": {
    -    "git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
    -    "self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
    -    "html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
    -  }
    -}
    - -

    The submodule_git_url identifies the location of the submodule repository, and the sha identifies a specific commit within the submodule repository. -Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit.

    - -

    If the submodule repository is not hosted on github.com, the Git URLs (git_url and _links["git"]) and the github.com URLs (html_url and _links["html"]) will have null values.

    - -

    Create a file

    - -

    This method creates a new file in a repository

    - -
    PUT /repos/:owner/:repo/contents/:path
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pathstring -Required. The content path.
    messagestring -Required. The commit message.
    contentstring -Required. The new file content, Base64 encoded.
    branchstringThe branch name. Default: the repository’s default branch (usually master)
    - -

    Optional Parameters

    - -

    You can provide an additional commiter parameter, which is a hash containing -information about the committer. Or, you can provide an author parameter, which -is a hash containing information about the author.

    - -

    The author section is optional and is filled in with the committer -information if omitted. If the committer information is omitted, the authenticated -user’s information is used.

    - -

    You must provide values for both name and email, whether you choose to use -author or committer. Otherwise, you’ll receive a 500 status code.

    - -

    Both the author and commiter parameters have the same keys:

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe name of the author (or commiter) of the commit
    emailstringThe email of the author (or commiter) of the commit
    - -

    Example Input

    - -
    {
    -  "message": "my commit message",
    -  "committer": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "content": "bXkgbmV3IGZpbGUgY29udGVudHM="
    -}
    - -

    Response

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "content": {
    -    "name": "hello.txt",
    -    "path": "notes/hello.txt",
    -    "sha": "95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -    "size": 9,
    -    "url": "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt",
    -    "html_url": "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt",
    -    "git_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -    "type": "file",
    -    "_links": {
    -      "self": "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt",
    -      "git": "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -      "html": "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt"
    -    }
    -  },
    -  "commit": {
    -    "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "html_url": "https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "author": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "committer": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "message": "my commit message",
    -    "tree": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
    -      "sha": "691272480426f78a0138979dd3ce63b77f706feb"
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "html_url": "https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5"
    -      }
    -    ]
    -  }
    -}
    - -

    Update a file

    - -

    This method updates a file in a repository

    - -
    PUT /repos/:owner/:repo/contents/:path
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pathstring -Required. The content path.
    messagestring -Required. The commit message.
    contentstring -Required. The updated file content, Base64 encoded.
    shastring -Required. The blob SHA of the file being replaced.
    branchstringThe branch name. Default: the repository’s default branch (usually master)
    - -

    Optional Parameters

    - -

    You can provide an additional commiter parameter, which is a hash containing -information about the committer. Or, you can provide an author parameter, which -is a hash containing information about the author.

    - -

    The author section is optional and is filled in with the committer -information if omitted. If the committer information is omitted, the authenticated -user’s information is used.

    - -

    You must provide values for both name and email, whether you choose to use -author or committer. Otherwise, you’ll receive a 500 status code.

    - -

    Both the author and commiter parameters have the same keys:

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe name of the author (or commiter) of the commit
    emailstringThe email of the author (or commiter) of the commit
    - -

    Example Input

    - -
    {
    -  "message": "my commit message",
    -  "committer": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "content": "bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz",
    -  "sha": "329688480d39049927147c162b9d2deaf885005f"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "content": {
    -    "name": "hello.txt",
    -    "path": "notes/hello.txt",
    -    "sha": "95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -    "size": 9,
    -    "url": "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt",
    -    "html_url": "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt",
    -    "git_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -    "type": "file",
    -    "_links": {
    -      "self": "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt",
    -      "git": "https://api.github.com/repos/octocat/Hello-World/git/blobs/95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
    -      "html": "https://github.com/octocat/Hello-World/blob/master/notes/hello.txt"
    -    }
    -  },
    -  "commit": {
    -    "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "html_url": "https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "author": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "committer": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "message": "my commit message",
    -    "tree": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
    -      "sha": "691272480426f78a0138979dd3ce63b77f706feb"
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "html_url": "https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5"
    -      }
    -    ]
    -  }
    -}
    - -

    Delete a file

    - -

    This method deletes a file in a repository

    - -
    DELETE /repos/:owner/:repo/contents/:path
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pathstring -Required. The content path.
    messagestring -Required. The commit message.
    shastring -Required. The blob SHA of the file being replaced.
    branchstringThe branch name. Default: the repository’s default branch (usually master)
    - -

    Optional Parameters

    - -

    You can provide an additional commiter parameter, which is a hash containing -information about the committer. Or, you can provide an author parameter, which -is a hash containing information about the author.

    - -

    The author section is optional and is filled in with the committer -information if omitted. If the committer information is omitted, the authenticated -user’s information is used.

    - -

    You must provide values for both name and email, whether you choose to use -author or committer. Otherwise, you’ll receive a 500 status code.

    - -

    Both the author and commiter parameters have the same keys:

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe name of the author (or commiter) of the commit
    emailstringThe email of the author (or commiter) of the commit
    - -

    Example Input

    - -
    {
    -  "message": "my commit message",
    -  "committer": {
    -    "name": "Scott Chacon",
    -    "email": "schacon@gmail.com"
    -  },
    -  "sha": "329688480d39049927147c162b9d2deaf885005f"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "content": null,
    -  "commit": {
    -    "sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "html_url": "https://github.com/octocat/Hello-World/git/commit/7638417db6d59f3c431d3e1f261cc637155684cd",
    -    "author": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "committer": {
    -      "date": "2010-04-10T14:10:01-07:00",
    -      "name": "Scott Chacon",
    -      "email": "schacon@gmail.com"
    -    },
    -    "message": "my commit message",
    -    "tree": {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/691272480426f78a0138979dd3ce63b77f706feb",
    -      "sha": "691272480426f78a0138979dd3ce63b77f706feb"
    -    },
    -    "parents": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "html_url": "https://github.com/octocat/Hello-World/git/commit/1acc419d4d6a9ce985db7be48c6349a0475975b5",
    -        "sha": "1acc419d4d6a9ce985db7be48c6349a0475975b5"
    -      }
    -    ]
    -  }
    -}
    - - - -

    This method will return a 302 to a URL to download a tarball -or zipball archive for a repository. Please make sure your HTTP framework -is configured to follow redirects or you will need to use the Location header -to make a second GET request.

    - -

    Note: For private repositories, these links are temporary and expire quickly.

    - -
    GET /repos/:owner/:repo/:archive_format/:ref
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    archive_formatstringCan be either tarball or zipball. Default: tarball -
    refstringA valid Git reference. Default: the repository’s default branch (usually master)
    - -

    Response

    - -
    Status: 302 Found
    -Location: https://codeload.github.com/me/myprivate/legacy.zip/master?login=me&token=thistokenexpires
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    To follow redirects with curl, use the -L switch:

    - -
    -curl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz
    -
    -  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    -                                 Dload  Upload   Total   Spent    Left  Speed
    -100  206k  100  206k    0     0   146k      0  0:00:01  0:00:01 --:--:--  790k
    -
    - -

    Custom media types

    - -

    READMEs, files, and symlinks support the following custom media type.

    - -
    application/vnd.github.VERSION.raw
    -
    - -

    You can read more about the use of media types in the API here.

    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/deployments/index.html b/v3/repos/deployments/index.html deleted file mode 100644 index 304b7fc7c7..0000000000 --- a/v3/repos/deployments/index.html +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - - - Deployments | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Deployments

    - - - -
    -

    - The Deployments API is currently available for developers to preview. - During the preview period, the API may change without advance notice. - Please see the blog post for full details. -

    - -

    - To access the API during the preview period, you must provide a custom media type in the Accept header: -

    -
    application/vnd.github.cannonball-preview+json
    - -
    - -

    Deployments are a request for a specific ref(branch,sha,tag) to be deployed. -GitHub then dispatches deployment events that external services can listen for -and act on. This enables developers and organizations to build loosely-coupled -tooling around deployments, without having to worry about implementation -details of delivering different types of applications (e.g., web, native).

    - -

    Deployment Statuses allow external services to mark deployments with a -‘success’, ‘failure’, ‘error’, or ‘pending’ state, which can then be consumed -by any system listening for deployment_status events.

    - -

    Deployment Statuses can also include an optional description and target_url, and -we highly recommend providing them as they make deployment statuses much more -useful. The target_url would be the full URL to the deployment output, and -the description would be the high level summary of what happened with the -deployment.

    - -

    Deployments and Deployment Statuses both have associated repository events when -they’re created. This allows web hooks and 3rd party integrations to respond to -deployment requests as well as update the status of a deployment as progress is -made.

    - -

    Below is a simple sequence diagram for how these interactions would work.

    - -
    -+---------+             +--------+            +-----------+        +-------------+
    -| Tooling |             | GitHub |            | 3rd Party |        | Your Server |
    -+---------+             +--------+            +-----------+        +-------------+
    -     |                      |                       |                     |
    -     |  Create Deployment   |                       |                     |
    -     |--------------------->|                       |                     |
    -     |                      |                       |                     |
    -     |  Deployment Created  |                       |                     |
    -     |<---------------------|                       |                     |
    -     |                      |                       |                     |
    -     |                      |   Deployment Event    |                     |
    -     |                      |---------------------->|                     |
    -     |                      |                       |     SSH+Deploys     |
    -     |                      |                       |-------------------->|
    -     |                      |                       |                     |
    -     |                      |   Deployment Status   |                     |
    -     |                      |<----------------------|                     |
    -     |                      |                       |                     |
    -     |                      |                       |   Deploy Completed  |
    -     |                      |                       |<--------------------|
    -     |                      |                       |                     |
    -     |                      |   Deployment Status   |                     |
    -     |                      |<----------------------|                     |
    -     |                      |                       |                     |
    -
    - -

    Keep in mind that GitHub is never actually accessing your servers. It’s up to -your 3rd party integration to interact with deployment events. -This allows for github-services -integrations as well as running your own systems depending on your use case. -Multiple systems can listen for deployment events, and it’s up to each of -those systems to decide whether or not they’re responsible for pushing the code -out to your servers, building native code, etc.

    - -

    Note that the repo:deployment OAuth scope grants -targeted access to Deployments and Deployment Statuses without -granting access to repository code, while the repo scope grants permission to code -as well.

    - -

    List Deployments

    - -

    Users with pull access can view deployments for a repository:

    - -
    GET /repos/:owner/:repo/deployments
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "sha": "topic-branch",
    -    "url": "https://api.github.com/repos/octocat/example/deployments/1",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "payload": "{\"environment\":\"production\"}",
    -    "created_at": "2012-07-20T01:19:13Z",
    -    "updated_at": "2012-07-20T01:19:13Z",
    -    "description": "Deploy request from hubot",
    -    "statuses_url": "https://api.github.com/repos/octocat/example/deployments/1/statuses"
    -  }
    -]
    - -

    Create a Deployment

    - -

    If your repository is taking advantage of commit statuses, -the API will reject requests that do not have a success status. (Your repository -is not required to use commit statuses. If no commit statuses are present, the -deployment will always be created.)

    - -

    The force parameter can be used when you really just need a deployment to go -out. In these cases, all checks are bypassed, and the deployment is created for -the ref.

    - -

    The auto_merge parameter is used to ensure that the requested ref is not -behind the repository’s default branch. If the ref is behind the default -branch for the repository, we will attempt to merge it for you. If the merge -succeeds, the API will return a successful merge commit. If merge conflicts -prevent the merge from succeeding, the API will return a failure response.

    - -

    The payload parameter is available for any extra information that a -deployment system might need. It is a JSON text field that will be passed on -when a deployment event is dispatched.

    - -

    Users with push access can create a deployment for a given ref:

    - -
    POST /repos/:owner/:repo/deployments
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    refstring -Required. The ref to deploy. This can be a branch, tag, or sha.
    forcebooleanOptional parameter to bypass any ahead/behind checks or commit status checks. Default: false -
    payloadstringOptional JSON payload with extra information about the deployment. Default: "" -
    auto_mergebooleanOptional parameter to merge the default branch into the requested deployment branch if necessary. Default: false -
    descriptionstringOptional short description. Default: "" -
    - -

    Example

    - -
    {
    -  "ref": "topic-branch",
    -  "payload": "{\"environment\":\"production\",\"deploy_user\":\"atmos\",\"room_id\":123456}",
    -  "description": "Deploying my sweet branch"
    -}
    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/octocat/example/deployments/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "sha": "topic-branch",
    -  "url": "https://api.github.com/repos/octocat/example/deployments/1",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "payload": "{\"environment\":\"production\"}",
    -  "created_at": "2012-07-20T01:19:13Z",
    -  "updated_at": "2012-07-20T01:19:13Z",
    -  "description": "Deploy request from hubot",
    -  "statuses_url": "https://api.github.com/repos/octocat/example/deployments/1/statuses"
    -}
    - -

    Update a Deployment

    - -

    Once a deployment is created, it cannot be updated. Information relating to the -success or failure of a deployment is handled through Deployment Statuses.

    - -

    Deployment Statuses

    - -

    List Deployment Statuses

    - -

    Users with pull access can view deployment statuses for a deployment:

    - -
    GET /repos/:owner/:repo/deployments/:id/statuses
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    idinteger -Required. The Deployment ID to list the statuses from.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "url": "https://api.github.com/repos/octocat/example/deployments/1/statuses/42",
    -    "state": "success",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "payload": "{\"environment\":\"production\"}",
    -    "target_url": "https://gist.github.com/628b2736d379f",
    -    "created_at": "2012-07-20T01:19:13Z",
    -    "updated_at": "2012-07-20T01:19:13Z",
    -    "description": "Deploy request from hubot"
    -  }
    -]
    - -

    Create a Deployment Status

    - -

    Users with push access can create deployment statuses for a given deployment:

    - -
    POST /repos/:owner/:repo/deployments/:id/statuses
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    statestring -Required. The state of the status. Can be one of pending, success, error, or failure.
    target_urlstringThe target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Default: "" -
    descriptionstringA short description of the status. Default: "" -
    - -

    Example

    - -
    {
    -  "state": "success",
    -  "target_url": "https://example.com/deployment/42/output",
    -  "description": "Deployment finished successfully."
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/octocat/example/deployments/42/statuses/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/example/deployments/1/statuses/42",
    -  "state": "success",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "payload": "{\"environment\":\"production\"}",
    -  "target_url": "https://gist.github.com/628b2736d379f",
    -  "created_at": "2012-07-20T01:19:13Z",
    -  "updated_at": "2012-07-20T01:19:13Z",
    -  "description": "Deploy request from hubot"
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/downloads/index.html b/v3/repos/downloads/index.html deleted file mode 100644 index 1931866f9e..0000000000 --- a/v3/repos/downloads/index.html +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - Downloads | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Downloads

    - - - -

    Downloads API is Deprecated

    - -
    -

    - The Downloads API (described below) was - deprecated on December 11, 2012. - It will be removed at a future date. - - We recommend using Releases instead. -

    -
    - -

    The downloads API is for package downloads only. If you want to get -source tarballs you should use this -instead.

    - -

    List downloads for a repository

    - -
    GET /repos/:owner/:repo/downloads
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/downloads/1",
    -    "html_url": "https://github.com/repos/octocat/Hello-World/downloads/new_file.jpg",
    -    "id": 1,
    -    "name": "new_file.jpg",
    -    "description": "Description of your download",
    -    "size": 1024,
    -    "download_count": 40,
    -    "content_type": ".jpg"
    -  }
    -]
    - -

    Get a single download

    - -
    GET /repos/:owner/:repo/downloads/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/downloads/1",
    -  "html_url": "https://github.com/repos/octocat/Hello-World/downloads/new_file.jpg",
    -  "id": 1,
    -  "name": "new_file.jpg",
    -  "description": "Description of your download",
    -  "size": 1024,
    -  "download_count": 40,
    -  "content_type": ".jpg"
    -}
    - -

    Delete a download

    - -
    DELETE /repos/:owner/:repo/downloads/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/forks/index.html b/v3/repos/forks/index.html deleted file mode 100644 index 5535a7cdeb..0000000000 --- a/v3/repos/forks/index.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - - Forks | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Forks

    - - - -

    List forks

    - -
    GET /repos/:owner/:repo/forks
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sortstringThe sort order. Can be either newest, oldest, or stargazers. Default: newest -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  }
    -]
    - -

    Create a fork

    - -

    Create a fork for the authenticated user.

    - -
    POST /repos/:owner/:repo/forks
    -
    - -

    One can either use the organization parameter or POST a JSON document with -the field organization

    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    organizationstringThe organization login. The repository will be forked into this organization.
    - -

    Response

    - -

    Forking a Repository happens asynchronously. Therefore, you may have to wait -a short period before accessing the git objects. If this takes longer than -5 minutes, be sure to contact Support.

    - -
    Status: 202 Accepted
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1296269,
    -  "owner": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "name": "Hello-World",
    -  "full_name": "octocat/Hello-World",
    -  "description": "This your first repo!",
    -  "private": false,
    -  "fork": true,
    -  "url": "https://api.github.com/repos/octocat/Hello-World",
    -  "html_url": "https://github.com/octocat/Hello-World",
    -  "clone_url": "https://github.com/octocat/Hello-World.git",
    -  "git_url": "git://github.com/octocat/Hello-World.git",
    -  "ssh_url": "git@github.com:octocat/Hello-World.git",
    -  "svn_url": "https://svn.github.com/octocat/Hello-World",
    -  "mirror_url": "git://git.example.com/octocat/Hello-World",
    -  "homepage": "https://github.com",
    -  "language": null,
    -  "forks_count": 9,
    -  "stargazers_count": 80,
    -  "watchers_count": 80,
    -  "size": 108,
    -  "default_branch": "master",
    -  "master_branch": "master",
    -  "open_issues_count": 0,
    -  "pushed_at": "2011-01-26T19:06:43Z",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:14:43Z"
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/hooks/index.html b/v3/repos/hooks/index.html deleted file mode 100644 index a32b1aeede..0000000000 --- a/v3/repos/hooks/index.html +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - - Hooks | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Hooks

    - - - -

    The Repository Hooks API allows repository admins to manage the post-receive -hooks for a repository. Hooks can be managed using the JSON HTTP API -and the PubSubHubbub API.

    - -

    Each hook can be configured for a specific service and one or -more events, regardless of the API used to do so.

    - -

    Services

    - -

    A service is basically the name used to refer to a hook that has configuration -settings, a list of available events, and default events.

    - -
    -

    For instance, the -email -service is a built-in GitHub service that will send event payloads -to, at most, two email addresses. It will trigger for the push -event by default and supports the public event type as well.

    -
    - -

    A number of services have been integrated through the open source -github-services project. When -creating a hook, the :name parameter must refer to one of -these services. A generic -Web -service is available that can configured to trigger for any of the available -events.

    - -

    Documentation for all available service hooks can be found in the -docs directory -of the github-services repository. A JSON representation of their names, -default events, supported events, and configuration options can be seen -at api.github.com/hooks.

    - -

    Events

    - -

    Active hooks can be configured to trigger for one or more service supported -events. In other words, the service must support listening for the event you -want to trigger.

    - -

    For example, the -Web -service listens for all events, while the -IRC -service can only listen for push, issues, and pull_request events.

    - -

    The available events are:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    pushAny git push to a Repository. This is the default event. -
    issuesAny time an Issue is opened or closed.
    issue_commentAny time an Issue is commented on.
    commit_commentAny time a Commit is commented on.
    createAny time a Repository, Branch, or Tag is created.
    deleteAny time a Branch or Tag is deleted.
    pull_requestAny time a Pull Request is opened, closed, or synchronized (updated due to a new push in the branch that the pull request is tracking).
    pull_request_review_commentAny time a Commit is commented on while inside a Pull Request review (the Files Changed tab).
    gollumAny time a Wiki page is updated.
    watchAny time a User watches the Repository.
    releaseAny time a Release is published in the Repository.
    forkAny time a Repository is forked.
    memberAny time a User is added as a collaborator to a non-Organization Repository.
    publicAny time a Repository changes from private to public.
    team_addAny time a team is added or modified on a Repository.
    statusAny time a Repository has a status update from the API
    deploymentAny time a Repository has a new deployment created from the API.
    deployment_statusAny time a deployment for the Repository has a status update from the API.
    - -

    Payloads

    - -

    The payloads for all hooks mirror the payloads for the Event -types, with the exception of the original push -event, -which has a more detailed payload.

    - -

    JSON HTTP

    - -

    The JSON HTTP API follows the same conventions as the rest of the -GitHub API.

    - -

    List

    - -
    GET /repos/:owner/:repo/hooks
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
    -    "updated_at": "2011-09-06T20:39:23Z",
    -    "created_at": "2011-09-06T17:26:27Z",
    -    "name": "web",
    -    "events": [
    -      "push",
    -      "pull_request"
    -    ],
    -    "active": true,
    -    "config": {
    -      "url": "http://example.com",
    -      "content_type": "json"
    -    },
    -    "id": 1
    -  }
    -]
    - -

    Get single hook

    - -
    GET /repos/:owner/:repo/hooks/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z",
    -  "name": "web",
    -  "events": [
    -    "push",
    -    "pull_request"
    -  ],
    -  "active": true,
    -  "config": {
    -    "url": "http://example.com",
    -    "content_type": "json"
    -  },
    -  "id": 1
    -}
    - -

    Create a hook

    - -
    POST /repos/:owner/:repo/hooks
    -
    - -

    Parameter

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the service that is being called. (See /hooks for the list of valid hook names.)
    confighash -Required. Key/value pairs to provide settings for this hook. These settings vary between the services and are defined in the github-services repository. Booleans are stored internally as “1” for true, and “0” for false. Any JSON true/false values will be converted automatically.
    eventsarrayDetermines what events the hook is triggered for. Default: ["push"] -
    activebooleanDetermines whether the hook is actually triggered on pushes.
    - -
    Example
    - -

    The “web” service hook -takes these fields in the config:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    urlstring -Required. The URL to which the payloads will be delivered.
    content_typestringThe media type used to serialize the payloads. Supported values: json and form. Default: form.
    secretstringIf defined, then HTTP requests that deliver the payloads will include an X-Hub-Signature header. The value of this header is computed as the HMAC hex digest of the body, using the secret as the key.
    insecure_sslstringDetermines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values: "0" (verification is performed) and "1" (verification is not performed). Default: "0".
    - -

    Here’s how you can setup a hook that posts payloads in JSON format:

    - -
    {
    -  "name": "web",
    -  "active": true,
    -  "events": [
    -    "push",
    -    "pull_request"
    -  ],
    -  "config": {
    -    "url": "http://example.com/webhook",
    -    "content_type": "json"
    -  }
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/user/repo/hooks/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z",
    -  "name": "web",
    -  "events": [
    -    "push",
    -    "pull_request"
    -  ],
    -  "active": true,
    -  "config": {
    -    "url": "http://example.com",
    -    "content_type": "json"
    -  },
    -  "id": 1
    -}
    - -

    Edit a hook

    - -
    PATCH /repos/:owner/:repo/hooks/:id
    -
    - -

    Parameter

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    confighashKey/value pairs to provide settings for this hook. Modifying this will replace the entire config object. These settings vary between the services and are defined in the github-services repository. Booleans are stored internally as “1” for true, and “0” for false. Any JSON true/false values will be converted automatically.
    eventsarrayDetermines what events the hook is triggered for. This replaces the entire array of events. Default: ["push"] -
    add_eventsarrayDetermines a list of events to be added to the list of events that the Hook triggers for.
    remove_eventsarrayDetermines a list of events to be removed from the list of events that the Hook triggers for.
    activebooleanDetermines whether the hook is actually triggered on pushes.
    - -
    Example
    - -
    {
    -  "active": true,
    -  "add_events": [
    -    "pull_request"
    -  ]
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1",
    -  "updated_at": "2011-09-06T20:39:23Z",
    -  "created_at": "2011-09-06T17:26:27Z",
    -  "name": "web",
    -  "events": [
    -    "push",
    -    "pull_request"
    -  ],
    -  "active": true,
    -  "config": {
    -    "url": "http://example.com",
    -    "content_type": "json"
    -  },
    -  "id": 1
    -}
    - -

    Test a push hook

    - -

    This will trigger the hook with the latest push to the current -repository if the hook is subscribed to push events. If the -hook is not subscribed to push events, the server will respond -with 204 but no test POST will be generated.

    - -
    POST /repos/:owner/:repo/hooks/:id/tests
    -
    - -

    Note: Previously /repos/:owner/:repo/hooks/:id/test

    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Delete a hook

    - -
    DELETE /repos/:owner/:repo/hooks/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    PubSubHubbub

    - -

    GitHub can also serve as a PubSubHubbub hub for all repositories. -PSHB is a simple publish/subscribe protocol -that lets servers register to receive updates when a topic is updated. -The updates are sent with an HTTP POST request to a callback URL. -Topic URLs for a GitHub repository’s pushes are in this format:

    - -
    https://github.com/:owner/:repo/events/:event
    -
    - -

    The event can be any event string that is listed at the top of this -document.

    - -

    Response format

    - -

    The default format is what existing post-receive hooks should -expect: A JSON body sent as the payload parameter in a -POST. You can also specify to receive the raw JSON body with either an -Accept header, or a .json extension.

    - -
    Accept: application/json
    -https://github.com/:owner/:repo/events/push.json
    -
    - -

    Callback URLs

    - -

    Callback URLs can use either the http:// protocol, or github://. -github:// callbacks specify a GitHub service.

    - -
    # Send updates to postbin.org
    -http://postbin.org/123
    -
    -# Send updates to Campfire
    -github://campfire?subdomain=github&room=Commits&token=abc123
    -
    - -

    Subscribing

    - -

    The GitHub PubSubHubbub endpoint is: https://api.github.com/hub. -(GitHub Enterprise users should use http://yourhost/api/v3/hub as the -PubSubHubbub endpoint, but not change the hub.topic URI format.) A -successful request with curl looks like:

    - -
    curl -u "user" -i \
    -  https://api.github.com/hub \
    -  -F "hub.mode=subscribe" \
    -  -F "hub.topic=https://github.com/:owner/:repo/events/push" \
    -  -F "hub.callback=http://postbin.org/123"
    -
    - -

    PubSubHubbub requests can be sent multiple times. If the hook already -exists, it will be modified according to the request.

    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    hub.modestring -Required. Either subscribe or unsubscribe.
    hub.topicstring -Required. The URI of the GitHub repository to subscribe to. The path must be in the format of /:owner/:repo/events/:event.
    hub.callbackstringThe URI to receive the updates to the topic.
    hub.secretstringA shared secret key that generates a SHA1 HMAC of the outgoing body content. You can verify a push came from GitHub by comparing the raw request body with the contents of the X-Hub-Signature header. You can see our Ruby implementation, or the PubSubHubbub documentation for more details.
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/index.html b/v3/repos/index.html deleted file mode 100644 index af03db59da..0000000000 --- a/v3/repos/index.html +++ /dev/null @@ -1,1280 +0,0 @@ - - - - - - - - Repositories | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Repositories

    - - - -

    List your repositories

    - -

    List repositories for the authenticated user. Note that this does not include -repositories owned by organizations which the user can access. You can -list user organizations and -list organization repositories -separately.

    - -
    GET /user/repos
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    typestringCan be one of all, owner, public, private, member. Default: all -
    sortstringCan be one of created, updated, pushed, full_name. Default: full_name -
    directionstringCan be one of asc or desc. Default: when using full_name: asc; otherwise desc -
    - -

    List user repositories

    - -

    List public repositories for the specified user.

    - -
    GET /users/:user/repos
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    typestringCan be one of all, owner, member. Default: owner -
    sortstringCan be one of created, updated, pushed, full_name. Default: full_name -
    directionstringCan be one of asc or desc. Default: when using full_name: asc, otherwise desc -
    - -

    List organization repositories

    - -

    List repositories for the specified org.

    - -
    GET /orgs/:org/repos
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    typestringCan be one of all, public, private, forks, sources, member. Default: all -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  }
    -]
    - -
    -

    - Note: When using the v3 media type, the response omits the master_branch attribute. API clients should instead use the default_branch attribute to obtain the repository's default branch. -

    -
    - -

    List all public repositories

    - -

    This provides a dump of every public repository, in the order that they were created.

    - -

    Note: Pagination is powered exclusively by the since parameter. -Use the Link header to get the URL for the next page of -repositories.

    - -
    GET /repositories
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sincestringThe integer ID of the last Repository that you’ve seen.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/repositories?since=364>; rel="next"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": false,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World"
    -  }
    -]
    - -

    Create

    - -

    Create a new repository for the authenticated user. OAuth users must supply -repo scope.

    - -
    POST /user/repos
    -
    - -

    Create a new repository in this organization. The authenticated user must -be a member of the specified organization.

    - -
    POST /orgs/:org/repos
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the repository
    descriptionstringA short description of the repository
    homepagestringA URL with more information about the repository
    privatebooleanEither true to create a private repository, or false to create a public one. Creating private repositories requires a paid GitHub account. Default: false -
    has_issuesbooleanEither true to enable issues for this repository, false to disable them. Default: true -
    has_wikibooleanEither true to enable the wiki for this repository, false to disable it. Default: true -
    has_downloadsbooleanEither true to enable downloads for this repository, false to disable them. Default: true -
    team_idnumberThe id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
    auto_initbooleanPass true to create an initial commit with empty README. Default: false -
    gitignore_templatestringDesired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, “Haskell”. Ignored if the auto_init parameter is not provided. -
    - -

    Example

    - -
    {
    -  "name": "Hello-World",
    -  "description": "This is your first repository",
    -  "homepage": "https://github.com",
    -  "private": false,
    -  "has_issues": true,
    -  "has_wiki": true,
    -  "has_downloads": true
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/octocat/Hello-World
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1296269,
    -  "owner": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "name": "Hello-World",
    -  "full_name": "octocat/Hello-World",
    -  "description": "This your first repo!",
    -  "private": false,
    -  "fork": true,
    -  "url": "https://api.github.com/repos/octocat/Hello-World",
    -  "html_url": "https://github.com/octocat/Hello-World",
    -  "clone_url": "https://github.com/octocat/Hello-World.git",
    -  "git_url": "git://github.com/octocat/Hello-World.git",
    -  "ssh_url": "git@github.com:octocat/Hello-World.git",
    -  "svn_url": "https://svn.github.com/octocat/Hello-World",
    -  "mirror_url": "git://git.example.com/octocat/Hello-World",
    -  "homepage": "https://github.com",
    -  "language": null,
    -  "forks_count": 9,
    -  "stargazers_count": 80,
    -  "watchers_count": 80,
    -  "size": 108,
    -  "default_branch": "master",
    -  "master_branch": "master",
    -  "open_issues_count": 0,
    -  "pushed_at": "2011-01-26T19:06:43Z",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:14:43Z"
    -}
    - -

    Get

    - -
    GET /repos/:owner/:repo
    -
    - -

    Response

    - -

    The parent and source objects are present when the repository is a fork. -parent is the repository this repository was forked from, -source is the ultimate source for the network.

    - -
    -

    - Note: When using the v3 media type, the response omits the master_branch attribute. API clients should instead use the default_branch attribute to obtain the repository's default branch. -

    -
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1296269,
    -  "owner": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "name": "Hello-World",
    -  "full_name": "octocat/Hello-World",
    -  "description": "This your first repo!",
    -  "private": false,
    -  "fork": false,
    -  "url": "https://api.github.com/repos/octocat/Hello-World",
    -  "html_url": "https://github.com/octocat/Hello-World",
    -  "clone_url": "https://github.com/octocat/Hello-World.git",
    -  "git_url": "git://github.com/octocat/Hello-World.git",
    -  "ssh_url": "git@github.com:octocat/Hello-World.git",
    -  "svn_url": "https://svn.github.com/octocat/Hello-World",
    -  "mirror_url": "git://git.example.com/octocat/Hello-World",
    -  "homepage": "https://github.com",
    -  "language": null,
    -  "forks_count": 9,
    -  "stargazers_count": 80,
    -  "watchers_count": 80,
    -  "size": 108,
    -  "default_branch": "master",
    -  "master_branch": "master",
    -  "open_issues_count": 0,
    -  "pushed_at": "2011-01-26T19:06:43Z",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:14:43Z",
    -  "subscribers_count": 42,
    -  "organization": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "Organization",
    -    "site_admin": false
    -  },
    -  "parent": {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  },
    -  "source": {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  },
    -  "has_issues": true,
    -  "has_wiki": true,
    -  "has_downloads": true
    -}
    - -

    Edit

    - -
    PATCH /repos/:owner/:repo
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The name of the repository
    descriptionstringA short description of the repository
    homepagestringA URL with more information about the repository
    privatebooleanEither true to make the repository private, or false to make it public. Creating private repositories requires a paid GitHub account. Default: false -
    has_issuesbooleanEither true to enable issues for this repository, false to disable them. Default: true -
    has_wikibooleanEither true to enable the wiki for this repository, false to disable it. Default: true -
    has_downloadsbooleanEither true to enable downloads for this repository, false to disable them. Default: true -
    default_branchStringUpdates the default branch for this repository.
    - -

    Example

    - -
    {
    -  "name": "Hello-World",
    -  "description": "This is your first repository",
    -  "homepage": "https://github.com",
    -  "private": true,
    -  "has_issues": true,
    -  "has_wiki": true,
    -  "has_downloads": true
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1296269,
    -  "owner": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "name": "Hello-World",
    -  "full_name": "octocat/Hello-World",
    -  "description": "This your first repo!",
    -  "private": false,
    -  "fork": false,
    -  "url": "https://api.github.com/repos/octocat/Hello-World",
    -  "html_url": "https://github.com/octocat/Hello-World",
    -  "clone_url": "https://github.com/octocat/Hello-World.git",
    -  "git_url": "git://github.com/octocat/Hello-World.git",
    -  "ssh_url": "git@github.com:octocat/Hello-World.git",
    -  "svn_url": "https://svn.github.com/octocat/Hello-World",
    -  "mirror_url": "git://git.example.com/octocat/Hello-World",
    -  "homepage": "https://github.com",
    -  "language": null,
    -  "forks_count": 9,
    -  "stargazers_count": 80,
    -  "watchers_count": 80,
    -  "size": 108,
    -  "default_branch": "master",
    -  "master_branch": "master",
    -  "open_issues_count": 0,
    -  "pushed_at": "2011-01-26T19:06:43Z",
    -  "created_at": "2011-01-26T19:01:12Z",
    -  "updated_at": "2011-01-26T19:14:43Z",
    -  "subscribers_count": 42,
    -  "organization": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "Organization",
    -    "site_admin": false
    -  },
    -  "parent": {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  },
    -  "source": {
    -    "id": 1296269,
    -    "owner": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "name": "Hello-World",
    -    "full_name": "octocat/Hello-World",
    -    "description": "This your first repo!",
    -    "private": false,
    -    "fork": true,
    -    "url": "https://api.github.com/repos/octocat/Hello-World",
    -    "html_url": "https://github.com/octocat/Hello-World",
    -    "clone_url": "https://github.com/octocat/Hello-World.git",
    -    "git_url": "git://github.com/octocat/Hello-World.git",
    -    "ssh_url": "git@github.com:octocat/Hello-World.git",
    -    "svn_url": "https://svn.github.com/octocat/Hello-World",
    -    "mirror_url": "git://git.example.com/octocat/Hello-World",
    -    "homepage": "https://github.com",
    -    "language": null,
    -    "forks_count": 9,
    -    "stargazers_count": 80,
    -    "watchers_count": 80,
    -    "size": 108,
    -    "default_branch": "master",
    -    "master_branch": "master",
    -    "open_issues_count": 0,
    -    "pushed_at": "2011-01-26T19:06:43Z",
    -    "created_at": "2011-01-26T19:01:12Z",
    -    "updated_at": "2011-01-26T19:14:43Z"
    -  },
    -  "has_issues": true,
    -  "has_wiki": true,
    -  "has_downloads": true
    -}
    - -

    List contributors

    - -

    List contributors to the specified repository, sorted by the number of commits per contributor in descending order.

    - -
    GET /repos/:owner/:repo/contributors
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    anonstringSet to 1 or true to include anonymous contributors in results.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false,
    -    "contributions": 32
    -  }
    -]
    - -

    List languages

    - -

    List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language.

    - -
    GET /repos/:owner/:repo/languages
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "C": 78769,
    -  "Python": 7769
    -}
    - -

    List Teams

    - -
    GET /repos/:owner/:repo/teams
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/teams/1",
    -    "name": "Owners",
    -    "id": 1
    -  }
    -]
    - -

    List Tags

    - -
    GET /repos/:owner/:repo/tags
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "name": "v0.1",
    -    "commit": {
    -      "sha": "c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
    -    },
    -    "zipball_url": "https://github.com/octocat/Hello-World/zipball/v0.1",
    -    "tarball_url": "https://github.com/octocat/Hello-World/tarball/v0.1"
    -  }
    -]
    - -

    List Branches

    - -
    GET /repos/:owner/:repo/branches
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "name": "master",
    -    "commit": {
    -      "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc"
    -    }
    -  }
    -]
    - -

    Get Branch

    - -
    GET /repos/:owner/:repo/branches/:branch
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "name": "master",
    -  "commit": {
    -    "sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -    "commit": {
    -      "author": {
    -        "name": "The Octocat",
    -        "date": "2012-03-06T15:06:50-08:00",
    -        "email": "octocat@nowhere.com"
    -      },
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -      "message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
    -      "tree": {
    -        "sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
    -        "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
    -      },
    -      "committer": {
    -        "name": "The Octocat",
    -        "date": "2012-03-06T15:06:50-08:00",
    -        "email": "octocat@nowhere.com"
    -      }
    -    },
    -    "author": {
    -      "gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
    -      "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
    -      "url": "https://api.github.com/users/octocat",
    -      "id": 583231,
    -      "login": "octocat"
    -    },
    -    "parents": [
    -      {
    -        "sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
    -        "url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
    -      },
    -      {
    -        "sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
    -        "url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"
    -      }
    -    ],
    -    "url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -    "committer": {
    -      "gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
    -      "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
    -      "url": "https://api.github.com/users/octocat",
    -      "id": 583231,
    -      "login": "octocat"
    -    }
    -  },
    -  "_links": {
    -    "html": "https://github.com/octocat/Hello-World/tree/master",
    -    "self": "https://api.github.com/repos/octocat/Hello-World/branches/master"
    -  }
    -}
    - -

    Delete a Repository

    - -

    Deleting a repository requires admin access. If OAuth is used, the -delete_repo scope is required.

    - -
    DELETE /repos/:owner/:repo
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/keys/index.html b/v3/repos/keys/index.html deleted file mode 100644 index dcc8d219b5..0000000000 --- a/v3/repos/keys/index.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - - - Deploy Keys | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Deploy Keys

    - - - -

    List deploy keys

    - -
    GET /repos/:owner/:repo/keys
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "key": "ssh-rsa AAA...",
    -    "url": "https://api.github.com/user/keys/1",
    -    "title": "octocat@octomac"
    -  }
    -]
    - -

    Get a deploy key

    - -
    GET /repos/:owner/:repo/keys/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Add a new deploy key

    - -
    POST /repos/:owner/:repo/keys
    -
    - -

    Input

    - -
    {
    -  "title": "octocat@octomac",
    -  "key": "ssh-rsa AAA..."
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/user/repo/keys/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Edit a deploy key

    - -
    PATCH /repos/:owner/:repo/keys/:id
    -
    - -

    Input

    - -
    {
    -  "title": "octocat@octomac",
    -  "key": "ssh-rsa AAA..."
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Remove a deploy key

    - -
    DELETE /repos/:owner/:repo/keys/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/merging/index.html b/v3/repos/merging/index.html deleted file mode 100644 index 60238b73f4..0000000000 --- a/v3/repos/merging/index.html +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - - Merging | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Merging

    - - - -

    The Repo Merging API supports merging branches in a repository. This accomplishes -essentially the same thing as merging one branch into another in a local repository -and then pushing to GitHub. The benefit is that the merge is done on the server side -and a local repository is not needed. This makes it more appropriate for automation -and other tools where maintaining local repositories would be cumbersome and inefficient.

    - -

    The authenticated user will be the author of any merges done through this endpoint.

    - -

    Perform a merge

    - -
    POST /repos/:owner/:repo/merges
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    basestring -Required. The name of the base branch that the head will be merged into.
    headstring -Required. The head to merge. This can be a branch name or a commit SHA1.
    commit_messagestringCommit message to use for the merge commit. If omitted, a default message will be used.
    - -
    {
    -  "base": "master",
    -  "head": "cool_feature",
    -  "commit_message": "Shipped cool_feature!"
    -}
    - -

    Successful Response (The resulting merge commit) -

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -  "commit": {
    -    "author": {
    -      "name": "The Octocat",
    -      "date": "2012-03-06T15:06:50-08:00",
    -      "email": "octocat@nowhere.com"
    -    },
    -    "committer": {
    -      "name": "The Octocat",
    -      "date": "2012-03-06T15:06:50-08:00",
    -      "email": "octocat@nowhere.com"
    -    },
    -    "message": "Shipped cool_feature!",
    -    "tree": {
    -      "sha": "b4eecafa9be2f2006ce1b709d6857b07069b4608",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608"
    -    },
    -    "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -    "comment_count": 0
    -  },
    -  "url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
    -  "comments_url": "https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments",
    -  "author": {
    -    "login": "octocat",
    -    "id": 583231,
    -    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
    -    "gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User"
    -  },
    -  "committer": {
    -    "login": "octocat",
    -    "id": 583231,
    -    "avatar_url": "https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
    -    "gravatar_id": "7ad39074b0584bc555d0417ae3e7d974",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User"
    -  },
    -  "parents": [
    -    {
    -      "sha": "553c2077f0edc3d5dc5d17262f6aa498e69d6f8e",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e"
    -    },
    -    {
    -      "sha": "762941318ee16e59dabbacb1b4049eec22f0d303",
    -      "url": "https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303"
    -    }
    -  ]
    -}
    - -

    No-op response (base already contains the head, nothing to merge)

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Merge conflict response

    - -
    Status: 409 Conflict
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "message": "Merge Conflict"
    -}
    - -

    Missing base response

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "message": "Base does not exist"
    -}
    - -

    Missing head response

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "message": "Head does not exist"
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/releases/index.html b/v3/repos/releases/index.html deleted file mode 100644 index 08b66ff405..0000000000 --- a/v3/repos/releases/index.html +++ /dev/null @@ -1,963 +0,0 @@ - - - - - - - - Releases | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Releases

    - - - -

    List releases for a repository

    - -

    Users with push access to the repository will receive all releases -(i.e., published releases and draft releases). Users with pull access -will receive published releases only.

    - -
    GET /repos/:owner/:repo/releases
    -
    - -

    Note: This returns a list of releases, which does not include regular -Git tags that have not been associated with a release. -To get a list of Git tags, use the Repository Tags API.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
    -    "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
    -    "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
    -    "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
    -    "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
    -    "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0",
    -    "id": 1,
    -    "tag_name": "v1.0.0",
    -    "target_commitish": "master",
    -    "name": "v1.0.0",
    -    "body": "Description of the release",
    -    "draft": false,
    -    "prerelease": false,
    -    "created_at": "2013-02-27T19:35:32Z",
    -    "published_at": "2013-02-27T19:35:32Z",
    -    "author": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "assets": [
    -      {
    -        "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -        "id": 1,
    -        "name": "example.zip",
    -        "label": "short description",
    -        "state": "uploaded",
    -        "content_type": "application/zip",
    -        "size": 1024,
    -        "download_count": 42,
    -        "created_at": "2013-02-27T19:35:32Z",
    -        "updated_at": "2013-02-27T19:35:32Z",
    -        "uploader": {
    -          "login": "octocat",
    -          "id": 1,
    -          "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -          "gravatar_id": "somehexcode",
    -          "url": "https://api.github.com/users/octocat",
    -          "html_url": "https://github.com/octocat",
    -          "followers_url": "https://api.github.com/users/octocat/followers",
    -          "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -          "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -          "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -          "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -          "organizations_url": "https://api.github.com/users/octocat/orgs",
    -          "repos_url": "https://api.github.com/users/octocat/repos",
    -          "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -          "received_events_url": "https://api.github.com/users/octocat/received_events",
    -          "type": "User",
    -          "site_admin": false
    -        }
    -      }
    -    ]
    -  }
    -]
    - -

    Get a single release

    - -
    GET /repos/:owner/:repo/releases/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
    -  "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
    -  "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
    -  "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
    -  "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
    -  "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0",
    -  "id": 1,
    -  "tag_name": "v1.0.0",
    -  "target_commitish": "master",
    -  "name": "v1.0.0",
    -  "body": "Description of the release",
    -  "draft": false,
    -  "prerelease": false,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "published_at": "2013-02-27T19:35:32Z",
    -  "author": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "assets": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -      "id": 1,
    -      "name": "example.zip",
    -      "label": "short description",
    -      "state": "uploaded",
    -      "content_type": "application/zip",
    -      "size": 1024,
    -      "download_count": 42,
    -      "created_at": "2013-02-27T19:35:32Z",
    -      "updated_at": "2013-02-27T19:35:32Z",
    -      "uploader": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      }
    -    }
    -  ]
    -}
    - -

    Note: This returns an “upload_url” hypermedia relation that provides the endpoint -that creates release assets.

    - -

    Create a release

    - -

    Users with push access to the repository can create a release.

    - -
    POST /repos/:owner/:repo/releases
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tag_namestring -Required. The name of the tag.
    target_commitishstringSpecifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository’s default branch (usually master).
    namestringThe name of the release.
    bodystringText describing the contents of the tag.
    draftboolean -true to create a draft (unpublished) release, false to create a published one. Default: false -
    prereleaseboolean -true to identify the release as a prerelease. false to identify the release as a full release. Default: false -
    - -

    Example

    - -
    {
    -  "tag_name": "v1.0.0",
    -  "target_commitish": "master",
    -  "name": "v1.0.0",
    -  "body": "Description of the release",
    -  "draft": false,
    -  "prerelease": false
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/octocat/Hello-World/releases/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
    -  "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
    -  "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
    -  "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
    -  "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
    -  "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0",
    -  "id": 1,
    -  "tag_name": "v1.0.0",
    -  "target_commitish": "master",
    -  "name": "v1.0.0",
    -  "body": "Description of the release",
    -  "draft": false,
    -  "prerelease": false,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "published_at": "2013-02-27T19:35:32Z",
    -  "author": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "assets": [
    -
    -  ]
    -}
    - -

    Edit a release

    - -

    Users with push access to the repository can edit a release.

    - -
    PATCH /repos/:owner/:repo/releases/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tag_namestringThe name of the tag.
    target_commitishstringSpecifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository’s default branch (usually master).
    namestringThe name of the release.
    bodystringText describing the contents of the tag.
    draftboolean -true makes the release a draft, and false publishes the release.
    prereleaseboolean -true to identify the release as a prerelease, false to identify the release as a full release.
    - -

    Example

    - -
    {
    -  "tag_name": "v1.0.0",
    -  "target_commitish": "master",
    -  "name": "v1.0.0",
    -  "body": "Description of the release",
    -  "draft": false,
    -  "prerelease": false
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
    -  "html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
    -  "assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
    -  "upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name}",
    -  "tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
    -  "zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0",
    -  "id": 1,
    -  "tag_name": "v1.0.0",
    -  "target_commitish": "master",
    -  "name": "v1.0.0",
    -  "body": "Description of the release",
    -  "draft": false,
    -  "prerelease": false,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "published_at": "2013-02-27T19:35:32Z",
    -  "author": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  },
    -  "assets": [
    -    {
    -      "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -      "id": 1,
    -      "name": "example.zip",
    -      "label": "short description",
    -      "state": "uploaded",
    -      "content_type": "application/zip",
    -      "size": 1024,
    -      "download_count": 42,
    -      "created_at": "2013-02-27T19:35:32Z",
    -      "updated_at": "2013-02-27T19:35:32Z",
    -      "uploader": {
    -        "login": "octocat",
    -        "id": 1,
    -        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -        "gravatar_id": "somehexcode",
    -        "url": "https://api.github.com/users/octocat",
    -        "html_url": "https://github.com/octocat",
    -        "followers_url": "https://api.github.com/users/octocat/followers",
    -        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -        "organizations_url": "https://api.github.com/users/octocat/orgs",
    -        "repos_url": "https://api.github.com/users/octocat/repos",
    -        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/octocat/received_events",
    -        "type": "User",
    -        "site_admin": false
    -      }
    -    }
    -  ]
    -}
    - -

    Delete a release

    - -

    Users with push access to the repository can delete a release.

    - -
    DELETE /repos/:owner/:repo/releases/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    List assets for a release

    - -
    GET /repos/:owner/:repo/releases/:id/assets
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -    "id": 1,
    -    "name": "example.zip",
    -    "label": "short description",
    -    "state": "uploaded",
    -    "content_type": "application/zip",
    -    "size": 1024,
    -    "download_count": 42,
    -    "created_at": "2013-02-27T19:35:32Z",
    -    "updated_at": "2013-02-27T19:35:32Z",
    -    "uploader": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    }
    -  }
    -]
    - -

    Upload a release asset

    - -

    This is a unique endpoint. The domain of the request changes from “api.github.com” -to “uploads.github.com”. You need to use an HTTP client which supports -SNI to make calls to this -endpoint.

    - -

    The asset data is expected in its raw binary form, -instead of JSON. Everything else about the endpoint is the same. Pass your -authentication exactly the same as the rest of the API.

    - -
    POST https://uploads.github.com/repos/:owner/:repo/releases/:id/assets?name=foo.zip
    -
    - -

    This endpoint is provided by a URI template in the release’s API response.

    - -

    Input

    - -

    The raw file is uploaded to GitHub. Set the content type appropriately, and the -asset’s name in a URI query parameter.

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    Content-Typestring -Required. The content type of the asset. This should be set in the Header. Example: “application/zip”. For a list of acceptable types, refer this list of common media types.
    namestring -Required. The file name of the asset. This should be set in the URI query parameter.
    - -

    Send the raw binary content of the asset as the request body.

    - -

    Response for successful upload

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -  "id": 1,
    -  "name": "example.zip",
    -  "label": "short description",
    -  "state": "uploaded",
    -  "content_type": "application/zip",
    -  "size": 1024,
    -  "download_count": 42,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "updated_at": "2013-02-27T19:35:32Z",
    -  "uploader": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    Response for upstream failure

    - -

    This may leave an empty asset with a state of “new”. It can be safely deleted.

    - -
    Status: 502 Bad Gateway
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Get a single release asset

    - -
    GET /repos/:owner/:repo/releases/assets/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -  "id": 1,
    -  "name": "example.zip",
    -  "label": "short description",
    -  "state": "uploaded",
    -  "content_type": "application/zip",
    -  "size": 1024,
    -  "download_count": 42,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "updated_at": "2013-02-27T19:35:32Z",
    -  "uploader": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    If you want to download the asset’s binary content, pass a media type of -“application/octet-stream”. The API will either redirect the client to the -location, or stream it directly if possible. API clients should handle both a -200 or 302 response.

    - -
    Status: 302 Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Edit a release asset

    - -

    Users with push access to the repository can edit a release asset.

    - -
    PATCH /repos/:owner/:repo/releases/assets/:id
    -
    - -

    Input

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestring -Required. The file name of the asset.
    labelstringAn alternate short description of the asset. Used in place of the filename.
    - -

    Example

    - -
    {
    -  "name": "foo-1.0.0-osx.zip",
    -  "label": "Mac binary"
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
    -  "id": 1,
    -  "name": "example.zip",
    -  "label": "short description",
    -  "state": "uploaded",
    -  "content_type": "application/zip",
    -  "size": 1024,
    -  "download_count": 42,
    -  "created_at": "2013-02-27T19:35:32Z",
    -  "updated_at": "2013-02-27T19:35:32Z",
    -  "uploader": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -

    Delete a release asset

    - -
    DELETE /repos/:owner/:repo/releases/assets/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/statistics/index.html b/v3/repos/statistics/index.html deleted file mode 100644 index 3a02200fb2..0000000000 --- a/v3/repos/statistics/index.html +++ /dev/null @@ -1,536 +0,0 @@ - - - - - - - - Statistics | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Statistics

    - - - -

    The Repository Statistics API allows you to fetch the data that GitHub uses for visualizing different -types of repository activity.

    - -

    A word about caching

    - -

    Computing repository statistics is an expensive operation, so we try to return cached -data whenever possible. If the data hasn’t been cached when you query a repository’s -statistics, you’ll receive a 202 response; a background job is also fired to -start compiling these statistics. Give the job a few moments to complete, and -then submit the request again. If the job has completed, that request will receive a -200 response with the statistics in the response body.

    - -

    Repository statistics are cached by the SHA of the repository’s default branch, -which is usually master; pushing to the default branch resets the statistics cache.

    - -

    Get contributors list with additions, deletions, and commit counts

    - -
    GET /repos/:owner/:repo/stats/contributors
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "author": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    },
    -    "total": 135,
    -    "weeks": [
    -      {
    -        "w": "1367712000",
    -        "a": 6898,
    -        "d": 77,
    -        "c": 10
    -      }
    -    ]
    -  }
    -]
    - -
      -
    • -total - The Total number of commits authored by the contributor.
    • -
    - -

    Weekly Hash

    - -
      -
    • -w - Start of the week, given as a Unix timestamp.
    • -
    • -a - Number of additions
    • -
    • -d - Number of deletions
    • -
    • -c - Number of commits
    • -
    - -

    Get the last year of commit activity data

    - -

    Returns the last year of commit activity grouped by week. The days array -is a group of commits per day, starting on Sunday.

    - -
    GET /repos/:owner/:repo/stats/commit_activity
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "days": [
    -      0,
    -      3,
    -      26,
    -      20,
    -      39,
    -      1,
    -      0
    -    ],
    -    "total": 89,
    -    "week": 1336280400
    -  }
    -]
    - -

    Get the number of additions and deletions per week

    - -
    GET /repos/:owner/:repo/stats/code_frequency
    -
    - -

    Response

    - -

    Returns a weekly aggregate of the number of additions and deletions pushed -to a repository.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  [
    -    1302998400,
    -    1124,
    -    -435
    -  ]
    -]
    - -

    Get the weekly commit count for the repository owner and everyone else

    - -
    GET /repos/:owner/:repo/stats/participation
    -
    - -

    Response

    - -

    Returns the total commit counts for the owner and total commit counts in all. -all is everyone combined, including the owner in the last 52 weeks. If you’d like to get the commit -counts for non-owners, you can subtract all from owner.

    - -

    The array order is oldest week (index 0) to most recent week.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "all": [
    -    11,
    -    21,
    -    15,
    -    2,
    -    8,
    -    1,
    -    8,
    -    23,
    -    17,
    -    21,
    -    11,
    -    10,
    -    33,
    -    91,
    -    38,
    -    34,
    -    22,
    -    23,
    -    32,
    -    3,
    -    43,
    -    87,
    -    71,
    -    18,
    -    13,
    -    5,
    -    13,
    -    16,
    -    66,
    -    27,
    -    12,
    -    45,
    -    110,
    -    117,
    -    13,
    -    8,
    -    18,
    -    9,
    -    19,
    -    26,
    -    39,
    -    12,
    -    20,
    -    31,
    -    46,
    -    91,
    -    45,
    -    10,
    -    24,
    -    9,
    -    29,
    -    7
    -  ],
    -  "owner": [
    -    3,
    -    2,
    -    3,
    -    0,
    -    2,
    -    0,
    -    5,
    -    14,
    -    7,
    -    9,
    -    1,
    -    5,
    -    0,
    -    48,
    -    19,
    -    2,
    -    0,
    -    1,
    -    10,
    -    2,
    -    23,
    -    40,
    -    35,
    -    8,
    -    8,
    -    2,
    -    10,
    -    6,
    -    30,
    -    0,
    -    2,
    -    9,
    -    53,
    -    104,
    -    3,
    -    3,
    -    10,
    -    4,
    -    7,
    -    11,
    -    21,
    -    4,
    -    4,
    -    22,
    -    26,
    -    63,
    -    11,
    -    2,
    -    14,
    -    1,
    -    10,
    -    3
    -  ]
    -}
    - -

    Get the number of commits per hour in each day

    - -
    GET /repos/:owner/:repo/stats/punch_card
    -
    - -

    Response

    - -

    Each array contains the day number, hour number, and number of commits:

    - -
      -
    • -0-6: Sunday - Saturday
    • -
    • -0-23: Hour of day
    • -
    • Number of commits
    • -
    - -

    For example, [2, 14, 25] indicates that there were 25 total commits, during the -2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  [
    -    0,
    -    0,
    -    5
    -  ],
    -  [
    -    0,
    -    1,
    -    43
    -  ],
    -  [
    -    0,
    -    2,
    -    21
    -  ]
    -]
    - -
    - - - -
    - - - - - - - - diff --git a/v3/repos/statuses/index.html b/v3/repos/statuses/index.html deleted file mode 100644 index 0cac038fab..0000000000 --- a/v3/repos/statuses/index.html +++ /dev/null @@ -1,400 +0,0 @@ - - - - - - - - Statuses | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Statuses

    - - - -

    The Status API allows external services to mark commits with a success, -failure, error, or pending state, which is then reflected in pull requests -involving those commits.

    - -

    Statuses can also include an optional description and target_url, and -we highly recommend providing them as they make statuses much more -useful in the GitHub UI.

    - -

    As an example, one common use is for continuous integration -services to mark commits as passing or failing builds using Status. The -target_url would be the full URL to the build output, and the -description would be the high level summary of what happened with the -build.

    - -

    Note that the repo:status OAuth scope grants targeted -access to Statuses without also granting access to repository code, while the -repo scope grants permission to code as well as statuses.

    - -

    List Statuses for a specific Ref

    - -

    Users with pull access can view commit statuses for a given ref:

    - -
    GET /repos/:owner/:repo/statuses/:ref
    -
    - -

    Statuses are returned in reverse chronological order. The first status in the -list will be the latest one.

    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    refstring -Required. Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "created_at": "2012-07-20T01:19:13Z",
    -    "updated_at": "2012-07-20T01:19:13Z",
    -    "state": "success",
    -    "target_url": "https://ci.example.com/1000/output",
    -    "description": "Build has completed successfully",
    -    "id": 1,
    -    "url": "https://api.github.com/repos/octocat/example/statuses/1",
    -    "creator": {
    -      "login": "octocat",
    -      "id": 1,
    -      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -      "gravatar_id": "somehexcode",
    -      "url": "https://api.github.com/users/octocat",
    -      "html_url": "https://github.com/octocat",
    -      "followers_url": "https://api.github.com/users/octocat/followers",
    -      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -      "organizations_url": "https://api.github.com/users/octocat/orgs",
    -      "repos_url": "https://api.github.com/users/octocat/repos",
    -      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -      "received_events_url": "https://api.github.com/users/octocat/received_events",
    -      "type": "User",
    -      "site_admin": false
    -    }
    -  }
    -]
    - -

    Create a Status

    - -

    Users with push access can create commit statuses for a given ref:

    - -
    POST /repos/:owner/:repo/statuses/:sha
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    statestring -Required. The state of the status. Can be one of pending, success, error, or failure.
    target_urlstringThe target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the ‘source’ of the Status.
    For example, if your Continuous Integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA:
    http://ci.example.com/user/repo/build/sha.
    descriptionstringA short description of the status
    - -

    Example

    - -
    {
    -  "state": "success",
    -  "target_url": "https://example.com/build/status",
    -  "description": "The build succeeded!"
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/repos/octocat/example/statuses/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "created_at": "2012-07-20T01:19:13Z",
    -  "updated_at": "2012-07-20T01:19:13Z",
    -  "state": "success",
    -  "target_url": "https://ci.example.com/1000/output",
    -  "description": "Build has completed successfully",
    -  "id": 1,
    -  "url": "https://api.github.com/repos/octocat/example/statuses/1",
    -  "creator": {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/search/index.html b/v3/search/index.html deleted file mode 100644 index 1ab013b675..0000000000 --- a/v3/search/index.html +++ /dev/null @@ -1,1149 +0,0 @@ - - - - - - - - Search | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Search

    - - - -

    About the Search API

    - -

    The Search API is optimized to help you find the specific item you’re looking -for (e.g., a specific user, a specific file in a repository, etc.). Think of it -the way you think of performing a search on Google. It’s designed to help you -find the one result you’re looking for (or maybe the few results you’re looking -for). Just like searching on Google, you sometimes want to see a few pages of -search results so that you can find the item that best meets your needs. To -satisfy that need, the GitHub Search API provides up to 1,000 results for each -search.

    - -

    Rate limit

    - -

    The Search API has a custom rate limit. For requests using Basic -Authentication, OAuth, or client -ID and secret, you can make up to -20 requests per minute. For unauthenticated requests, the rate limit allows you -to make up to 5 requests per minute.

    - -

    See the rate limit documentation for details on -determining your current rate limit status.

    - -

    Search repositories

    - -

    Find repositories via various criteria. This method returns up to 100 results per page.

    - -
    GET /search/repositories
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    qstringThe search keywords, as well as any qualifiers.
    sortstringThe sort field. One of stars, forks, or updated. Default: results are sorted by best match.
    orderstringThe sort order if sort parameter is provided. One of asc or desc. Default: desc -
    - -

    The q search term can also contain any combination of the supported repository search qualifiers:

    - -
      -
    • -in - Qualifies which fields are searched. With this qualifier you can restrict the - search to just the repository name, description, readme, or - any combination of these.
    • -
    • -size -Finds repositories that match a certain size (in kilobytes).
    • -
    • -forks -Filters repositories based on the number of forks, and/or whether forked repositories should be included in the results at all.
    • -
    • -created or pushed -Filters repositories based on times of creation, or when they were last updated.
    • -
    • -user or repo -Limits searches to a specific user or repository.
    • -
    • -language -Searches repositories based on the language they’re written in.
    • -
    • -stars -Searches repositories based on the number of stars.
    • -
    - -

    Example

    - -

    Suppose you want to search for popular Tetris repositories written in Assembly. -Your query might look like this.

    - -
    https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
    -
    - -

    In this request, we’re searching for repositories with the word tetris in the -name, the description, or the README. We’re limiting the results to only find -repositories where the primary language is Assembly. We’re sorting by stars in -descending order, so that the most popular repositories appear first in the -search results.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 20
    -X-RateLimit-Remaining: 19
    - -
    {
    -  "total_count": 40,
    -  "items": [
    -    {
    -      "id": 3081286,
    -      "name": "Tetris",
    -      "full_name": "dtrupenn/Tetris",
    -      "owner": {
    -        "login": "dtrupenn",
    -        "id": 872147,
    -        "avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
    -        "gravatar_id": "e7956084e75f239de85d3a31bc172ace",
    -        "url": "https://api.github.com/users/dtrupenn",
    -        "received_events_url": "https://api.github.com/users/dtrupenn/received_events",
    -        "type": "User"
    -      },
    -      "private": false,
    -      "html_url": "https://github.com/dtrupenn/Tetris",
    -      "description": "A C implementation of Tetris using Pennsim through LC4",
    -      "fork": false,
    -      "url": "https://api.github.com/repos/dtrupenn/Tetris",
    -      "created_at": "2012-01-01T00:31:50Z",
    -      "updated_at": "2013-01-05T17:58:47Z",
    -      "pushed_at": "2012-01-01T00:37:02Z",
    -      "homepage": "",
    -      "size": 524,
    -      "stargazers_count": 1,
    -      "watchers_count": 1,
    -      "language": "Assembly",
    -      "forks_count": 0,
    -      "open_issues_count": 0,
    -      "master_branch": "master",
    -      "default_branch": "master",
    -      "score": 10.309712
    -    }
    -  ]
    -}
    - -

    Highlighting Repository Search Results

    - -

    Some API consumers will want to highlight the matching search terms when -displaying search results. The API offers additional metadata to support this -use case. To get this metadata in your search results, specify the text-match -media type in your Accept header. For example, via curl, the above query would -look like this:

    - -
    curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -  https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc
    -
    - -

    This produces the same JSON payload as above, with an extra key called -text_matches, an array of objects. These objects provide information such as -the position of your search terms within the text, as well as the property that -included the search term.

    - -

    When searching for repositories, you can get text match metadata for the -name and description fields. (See the section on text match metadata - for full details.)

    - -

    Here’s an example response:

    - -
    {
    -  "text_matches": [
    -    {
    -      "object_url": "https://api.github.com/repositories/3081286",
    -      "object_type": "Repository",
    -      "property": "name",
    -      "fragment": "Tetris",
    -      "matches": [
    -        {
    -          "text": "Tetris",
    -          "indices": [
    -            0,
    -            6
    -          ]
    -        }
    -      ]
    -    },
    -    {
    -      "object_url": "https://api.github.com/repositories/3081286",
    -      "object_type": "Repository",
    -      "property": "description",
    -      "fragment": "A C implementation of Tetris using Pennsim through LC4",
    -      "matches": [
    -        {
    -          "text": "Tetris",
    -          "indices": [
    -            22,
    -            28
    -          ]
    -        }
    -      ]
    -    }
    -  ]
    -}
    - -

    Search code

    - -

    Find file contents via various criteria. (This method returns up to 100 results per page.)

    - -
    GET /search/code
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    qstringThe search terms.
    sortstringThe sort field. Can only be indexed, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: results are sorted by best match.
    orderstringThe sort order if sort parameter is provided. One of asc or desc. Default: desc -
    - -

    The q search term can also contain any combination of the supported code search qualifiers:

    - -
      -
    • -in - Qualifies which fields are searched. With this qualifier you can restrict the - search to just the file contents, the file path, or both.
    • -
    • -language -Searches code based on the language it’s written in.
    • -
    • -fork -Specifies that code from forked repositories should be searched. Repository -forks will not be searchable unless the fork has more stars than the parent -repository.
    • -
    • -size -Finds files that match a certain size (in bytes).
    • -
    • -path -Specifies the path that the resulting file must be at.
    • -
    • -extension -Matches files with a certain extension.
    • -
    • -user or repo - Limits searches to a specific user or repository.
    • -
    - -

    Example

    - -

    Suppose you want to find the definition of the addClass function inside -jQuery. Your query would look something like -this:

    - -
    https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
    -
    - -

    Here, we’re searching for the keyword addClass within a file’s contents. We’re -making sure that we’re only looking in files where the language is JavaScript. -And we’re scoping the search to the repo:jquery/jquery repository.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 20
    -X-RateLimit-Remaining: 19
    - -
    {
    -  "total_count": 7,
    -  "items": [
    -    {
    -      "name": "classes.js",
    -      "path": "src/attributes/classes.js",
    -      "sha": "d7212f9dee2dcc18f084d7df8f417b80846ded5a",
    -      "url": "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4",
    -      "git_url": "https://api.github.com/repositories/167174/git/blobs/d7212f9dee2dcc18f084d7df8f417b80846ded5a",
    -      "html_url": "https://github.com/jquery/jquery/blob/825ac3773694e0cd23ee74895fd5aeb535b27da4/src/attributes/classes.js",
    -      "repository": {
    -        "id": 167174,
    -        "name": "jquery",
    -        "full_name": "jquery/jquery",
    -        "owner": {
    -          "login": "jquery",
    -          "id": 70142,
    -          "avatar_url": "https://0.gravatar.com/avatar/6906f317a4733f4379b06c32229ef02f?d=https%3A%2F%2Fidenticons.github.com%2Ff426f04f2f9813718fb806b30e0093de.png",
    -          "gravatar_id": "6906f317a4733f4379b06c32229ef02f",
    -          "url": "https://api.github.com/users/jquery",
    -          "html_url": "https://github.com/jquery",
    -          "followers_url": "https://api.github.com/users/jquery/followers",
    -          "following_url": "https://api.github.com/users/jquery/following{/other_user}",
    -          "gists_url": "https://api.github.com/users/jquery/gists{/gist_id}",
    -          "starred_url": "https://api.github.com/users/jquery/starred{/owner}{/repo}",
    -          "subscriptions_url": "https://api.github.com/users/jquery/subscriptions",
    -          "organizations_url": "https://api.github.com/users/jquery/orgs",
    -          "repos_url": "https://api.github.com/users/jquery/repos",
    -          "events_url": "https://api.github.com/users/jquery/events{/privacy}",
    -          "received_events_url": "https://api.github.com/users/jquery/received_events",
    -          "type": "Organization",
    -          "site_admin": false
    -        },
    -        "private": false,
    -        "html_url": "https://github.com/jquery/jquery",
    -        "description": "jQuery JavaScript Library",
    -        "fork": false,
    -        "url": "https://api.github.com/repos/jquery/jquery",
    -        "forks_url": "https://api.github.com/repos/jquery/jquery/forks",
    -        "keys_url": "https://api.github.com/repos/jquery/jquery/keys{/key_id}",
    -        "collaborators_url": "https://api.github.com/repos/jquery/jquery/collaborators{/collaborator}",
    -        "teams_url": "https://api.github.com/repos/jquery/jquery/teams",
    -        "hooks_url": "https://api.github.com/repos/jquery/jquery/hooks",
    -        "issue_events_url": "https://api.github.com/repos/jquery/jquery/issues/events{/number}",
    -        "events_url": "https://api.github.com/repos/jquery/jquery/events",
    -        "assignees_url": "https://api.github.com/repos/jquery/jquery/assignees{/user}",
    -        "branches_url": "https://api.github.com/repos/jquery/jquery/branches{/branch}",
    -        "tags_url": "https://api.github.com/repos/jquery/jquery/tags",
    -        "blobs_url": "https://api.github.com/repos/jquery/jquery/git/blobs{/sha}",
    -        "git_tags_url": "https://api.github.com/repos/jquery/jquery/git/tags{/sha}",
    -        "git_refs_url": "https://api.github.com/repos/jquery/jquery/git/refs{/sha}",
    -        "trees_url": "https://api.github.com/repos/jquery/jquery/git/trees{/sha}",
    -        "statuses_url": "https://api.github.com/repos/jquery/jquery/statuses/{sha}",
    -        "languages_url": "https://api.github.com/repos/jquery/jquery/languages",
    -        "stargazers_url": "https://api.github.com/repos/jquery/jquery/stargazers",
    -        "contributors_url": "https://api.github.com/repos/jquery/jquery/contributors",
    -        "subscribers_url": "https://api.github.com/repos/jquery/jquery/subscribers",
    -        "subscription_url": "https://api.github.com/repos/jquery/jquery/subscription",
    -        "commits_url": "https://api.github.com/repos/jquery/jquery/commits{/sha}",
    -        "git_commits_url": "https://api.github.com/repos/jquery/jquery/git/commits{/sha}",
    -        "comments_url": "https://api.github.com/repos/jquery/jquery/comments{/number}",
    -        "issue_comment_url": "https://api.github.com/repos/jquery/jquery/issues/comments/{number}",
    -        "contents_url": "https://api.github.com/repos/jquery/jquery/contents/{+path}",
    -        "compare_url": "https://api.github.com/repos/jquery/jquery/compare/{base}...{head}",
    -        "merges_url": "https://api.github.com/repos/jquery/jquery/merges",
    -        "archive_url": "https://api.github.com/repos/jquery/jquery/{archive_format}{/ref}",
    -        "downloads_url": "https://api.github.com/repos/jquery/jquery/downloads",
    -        "issues_url": "https://api.github.com/repos/jquery/jquery/issues{/number}",
    -        "pulls_url": "https://api.github.com/repos/jquery/jquery/pulls{/number}",
    -        "milestones_url": "https://api.github.com/repos/jquery/jquery/milestones{/number}",
    -        "notifications_url": "https://api.github.com/repos/jquery/jquery/notifications{?since,all,participating}",
    -        "labels_url": "https://api.github.com/repos/jquery/jquery/labels{/name}"
    -      },
    -      "score": 0.5269679
    -    }
    -  ]
    -}
    - -

    Highlighting Code Search Results

    - -

    Some API consumers will want to highlight the matching search terms when -displaying search results. The API offers additional metadata to support this -use case. To get this metadata in your search results, specify the text-match -media type in your Accept header. For example, via curl, the above query would -look like this:

    - -
    curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -  https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
    -
    - -

    This produces the same JSON payload as above, with an extra key called -text_matches, an array of objects. These objects provide information such as -the position of your search terms within the text, as well as the property that -included the search term.

    - -

    When searching for code, you can get text match metadata for the file -content and file path fields. (See the section on -text match metadata for full details.)

    - -

    Here’s an example response:

    - -
    {
    -  "text_matches": [
    -    {
    -      "object_url": "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4",
    -      "object_type": "FileContent",
    -      "property": "content",
    -      "fragment": ";\n\njQuery.fn.extend({\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, clazz, j, finalValue",
    -      "matches": [
    -        {
    -          "text": "addClass",
    -          "indices": [
    -            23,
    -            31
    -          ]
    -        }
    -      ]
    -    },
    -    {
    -      "object_url": "https://api.github.com/repositories/167174/contents/src/attributes/classes.js?ref=825ac3773694e0cd23ee74895fd5aeb535b27da4",
    -      "object_type": "FileContent",
    -      "property": "content",
    -      "fragment": ".isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this",
    -      "matches": [
    -        {
    -          "text": "addClass",
    -          "indices": [
    -            80,
    -            88
    -          ]
    -        }
    -      ]
    -    }
    -  ]
    -}
    - -

    Search issues

    - -

    Find issues by state and keyword. (This method returns up to 100 results per page.)

    - -
    GET /search/issues
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    qstringThe search terms.
    sortstringThe sort field. Can be comments, created, or updated. Default: results are sorted by best match.
    orderstringThe sort order if sort parameter is provided. One of asc or desc. Default: desc -
    - -

    The q search term can also contain any combination of the supported issue search qualifiers:

    - -
      -
    • -type -With this qualifier you can restrict the search to issues or pull request only.
    • -
    • -in -Qualifies which fields are searched. With this qualifier you can restrict the -search to just the title, body, comments, or any combination of these.
    • -
    • -author -Finds issues created by a certain user.
    • -
    • -assignee -Finds issues that are assigned to a certain user.
    • -
    • -mentions -Finds issues that mention a certain user.
    • -
    • -commenter -Finds issues that a certain user commented on.
    • -
    • -involves -Finds issues that were either created by a certain user, assigned to that - user, mention that user, or were commented on by that user.
    • -
    • -state -Filter issues based on whether they’re open or closed.
    • -
    • -labels -Filters issues based on their labels.
    • -
    • -language -Searches for issues within repositories that match a certain language.
    • -
    • -created or updated -Filters issues based on times of creation, or when they were last updated.
    • -
    • -comments -Filters issues based on the quantity of comments.
    • -
    • -user or repo -Limits searches to a specific user or repository.
    • -
    - -

    Example

    - -

    Let’s say you want to find the oldest unresolved Python bugs on Windows. Your -query might look something like this.

    - -
    https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
    -
    - -

    In this query, we’re searching for the keyword windows, within any open issue -that’s labeled as bug. The search runs across repositories whose primary -language is Python. We’re sorting by creation date in ascending order, so that -the oldest issues appear first in the search results.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 20
    -X-RateLimit-Remaining: 19
    - -
    {
    -  "total_count": 280,
    -  "items": [
    -    {
    -      "url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132",
    -      "labels_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/labels{/name}",
    -      "comments_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/comments",
    -      "events_url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132/events",
    -      "html_url": "https://github.com/batterseapower/pinyin-toolkit/issues/132",
    -      "id": 35802,
    -      "number": 132,
    -      "title": "Line Number Indexes Beyond 20 Not Displayed",
    -      "user": {
    -        "login": "Nick3C",
    -        "id": 90254,
    -        "avatar_url": "https://secure.gravatar.com/avatar/934442aadfe3b2f4630510de416c5718?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
    -        "gravatar_id": "934442aadfe3b2f4630510de416c5718",
    -        "url": "https://api.github.com/users/Nick3C",
    -        "html_url": "https://github.com/Nick3C",
    -        "followers_url": "https://api.github.com/users/Nick3C/followers",
    -        "following_url": "https://api.github.com/users/Nick3C/following{/other_user}",
    -        "gists_url": "https://api.github.com/users/Nick3C/gists{/gist_id}",
    -        "starred_url": "https://api.github.com/users/Nick3C/starred{/owner}{/repo}",
    -        "subscriptions_url": "https://api.github.com/users/Nick3C/subscriptions",
    -        "organizations_url": "https://api.github.com/users/Nick3C/orgs",
    -        "repos_url": "https://api.github.com/users/Nick3C/repos",
    -        "events_url": "https://api.github.com/users/Nick3C/events{/privacy}",
    -        "received_events_url": "https://api.github.com/users/Nick3C/received_events",
    -        "type": "User"
    -      },
    -      "labels": [
    -        {
    -          "url": "https://api.github.com/repos/batterseapower/pinyin-toolkit/labels/bug",
    -          "name": "bug",
    -          "color": "ff0000"
    -        }
    -      ],
    -      "state": "open",
    -      "assignee": null,
    -      "milestone": null,
    -      "comments": 15,
    -      "created_at": "2009-07-12T20:10:41Z",
    -      "updated_at": "2009-07-19T09:23:43Z",
    -      "closed_at": null,
    -      "pull_request": {
    -        "html_url": null,
    -        "diff_url": null,
    -        "patch_url": null
    -      },
    -      "body": "...",
    -      "score": 1.3859273
    -    }
    -  ]
    -}
    - -

    Highlighting Issue Search Results

    - -

    Some API consumers will want to highlight the matching search terms when -displaying search results. The API offers additional metadata to support this -use case. To get this metadata in your search results, specify the text-match -media type in your Accept header. For example, via curl, the above query would -look like this:

    - -
    curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -  https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
    -
    - -

    This produces the same JSON payload as above, with an extra key called -text_matches, an array of objects. These objects provide information such as -the position of your search terms within the text, as well as the property that -included the search term.

    - -

    When searching for issues, you can get text match metadata for the issue -title, issue body, and issue comment body fields. (See the section -on text match metadata for full details.)

    - -

    Here’s an example response:

    - -
    {
    -  "text_matches": [
    -    {
    -      "object_url": "https://api.github.com/repositories/215335/issues/132",
    -      "object_type": "Issue",
    -      "property": "body",
    -      "fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n",
    -      "matches": [
    -        {
    -          "text": "windows",
    -          "indices": [
    -            14,
    -            21
    -          ]
    -        },
    -        {
    -          "text": "windows",
    -          "indices": [
    -            78,
    -            85
    -          ]
    -        }
    -      ]
    -    },
    -    {
    -      "object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
    -      "object_type": "IssueComment",
    -      "property": "body",
    -      "fragment": " right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n",
    -      "matches": [
    -        {
    -          "text": "Windows",
    -          "indices": [
    -            163,
    -            170
    -          ]
    -        }
    -      ]
    -    }
    -  ]
    -}
    - -

    Search users

    - -

    Find users via various criteria. (This method returns up to 100 results per page.)

    - -
    GET /search/users
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    qstringThe search terms.
    sortstringThe sort field. Can be followers, repositories, or joined. Default: results are sorted by best match.
    orderstringThe sort order if sort parameter is provided. One of asc or desc. Default: desc -
    - -

    The q search term can also contain any combination of the supported user search qualifiers:

    - -
      -
    • -type -With this qualifier you can restrict the search to just personal accounts or -just organization accounts.
    • -
    • -in -Qualifies which fields are searched. With this qualifier you can restrict -the search to just the username, public email, full name, or any -combination of these.
    • -
    • -repos -Filters users based on the number of repositories they have.
    • -
    • -location -Filter users by the location indicated in their profile.
    • -
    • -language -Search for users that have repositories that match a certain language.
    • -
    • -created -Filter users based on when they joined.
    • -
    • -followers -Filter users based on the number of followers they have.
    • -
    - -

    Example

    - -

    Imagine you’re looking for a list of popular users. You might try out this query:

    - -
    https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
    -
    - -

    Here, we’re looking at users with the name Tom. We’re only interested in those -with more than 42 repositories, and only if they have over 1,000 followers.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 20
    -X-RateLimit-Remaining: 19
    - -
    {
    -  "total_count": 12,
    -  "items": [
    -    {
    -      "login": "mojombo",
    -      "id": 1,
    -      "avatar_url": "https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
    -      "gravatar_id": "25c7c18223fb42a4c6ae1c8db6f50f9b",
    -      "url": "https://api.github.com/users/mojombo",
    -      "html_url": "https://github.com/mojombo",
    -      "followers_url": "https://api.github.com/users/mojombo/followers",
    -      "subscriptions_url": "https://api.github.com/users/mojombo/subscriptions",
    -      "organizations_url": "https://api.github.com/users/mojombo/orgs",
    -      "repos_url": "https://api.github.com/users/mojombo/repos",
    -      "received_events_url": "https://api.github.com/users/mojombo/received_events",
    -      "type": "User",
    -      "score": 105.47857
    -    }
    -  ]
    -}
    - -

    Highlighting User Search Results

    - -

    Some API consumers will want to highlight the matching search terms when -displaying search results. The API offers additional metadata to support this -use case. To get this metadata in your search results, specify the text-match -media type in your Accept header. For example, via curl, the above query would -look like this:

    - -
    curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -  https://api.github.com/search/users?q=tom+repos:%3E42+followers:%3E1000
    -
    - -

    This produces the same JSON payload as above, with an extra key called -text_matches, an array of objects. These objects provide information such as -the position of your search terms within the text, as well as the property that -included the search term.

    - -

    When searching for users, you can get text match metadata for the issue -login, email, and name fields. (See the section on text match -metadata for full details.)

    - -
    {
    -  "text_matches": [
    -    {
    -      "object_url": "https://api.github.com/users/mojombo",
    -      "object_type": "User",
    -      "property": "email",
    -      "fragment": "tom@github.com",
    -      "matches": [
    -        {
    -          "text": "tom",
    -          "indices": [
    -            0,
    -            3
    -          ]
    -        }
    -      ]
    -    },
    -    {
    -      "object_url": "https://api.github.com/users/mojombo",
    -      "object_type": "User",
    -      "property": "name",
    -      "fragment": "Tom Preston-Werner",
    -      "matches": [
    -        {
    -          "text": "Tom",
    -          "indices": [
    -            0,
    -            3
    -          ]
    -        }
    -      ]
    -    }
    -  ]
    -}
    - -

    Text match metadata

    - -

    On github.com, we enjoy the context provided by code snippets and highlights in -search results.

    - -

    code-snippet-highlighting

    - -

    API consumers have access to that information as well. Requests can opt to -receive those text fragments in the response, and every fragment is accompanied -by numeric offsets identifying the exact location of each matching search term.

    - -

    To get this metadata in your search results, specify the text-match media type -in your Accept header.

    - -
    application/vnd.github.v3.text-match+json
    -
    - -

    The results will provide the same JSON payloads as shown above, with an extra -key called text_matches. Inside the text_matches array, each hash includes -the following attributes:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    object_urlThe URL for the resource that contains a string property matching one of the search terms.
    object_typeThe name for the type of resource that exists at the given object_url.
    propertyThe name of a property of the resource that exists at object_url. That property is a string that matches one of the search terms. (In the JSON returned from object_url, the full content for the fragment will be found in the property with this name.)
    fragmentA subset of the value of property. This is the text fragment that matches one or more of the search terms.
    matchesAn array of one or more search terms that are present in fragment. The indices (i.e., “offsets”) are relative to the fragment. (They are not relative to the full content of property.)
    - -

    Example

    - -

    Using curl, and the example issue search above, our API -request would look like this:

    - -
    curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -  https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc
    -
    - -

    The response will include a text_matches array for each search result. In the -JSON below, we have two objects in the text_matches array.

    - -

    The first text match occurred in the body property of the issue. We see a -fragment of text from the issue body. The search term (windows) appears twice -within that fragment, and we have the indices for each occurrence.

    - -

    The second text match occurred in the body property of one of the issue’s -comments. We have the URL for the issue comment. And of course, we see a -fragment of text from the comment body. The search term (windows) appears once -within that fragment.

    - -
    {
    -  "text_matches": [
    -    {
    -      "object_url": "https://api.github.com/repositories/215335/issues/132",
    -      "object_type": "Issue",
    -      "property": "body",
    -      "fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n",
    -      "matches": [
    -        {
    -          "text": "windows",
    -          "indices": [
    -            14,
    -            21
    -          ]
    -        },
    -        {
    -          "text": "windows",
    -          "indices": [
    -            78,
    -            85
    -          ]
    -        }
    -      ]
    -    },
    -    {
    -      "object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
    -      "object_type": "IssueComment",
    -      "property": "body",
    -      "fragment": " right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n",
    -      "matches": [
    -        {
    -          "text": "Windows",
    -          "indices": [
    -            163,
    -            170
    -          ]
    -        }
    -      ]
    -    }
    -  ]
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/search/legacy/index.html b/v3/search/legacy/index.html deleted file mode 100644 index e82e12f2cc..0000000000 --- a/v3/search/legacy/index.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - - - - - Legacy Search | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Legacy Search

    - - - -

    This is a listing of the Legacy Search API features from API v2 that have been ported to API -v3. There should be no changes, other than the new URL and JSON output format.

    - -

    Legacy Search API is Deprecated

    - -
    -

    - The Legacy Search API (described below) is deprecated - and is scheduled for removal in the next major version of the API. - - We recommend using the v3 Search API instead. - It contains new endpoints and much more functionality. -

    -
    - -

    Search issues

    - -

    Find issues by state and keyword.

    - -
    GET /legacy/issues/search/:owner/:repository/:state/:keyword
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    statestringIndicates the state of the issues to return. Can be either open or closed.
    keywordstringThe search term.
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "issues": [
    -    {
    -      "gravatar_id": "4c3d600867886124a73f14a907b1a955",
    -      "position": 10,
    -      "number": 10,
    -      "votes": 2,
    -      "created_at": "2010-06-04T23:20:33Z",
    -      "comments": 5,
    -      "body": "Issue body goes here",
    -      "title": "This is is the issue title",
    -      "updated_at": "2010-06-04T23:20:33Z",
    -      "html_url": "https://github.com/pengwynn/linkedin/issues/10",
    -      "user": "ckarbass",
    -      "labels": [
    -        "api",
    -        "feature request",
    -        "investigation"
    -      ],
    -      "state": "open"
    -    }
    -  ]
    -}
    - -

    Search repositories

    - -

    Find repositories by keyword. Note, this legacy method does not follow the -v3 pagination pattern. This method returns up to 100 results per page and -pages can be fetched using the start_page parameter.

    - -
    GET /legacy/repos/search/:keyword
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    keywordstringThe search term
    languagestringFilter results by language -
    start_pagestringThe page number to fetch
    sortstringThe sort field. One of stars, forks, or updated. Default: results are sorted by best match.
    orderstringThe sort field. if sort param is provided. Can be either asc or desc.
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "repositories": [
    -    {
    -      "type": "repo",
    -      "created": "2011-09-05T11:07:54Z",
    -      "watchers": 2913,
    -      "has_downloads": true,
    -      "username": "mathiasbynens",
    -      "homepage": "http://mths.be/dotfiles",
    -      "url": "https://github.com/mathiasbynens/dotfiles",
    -      "fork": false,
    -      "has_issues": true,
    -      "has_wiki": false,
    -      "forks": 520,
    -      "size": 192,
    -      "private": false,
    -      "followers": 2913,
    -      "name": "dotfiles",
    -      "owner": "mathiasbynens",
    -      "open_issues": 12,
    -      "pushed_at": "2012-06-05T03:37:13Z",
    -      "score": 3.289718,
    -      "pushed": "2012-06-05T03:37:13Z",
    -      "description": "sensible hacker defaults for OS X",
    -      "language": "VimL",
    -      "created_at": "2011-09-05T11:07:54Z"
    -    }
    -  ]
    -}
    - -

    Search users

    - -

    Find users by keyword.

    - -
    GET /legacy/user/search/:keyword
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    keywordstringThe search term
    start_pagestringThe page number to fetch
    sortstringThe sort field. One of stars, forks, or updated. Default: results are sorted by best match.
    orderstringThe sort field. if sort param is provided. Can be either asc or desc.
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "users": [
    -    {
    -      "gravatar_id": "70889091349f7598bce9afa588034310",
    -      "name": "Hirotaka Kawata",
    -      "created_at": "2009-10-05T01:32:06Z",
    -      "location": "Tsukuba, Ibaraki, Japan",
    -      "public_repo_count": 8,
    -      "followers": 10,
    -      "language": "Python",
    -      "fullname": "Hirotaka Kawata",
    -      "username": "techno",
    -      "id": "user-135050",
    -      "repos": 8,
    -      "type": "user",
    -      "followers_count": 10,
    -      "login": "techno",
    -      "score": 4.2559967,
    -      "created": "2009-10-05T01:32:06Z"
    -    }
    -  ]
    -}
    - - - -

    This API call is added for compatibility reasons only. There’s no guarantee -that full email searches will always be available. The @ character in the -address must be left unencoded. Searches only against public email addresses -(as configured on the user’s GitHub profile).

    - -
    GET /legacy/user/email/:email
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    emailstringThe email address
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "user": {
    -    "public_repo_count": 2,
    -    "public_gist_count": 1,
    -    "followers_count": 20,
    -    "following_count": 0,
    -    "created": "2009-10-05T01:32:06Z",
    -    "created_at": "2009-10-05T01:32:06Z",
    -    "name": "monalisa octocat",
    -    "company": "GitHub",
    -    "blog": "https://github.com/blog",
    -    "location": "San Francisco",
    -    "email": "octocat@github.com",
    -    "id": 2,
    -    "login": "octocat",
    -    "type": "User",
    -    "gravatar_id": "70889091349f7598bce9afa588034310"
    -  }
    -}
    - -
    - - - -
    - - - - - - - - diff --git a/v3/troubleshooting/index.html b/v3/troubleshooting/index.html deleted file mode 100644 index 453b7c4962..0000000000 --- a/v3/troubleshooting/index.html +++ /dev/null @@ -1,278 +0,0 @@ - - - - - - - - Troubleshooting | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Troubleshooting

    - - - -

    If you’re encountering some oddities in the API, here’s a list of resolutions to -some of the problems you may be experiencing.

    - -

    Why am I getting a 404 error on a repository that exists?

    - -

    Typically, we send a 404 error when your client isn’t properly authenticated. -You might expect to see a 403 Forbidden in these cases. However, since we don’t -want to provide any information about private repositories, the API returns a -404 error instead.

    - -

    To fix this, you can either ensure that you’re authenticating correctly, -or make sure that your scopes are valid.

    - -

    Why am I not seeing all my results?

    - -

    Most API calls accessing a list of resources (e.g., users, issues, e.t.c.) support -pagination. If you’re making requests and receiving an incomplete set of results, you’re -probably only seeing the first page. You’ll need to request the remaining pages -in order to get more results.

    - -

    It’s important to not try and guess the format of the pagination URL. Not every -API call uses the same structure. Instead, extract the pagination information from -the Link Header, which is sent with every request.

    - -

    Can I get my rate limits bumped?

    - -

    The GitHub API has a pretty lenient quota for rate limits, for your enjoyment and -our safety. You can read more about it here.

    - -

    If you’re using OAuth or Basic Authentication and are hitting your rate limits, -you might be able to fix the issue by either caching our results, or using conditional requests.

    - -

    In certain exceptional cases, we may temporarily bump your rate limit higher. You -should be prepared to answer technical questions about your goal and your planned usage of the API. We may still choose not to bump your limit if we feel that you can achieve your wildest -dreams with the current rate limit (but don’t worry, we’ll help you out).

    - -

    Why can’t my server with SSL receive WebHooks?

    - -

    When we send events to your server, we attempt to negotiate either SSL version 2 or 3. -If your server requires a specific SSL version and does not support SSL negotiation, -you can specify a specific version within the WebHook’s config block. Include a parameter called ssl_version, with a value of either 2 or 3.

    - -
    - - - -
    - - - - - - - - diff --git a/v3/users/emails/index.html b/v3/users/emails/index.html deleted file mode 100644 index 7cd0fbe15f..0000000000 --- a/v3/users/emails/index.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - - - User Emails | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Emails

    - - - -

    Management of email addresses via the API requires that you are -authenticated through basic auth or OAuth with the user scope.

    - -

    List email addresses for a user

    - -
    GET /user/emails
    -
    - -

    This endpoint is accessible with the user:email scope.

    - -

    Response

    - -
    -

    - Deprecated: This response format is deprecated. - The API will remove support for this response format in the future. -

    -

    - We recommend that you start requesting the new response format as described - in the Future Response section below. -

    -
    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  "octocat@github.com",
    -  "support@github.com"
    -]
    -


    - -

    Future Response

    - -

    In the final version of the API, this method will return an array of hashes -with extended information for each email address indicating if the address has -been verified and if it’s the user’s primary email address for GitHub.

    - -

    Until API v3 is finalized, use the application/vnd.github.v3 -media type to get this response format.

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "email": "octocat@github.com",
    -    "verified": true,
    -    "primary": true
    -  }
    -]
    - -

    Add email address(es)

    - -
    POST /user/emails
    -
    - -

    Input

    - -

    You can post a single email address or an array of addresses:

    - -
    [
    -  "octocat@github.com",
    -  "support@github.com"
    -]
    - -

    Response

    - -
    Status: 201 Created
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  "octocat@github.com",
    -  "support@github.com"
    -]
    - -

    Delete email address(es)

    - -
    DELETE /user/emails
    -
    - -

    Input

    - -

    You can include a single email address or an array of addresses:

    - -
    [
    -  "octocat@github.com",
    -  "support@github.com"
    -]
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - - -
    - - - -
    - - - - - - - - diff --git a/v3/users/followers/index.html b/v3/users/followers/index.html deleted file mode 100644 index 1060c6e007..0000000000 --- a/v3/users/followers/index.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - - - - - User Followers | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Followers

    - - - -

    List followers of a user

    - -

    List a user’s followers:

    - -
    GET /users/:user/followers
    -
    - -

    List the authenticated user’s followers:

    - -
    GET /user/followers
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    List users followed by another user

    - -

    List who a user is following:

    - -
    GET /users/:user/following
    -
    - -

    List who the authenticated user is following:

    - -
    GET /user/following
    -
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/resource?page=2>; rel="next",
    -      <https://api.github.com/resource?page=5>; rel="last"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -

    Check if you are following a user

    - -
    GET /user/following/:user
    -
    - -

    Response if you are following this user

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if you are not following this user

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Check if one user follows another

    - -
    GET /users/:user/following/:target_user
    -
    - -

    Response if user follows target user

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Response if user does not follow target user

    - -
    Status: 404 Not Found
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Follow a user

    - -
    PUT /user/following/:user
    -
    - -

    Following a user requires the user to be logged in and authenticated with basic -auth or OAuth with the user:follow scope.

    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -

    Unfollow a user

    - -
    DELETE /user/following/:user
    -
    - -

    Unfollowing a user requires the user to be logged in and authenticated with basic -auth or OAuth with the user:follow scope.

    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/users/index.html b/v3/users/index.html deleted file mode 100644 index 4e38c1f630..0000000000 --- a/v3/users/index.html +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - - - Users | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Users

    - - - -

    Many of the resources on the users API provide a shortcut for getting -information about the currently authenticated user. If a request URL -does not include a :user parameter then the response will be for the -logged in user (and you must pass authentication -information with your request).

    - -

    Get a single user

    - -
    GET /users/:user
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "login": "octocat",
    -  "id": 1,
    -  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -  "gravatar_id": "somehexcode",
    -  "url": "https://api.github.com/users/octocat",
    -  "html_url": "https://github.com/octocat",
    -  "followers_url": "https://api.github.com/users/octocat/followers",
    -  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -  "organizations_url": "https://api.github.com/users/octocat/orgs",
    -  "repos_url": "https://api.github.com/users/octocat/repos",
    -  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -  "received_events_url": "https://api.github.com/users/octocat/received_events",
    -  "type": "User",
    -  "site_admin": false,
    -  "name": "monalisa octocat",
    -  "company": "GitHub",
    -  "blog": "https://github.com/blog",
    -  "location": "San Francisco",
    -  "email": "octocat@github.com",
    -  "hireable": false,
    -  "bio": "There once was...",
    -  "public_repos": 2,
    -  "public_gists": 1,
    -  "followers": 20,
    -  "following": 0,
    -  "created_at": "2008-01-14T04:33:35Z",
    -  "updated_at": "2008-01-14T04:33:35Z"
    -}
    - -

    Note: The returned email is the user’s publicly visible email address -(or null if the user has not specified a public email address in their profile).

    - -

    Get the authenticated user

    - -
    GET /user
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "login": "octocat",
    -  "id": 1,
    -  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -  "gravatar_id": "somehexcode",
    -  "url": "https://api.github.com/users/octocat",
    -  "html_url": "https://github.com/octocat",
    -  "followers_url": "https://api.github.com/users/octocat/followers",
    -  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -  "organizations_url": "https://api.github.com/users/octocat/orgs",
    -  "repos_url": "https://api.github.com/users/octocat/repos",
    -  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -  "received_events_url": "https://api.github.com/users/octocat/received_events",
    -  "type": "User",
    -  "site_admin": false,
    -  "name": "monalisa octocat",
    -  "company": "GitHub",
    -  "blog": "https://github.com/blog",
    -  "location": "San Francisco",
    -  "email": "octocat@github.com",
    -  "hireable": false,
    -  "bio": "There once was...",
    -  "public_repos": 2,
    -  "public_gists": 1,
    -  "followers": 20,
    -  "following": 0,
    -  "created_at": "2008-01-14T04:33:35Z",
    -  "updated_at": "2008-01-14T04:33:35Z",
    -  "total_private_repos": 100,
    -  "owned_private_repos": 100,
    -  "private_gists": 81,
    -  "disk_usage": 10000,
    -  "collaborators": 8,
    -  "plan": {
    -    "name": "Medium",
    -    "space": 400,
    -    "collaborators": 10,
    -    "private_repos": 20
    -  }
    -}
    - -

    Update the authenticated user

    - -
    PATCH /user
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    namestringThe new name of the user
    emailstringPublicly visible email address.
    blogstringThe new blog URL of the user.
    companystringThe new company of the user.
    locationstringThe new location of the user.
    hireablebooleanThe new hiring availability of the user.
    biostringThe new short biography of the user.
    - -

    Example

    - -
    {
    -  "name": "monalisa octocat",
    -  "email": "octocat@github.com",
    -  "blog": "https://github.com/blog",
    -  "company": "GitHub",
    -  "location": "San Francisco",
    -  "hireable": true,
    -  "bio": "There once..."
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "login": "octocat",
    -  "id": 1,
    -  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -  "gravatar_id": "somehexcode",
    -  "url": "https://api.github.com/users/octocat",
    -  "html_url": "https://github.com/octocat",
    -  "followers_url": "https://api.github.com/users/octocat/followers",
    -  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -  "organizations_url": "https://api.github.com/users/octocat/orgs",
    -  "repos_url": "https://api.github.com/users/octocat/repos",
    -  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -  "received_events_url": "https://api.github.com/users/octocat/received_events",
    -  "type": "User",
    -  "site_admin": false,
    -  "name": "monalisa octocat",
    -  "company": "GitHub",
    -  "blog": "https://github.com/blog",
    -  "location": "San Francisco",
    -  "email": "octocat@github.com",
    -  "hireable": false,
    -  "bio": "There once was...",
    -  "public_repos": 2,
    -  "public_gists": 1,
    -  "followers": 20,
    -  "following": 0,
    -  "created_at": "2008-01-14T04:33:35Z",
    -  "updated_at": "2008-01-14T04:33:35Z",
    -  "total_private_repos": 100,
    -  "owned_private_repos": 100,
    -  "private_gists": 81,
    -  "disk_usage": 10000,
    -  "collaborators": 8,
    -  "plan": {
    -    "name": "Medium",
    -    "space": 400,
    -    "collaborators": 10,
    -    "private_repos": 20
    -  }
    -}
    - -

    Get all users

    - -

    This provides a dump of every user, in the order that they signed up for -GitHub.

    - -

    Note: Pagination is powered exclusively by the since parameter. -Use the Link header to get the URL for the next page of -users.

    - -
    GET /users
    -
    - -

    Parameters

    - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sincestringThe integer ID of the last User that you’ve seen.
    - -

    Response

    - -
    Status: 200 OK
    -Link: <https://api.github.com/users?since=135>; rel="next"
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "login": "octocat",
    -    "id": 1,
    -    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    -    "gravatar_id": "somehexcode",
    -    "url": "https://api.github.com/users/octocat",
    -    "html_url": "https://github.com/octocat",
    -    "followers_url": "https://api.github.com/users/octocat/followers",
    -    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    -    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    -    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    -    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    -    "organizations_url": "https://api.github.com/users/octocat/orgs",
    -    "repos_url": "https://api.github.com/users/octocat/repos",
    -    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    -    "received_events_url": "https://api.github.com/users/octocat/received_events",
    -    "type": "User",
    -    "site_admin": false
    -  }
    -]
    - -
    - - - -
    - - - - - - - - diff --git a/v3/users/keys/index.html b/v3/users/keys/index.html deleted file mode 100644 index ba67a8aa51..0000000000 --- a/v3/users/keys/index.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - User Public Keys | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Public Keys

    - - - -

    List public keys for a user

    - -
    GET /users/:user/keys
    -
    - -

    Lists the verified public keys for a user. This is accessible by anyone.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "key": "ssh-rsa AAA..."
    -  }
    -]
    - -

    List your public keys

    - -
    GET /user/keys
    -
    - -

    Lists the current user’s keys. Management of public keys via the API requires -that you are authenticated through basic auth, or OAuth with the ‘user’ scope.

    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    [
    -  {
    -    "id": 1,
    -    "key": "ssh-rsa AAA...",
    -    "url": "https://api.github.com/user/keys/1",
    -    "title": "octocat@octomac"
    -  }
    -]
    - -

    Get a single public key

    - -
    GET /user/keys/:id
    -
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Create a public key

    - -
    POST /user/keys
    -
    - -

    Input

    - -
    {
    -  "title": "octocat@octomac",
    -  "key": "ssh-rsa AAA..."
    -}
    - -

    Response

    - -
    Status: 201 Created
    -Location: https://api.github.com/user/keys/1
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Update a public key

    - -
    PATCH /user/keys/:id
    -
    - -

    Input

    - -
    {
    -  "title": "octocat@octomac",
    -  "key": "ssh-rsa AAA..."
    -}
    - -

    Response

    - -
    Status: 200 OK
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    {
    -  "id": 1,
    -  "key": "ssh-rsa AAA...",
    -  "url": "https://api.github.com/user/keys/1",
    -  "title": "octocat@octomac"
    -}
    - -

    Delete a public key

    - -
    DELETE /user/keys/:id
    -
    - -

    Response

    - -
    Status: 204 No Content
    -X-RateLimit-Limit: 5000
    -X-RateLimit-Remaining: 4999
    - -
    - - - -
    - - - - - - - - diff --git a/v3/versions/index.html b/v3/versions/index.html deleted file mode 100644 index aaed8fb04d..0000000000 --- a/v3/versions/index.html +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - - - Versions | GitHub API - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    Versions

    - -

    There are two stable versions of the GitHub API: beta and v3. There are just a few differences between these two versions.

    - -

    By default, all requests receive the beta version. Soon, v3 will become the default version. (Check out the blog post for details.) We encourage you to request a specific version via the Accept header.

    - -

    v3

    - -

    The v3 API is stable and unchangeable. Please file a support issue if you have problems.

    - -

    Some v3 functionality is deprecated and will be removed in the next major version of the API.

    - -

    Differences from beta version

    - -

    The v3 media type differs from the beta media type in just a few places:

    - -

    Gist JSON

    - -

    For Gists, the v3 media type renames the user attribute to owner.

    - -

    Issue JSON

    - -

    When an issue is not a pull request, the v3 media type omits the pull_request attribute.

    - -

    Repository JSON

    - -

    For Repositories, the v3 media type omits the master_branch attribute. API clients should use the default_branch attribute to obtain the repository’s default branch.

    - -

    User Emails JSON

    - -

    For User Emails, the v3 media type returns an array of hashes (instead of an array of strings).

    - -

    v3 deprecations

    - -

    The following functionality is deprecated. For backwards compatibility purposes, -v3 will continue to provide this functionality. However, this deprecated -functionality will be removed in the next major version of the API.

    - -

    The recommendations below will help you prepare your application for the next major version of the API.

    - -
      -
    1. -
      -
      Method: /gists/:id/fork
      -
      Recommendation: Use /gists/:id/forks (plural) instead.
      -
      -
    2. -
    3. -
      -
      Method: /legacy/issues/search/:owner/:repository/:state/:keyword
      -
      Recommendation: Use v3 Issue Search API instead.
      -
      -
    4. -
    5. -
      -
      Method: /legacy/repos/search/:keyword
      -
      Recommendation: Use v3 Repository Search API instead.
      -
      -
    6. -
    7. -
      -
      Method: /legacy/user/search/:keyword
      -
      Recommendation: Use v3 User Search API instead.
      -
      -
    8. -
    9. -
      -
      Method: /legacy/user/email/:email
      -
      Recommendation: Use v3 User Search API instead.
      -
      -
    10. -
    11. -
      -
      Method: /repos/:owner/:repo/hooks/:id/test
      -
      Recommendation: Use /repos/:owner/:repo/hooks/:id/tests (plural) instead.
      -
      -
    12. -
    13. -
      -
      Query parameters when POSTing to /repos/:owner/:repo/forks
      -
      Recommendation: Use JSON to POST to this method instead.
      -
      -
    14. -
    15. -
      -
      Query parameter value: Passing “watchers” as the value for the “sort” parameter in a GET request to /repos/:owner/:repo/forks
      -
      Recommendation: Use stargazers as the value instead.
      -
      -
    16. -
    17. -
      -
      Pull Request attribute: merge_commit_sha
      -
      Recommendation: Do not use this attribute.
      -
      -
    18. -
    19. -
      -
      Rate Limit attribute: rate
      -
      Recommendation: Use resources[“core”] instead.
      -
      -
    20. -
    21. -
      -
      Repository attribute: forks
      -
      Recommendation: Use fork_count instead.
      -
      -
    22. -
    23. -
      -
      Repository attribute: master_branch
      -
      Recommendation: Use default_branch instead.
      -
      -
    24. -
    25. -
      -
      Repository attribute: open_issues
      -
      Recommendation: Use open_issues_count instead.
      -
      -
    26. -
    27. -
      -
      Repository attribute: public
      -
      Recommendation: When creating a repository, use the -private attribute to indicate whether the repository should be public or -private. Do not use the public attribute.
      -
      -
    28. -
    29. -
      -
      Repository attribute: watchers
      -
      Recommendation: Use watchers_count instead.
      -
      -
    30. -
    31. -
      -
      User attribute: bio
      -
      Recommendation: Do not use this attribute. It is obsolete.
      -
      -
    32. -
    - -

    beta

    - -

    The beta API is now stable and unchangeable. Please file a support issue if you have problems.

    - -

    Starting April 15, 2014, the beta version will no longer be the default version. However, we expect to continue supporting the beta version for a while. We will eventually retire the beta version, but we have no official retirement date to annouce at the moment. When the time comes, rest assured that we’ll announce the retirement with plenty of notice.

    - -

    Breaking beta changes

    - -

    June 15th, 2011:

    - -
      -
    • -gravatar_url is being deprecated in favor of avatar_url for all -responses that include users or orgs. A default size is no longer -included in the URL.
    • -
    • Creating new gists (both anonymously and with an authenticated user) -should use POST /gists from now on. POST /users/:user/gists is no -longer supported.
    • -
    - -

    June 1st, 2011:

    - -
      -
    • Removed support for PUT verb on update requests. Use POST or PATCH -instead.
    • -
    • Removed .json extension from all URLs.
    • -
    • No longer using the X-Next or X-Last headers. Pagination info is -returned in the Link header instead.
    • -
    • JSON-P response has completely changed to a more consistent format.
    • -
    • Starring gists now uses PUT verb (instead of POST) and returns 204.
    • -
    - -

    v2

    - -

    We removed support for API v2 on June 12, 2012.

    - -

    v1

    - -

    We removed support for API v1 on June 12, 2012.

    - - -
    - - - -
    - - - - - - - -