From ac75b693d580407adeb230e489b50f93d7a88c04 Mon Sep 17 00:00:00 2001 From: Ryunosuke SATO Date: Fri, 28 Jun 2013 02:09:48 +0900 Subject: [PATCH] Support Repo Hooks API see: http://developer.github.com/v3/repos/hooks/ --- github.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/github.js b/github.js index 2fd811f0..5dd9f45a 100644 --- a/github.js +++ b/github.js @@ -363,6 +363,41 @@ _request("POST", repoPath + "/pulls", options, cb); }; + // List hooks + // -------- + + this.listHooks = function(cb) { + _request("GET", repoPath + "/hooks", null, cb); + }; + + // Get a hook + // -------- + + this.getHook = function(id, cb) { + _request("GET", repoPath + "/hooks/" + id, null, cb); + }; + + // Create a hook + // -------- + + this.createHook = function(options, cb) { + _request("POST", repoPath + "/hooks", options, cb); + }; + + // Edit a hook + // -------- + + this.editHook = function(id, options, cb) { + _request("PATCH", repoPath + "/hooks/" + id, options, cb); + }; + + // Delete a hook + // -------- + + this.deleteHook = function(id, cb) { + _request("DELETE", repoPath + "/hooks/" + id, null, cb); + }; + // Read file at given path // -------