Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Commit c4394a5

Browse files
author
Chris Potter
committed
Port functionality of Hooks from Repo's to Orgs.
1 parent 93944cb commit c4394a5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/octonode/org.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,26 @@ class Org
139139
return cb(err) if err
140140
if s isnt 204 then cb(new Error('Org addTeamRepo error')) else cb null, b, h
141141

142+
# List hooks
143+
# '/orgs/pksunkara/hub/hooks' GET
144+
hooks: (cb) ->
145+
@client.get "/orgs/#{@name}/hooks", (err, s, b, h) ->
146+
return cb(err) if (err)
147+
if s isnt 200 then cb(new Error("Repo hooks error")) else cb null, b, h
148+
149+
# Create a hook
150+
# '/orgs/pksunkara/hub/hooks' POST
151+
hook: (hookInfo, cb) ->
152+
@client.post "/orgs/#{@name}/hooks", hookInfo, (err, s, b, h) ->
153+
return cb(err) if err
154+
if s isnt 201 then cb(new Error("Repo createHook error")) else cb null, b, h
155+
156+
# Delete a hook
157+
# '/orgs/pksunkara/hub/hooks/37' DELETE
158+
deleteHook: (id, cb) ->
159+
@client.del "/orgs/#{@name}/hooks/#{id}", {}, (err, s, b, h) ->
160+
return cb(err) if err
161+
if s isnt 204 then cb(new Error("Repo deleteHook error")) else cb null, b, h
162+
142163
# Export module
143164
module.exports = Org

0 commit comments

Comments
 (0)