octonode
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var octonode; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var auth, qs, randomstring, request, url; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Client, Gist, HttpError, Issue, Label, Me, Milestone, Notification, Org, Pr, Release, Repo, Search, Team, User, extend, request, url, | ||
var Client, Gist, HttpError, Issue, Label, Me, Milestone, Notification, Org, Pr, Promise, Release, Repo, Search, Team, User, extend, request, url, | ||
extend1 = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
@@ -13,2 +13,4 @@ hasProp = {}.hasOwnProperty, | ||
Promise = require('bluebird'); | ||
Me = require('./me'); | ||
@@ -73,60 +75,101 @@ | ||
Client.prototype.conditional = function(etag) { | ||
this.etag = etag; | ||
return this; | ||
}; | ||
Client.prototype.me = function() { | ||
return new Me(this); | ||
return Promise.promisifyAll(new Me(this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.user = function(name) { | ||
return new User(name, this); | ||
return Promise.promisifyAll(new User(name, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.repo = function(name) { | ||
return new Repo(name, this); | ||
return Promise.promisifyAll(new Repo(name, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.org = function(name) { | ||
return new Org(name, this); | ||
return Promise.promisifyAll(new Org(name, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.gist = function() { | ||
return new Gist(this); | ||
return Promise.promisifyAll(new Gist(this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.team = function(id) { | ||
return new Team(id, this); | ||
return Promise.promisifyAll(new Team(id, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.pr = function(repo, number) { | ||
return new Pr(repo, number, this); | ||
return Promise.promisifyAll(new Pr(repo, number, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.release = function(repo, number) { | ||
return new Release(repo, number, this); | ||
return Promise.promisifyAll(new Release(repo, number, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.search = function() { | ||
return new Search(this); | ||
return Promise.promisifyAll(new Search(this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.issue = function(repo, number) { | ||
return new Issue(repo, number, this); | ||
return Promise.promisifyAll(new Issue(repo, number, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.project = function(repo, number) { | ||
return new Project(repo, number, this); | ||
return Promise.promisifyAll(new Project(repo, number, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.milestone = function(repo, number) { | ||
return new Milestone(repo, number, this); | ||
return Promise.promisifyAll(new Milestone(repo, number, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.label = function(repo, name) { | ||
return new Label(repo, name, this); | ||
return Promise.promisifyAll(new Label(repo, name, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.notification = function(id) { | ||
return new Notification(id, this); | ||
return Promise.promisifyAll(new Notification(id, this), { | ||
multiArgs: true | ||
}); | ||
}; | ||
Client.prototype.requestOptions = function(params1, params2) { | ||
return extend(this.requestDefaults, params1, params2); | ||
var params3; | ||
params3 = {}; | ||
if (this.etag) { | ||
params3.headers = { | ||
'If-None-Match': this.etag | ||
}; | ||
this.etag = null; | ||
} | ||
return extend(this.requestDefaults, params1, params2, params3); | ||
}; | ||
@@ -365,9 +408,11 @@ | ||
token = arguments[0], credentials = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return (function(func, args, ctor) { | ||
return Promise.promisifyAll((function(func, args, ctor) { | ||
ctor.prototype = func.prototype; | ||
var child = new ctor, result = func.apply(child, args); | ||
return Object(result) === result ? result : child; | ||
})(Client, [token].concat(slice.call(credentials)), function(){}); | ||
})(Client, [token].concat(slice.call(credentials)), function(){}), { | ||
multiArgs: true | ||
}); | ||
}; | ||
}).call(this); |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Gist, | ||
var Base, Gist, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Gist = (function() { | ||
Base = require('./base'); | ||
Gist = (function(superClass) { | ||
extend(Gist, superClass); | ||
function Gist(client) { | ||
@@ -258,3 +264,3 @@ this.client = client; | ||
})(); | ||
})(Base); | ||
@@ -261,0 +267,0 @@ module.exports = Gist; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Issue, | ||
var Base, Issue, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Issue = (function() { | ||
Base = require('./base'); | ||
Issue = (function(superClass) { | ||
extend(Issue, superClass); | ||
function Issue(repo, number, client) { | ||
@@ -170,3 +176,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -173,0 +179,0 @@ module.exports = Issue; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Label; | ||
var Base, Label, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Label = (function() { | ||
Base = require('./base'); | ||
Label = (function(superClass) { | ||
extend(Label, superClass); | ||
function Label(repo, name, client) { | ||
@@ -53,3 +59,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -56,0 +62,0 @@ module.exports = Label; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Me, | ||
var Base, Me, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Me = (function() { | ||
Base = require('./base'); | ||
Me = (function(superClass) { | ||
extend(Me, superClass); | ||
function Me(client) { | ||
@@ -498,3 +504,3 @@ this.client = client; | ||
})(); | ||
})(Base); | ||
@@ -501,0 +507,0 @@ module.exports = Me; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Milestone; | ||
var Base, Milestone, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Milestone = (function() { | ||
Base = require('./base'); | ||
Milestone = (function(superClass) { | ||
extend(Milestone, superClass); | ||
function Milestone(repo, number, client) { | ||
@@ -53,3 +59,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -56,0 +62,0 @@ module.exports = Milestone; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Notification; | ||
var Base, Notification, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Notification = (function() { | ||
Base = require('./base'); | ||
Notification = (function(superClass) { | ||
extend(Notification, superClass); | ||
function Notification(id, client) { | ||
@@ -75,3 +81,3 @@ this.id = id; | ||
})(); | ||
})(Base); | ||
@@ -78,0 +84,0 @@ module.exports = Notification; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Org, | ||
var Base, Org, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Org = (function() { | ||
Base = require('./base'); | ||
Org = (function(superClass) { | ||
extend(Org, superClass); | ||
function Org(name, client) { | ||
@@ -274,3 +280,3 @@ this.name = name; | ||
})(); | ||
})(Base); | ||
@@ -277,0 +283,0 @@ module.exports = Org; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Pr; | ||
var Base, Pr, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Pr = (function() { | ||
Base = require('./base'); | ||
Pr = (function(superClass) { | ||
extend(Pr, superClass); | ||
function Pr(repo, number, client) { | ||
@@ -279,3 +285,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -282,0 +288,0 @@ module.exports = Pr; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Project; | ||
var Base, Project, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Project = (function() { | ||
Base = require('./base'); | ||
Project = (function(superClass) { | ||
extend(Project, superClass); | ||
function Project(repo, number, client) { | ||
@@ -53,3 +59,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -56,0 +62,0 @@ module.exports = Project; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Release; | ||
var Base, Release, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Release = (function() { | ||
Base = require('./base'); | ||
Release = (function(superClass) { | ||
extend(Release, superClass); | ||
function Release(repo, number, client) { | ||
@@ -55,3 +61,3 @@ this.repo = repo; | ||
})(); | ||
})(Base); | ||
@@ -58,0 +64,0 @@ module.exports = Release; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Repo, | ||
var Base, Repo, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Repo = (function() { | ||
Base = require('./base'); | ||
Repo = (function(superClass) { | ||
extend(Repo, superClass); | ||
function Repo(name, client) { | ||
@@ -735,2 +741,15 @@ this.name = name; | ||
Repo.prototype.deleteRef = function(ref, cb) { | ||
return this.client.del("/repos/" + this.name + "/git/refs/" + ref, {}, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 204) { | ||
return cb(new Error("Ref delete error")); | ||
} else { | ||
return cb(null); | ||
} | ||
}); | ||
}; | ||
Repo.prototype.destroy = function(cb) { | ||
@@ -882,3 +901,3 @@ return this.client.del("/repos/" + this.name, {}, function(err, s, b, h) { | ||
})(); | ||
})(Base); | ||
@@ -885,0 +904,0 @@ module.exports = Repo; |
@@ -1,6 +0,12 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Search; | ||
var Base, Search, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
Search = (function() { | ||
Base = require('./base'); | ||
Search = (function(superClass) { | ||
extend(Search, superClass); | ||
function Search(client) { | ||
@@ -64,3 +70,3 @@ this.client = client; | ||
})(); | ||
})(Base); | ||
@@ -67,0 +73,0 @@ module.exports = Search; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var Team, | ||
var Base, Team, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
Team = (function() { | ||
Base = require('./base'); | ||
Team = (function(superClass) { | ||
extend(Team, superClass); | ||
function Team(id, client) { | ||
@@ -190,3 +196,3 @@ this.id = id; | ||
})(); | ||
})(Base); | ||
@@ -193,0 +199,0 @@ module.exports = Team; |
@@ -1,7 +0,13 @@ | ||
// Generated by CoffeeScript 1.12.6 | ||
// Generated by CoffeeScript 1.12.7 | ||
(function() { | ||
var User, | ||
var Base, User, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty, | ||
slice = [].slice; | ||
User = (function() { | ||
Base = require('./base'); | ||
User = (function(superClass) { | ||
extend(User, superClass); | ||
function User(login, client) { | ||
@@ -125,3 +131,3 @@ this.login = login; | ||
})(); | ||
})(Base); | ||
@@ -128,0 +134,0 @@ module.exports = User; |
{ | ||
"name": "octonode", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api", |
@@ -107,3 +107,3 @@ # octonode [![Gitter chat](https://badges.gitter.im/pksunkara/octonode.svg)](https://gitter.im/pksunkara/octonode) | ||
### Proxies | ||
#### Proxies | ||
You can set proxies dynamically by using the example above, but Octonode will respect environment proxies by default. Just set this using: | ||
@@ -114,2 +114,15 @@ `export HTTP_PROXY='https://myproxy.com:1085'` if you are using the command line | ||
## Conditional requests | ||
The client supports conditional requests and helps you respecting rate limits by caching information that hasn't changed. | ||
You can add the `If-None-Match` header to each request calling the `conditional` method. | ||
```js | ||
var client = github.client(); | ||
// This add If-None-Match header to the request | ||
github.repo().conditional('ETAG').issues(); | ||
``` | ||
More info about conditional requests can be founded [here](https://developer.github.com/v3/guides/getting-started/#conditional-requests). | ||
## Authentication | ||
@@ -116,0 +129,0 @@ |
152746
22
3409
1663