Skip to content

Commit

Permalink
Merge pull request #214 from jeffwilcox/add-team-repo-updates
Browse files Browse the repository at this point in the history
Add team repo support for the new granularity of GitHub org mgmt
  • Loading branch information
pksunkara committed Nov 9, 2015
2 parents 0e0807b + 0a7bcce commit 5a1a36d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 11 deletions.
12 changes: 8 additions & 4 deletions lib/octonode/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions lib/octonode/org.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/octonode/client.coffee
Expand Up @@ -200,13 +200,16 @@ class Client
@errorHandle res, body, callback

# Github api PUT request
put: (path, content, callback) ->
put: (path, content, options, callback) ->
if !callback and options
callback = options
options =
'Content-Type': 'application/json'
@request @requestOptions(
uri: @buildUrl path
method: 'PUT'
body: JSON.stringify content
headers:
'Content-Type': 'application/json'
headers: options
), (err, res, body) =>
return callback(err) if err
@errorHandle res, body, callback
Expand Down
14 changes: 12 additions & 2 deletions src/octonode/org.coffee
Expand Up @@ -124,8 +124,18 @@ class Org

# Add an organisation team repository
# '/teams/37/repos/flatiron/hub' PUT
addTeamRepo: (team, repo, cb) ->
@client.put "/teams/#{team}/repos/#{@name}/#{repo}", null, (err, s, b, h) ->
addTeamRepo: (team, repo, cbOrOptions, cb) ->
if !cb? and cbOrOptions
cb = cbOrOptions
param = {}
options =
'Content-Type': 'application/json'
else if typeof cbOrOptions is 'object'
param = cbOrOptions
options =
'Content-Type': 'application/json'
'Accept': 'application/vnd.github.ironman-preview+json'
@client.put "/teams/#{team}/repos/#{@name}/#{repo}", param, options, (err, s, b, h) ->
return cb(err) if err
if s isnt 204 then cb(new Error('Org addTeamRepo error')) else cb null, b, h

Expand Down

0 comments on commit 5a1a36d

Please sign in to comment.