Permalink
Browse files

repository: implement createFork

  • Loading branch information...
1 parent 5acbbe4 commit 49368cf113c443cb36a2d82f83cc4802f2e7d899 @booo committed Mar 10, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/octonode/repository.coffee
@@ -16,6 +16,11 @@ class Repository
return cb(err) if err
if s isnt expectedStatus then cb(new Error("Repository.#{methodName} error")) else cb null, b
+ _invokePost: (path,body,expectedStatus = 202,methodName,cb) ->
+ @client.post path, body, (err, s, b) ->
+ return cb(err) if err
+ if s isnt expectedStatus then cb(new Error("Repository.#{methodName} error")) else cb null, b
+
# Get a repository
# '/repos/pkumar/hub' GET
info: (cb) ->
@@ -61,5 +66,10 @@ class Repository
getForks: (cb) ->
@_invokeGet "/repos/#{@name}/forks",200,"getForks",cb
+ # Create a fork for a repository
+ # '/repos/pkumar/hub/forks' POST
+ createFork: (cb) ->
+ @_invokePost "/repos/#{@name}/forks",{},202,"createFork",cb
+
# Export module
module.exports = Repository

0 comments on commit 49368cf

Please sign in to comment.