Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #69 from troupe/master

Added subscriptions (watch list) for the Me class
  • Loading branch information...
commit b9dbed441dc26ea0546c67ba1d6faa9558f5e3aa 2 parents 8db9c60 + 8356014
@pksunkara authored
Showing with 23 additions and 1 deletion.
  1. +13 −0 lib/octonode/me.js
  2. +10 −1 src/octonode/me.coffee
View
13 lib/octonode/me.js
@@ -185,6 +185,19 @@
});
};
+ Me.prototype.watched = function(cb) {
+ return this.client.get('/user/subscriptions', function(err, s, b) {
+ if (err) {
+ return cb(err);
+ }
+ if (s !== 200) {
+ return cb(new Error('User subscription error'));
+ } else {
+ return cb(null, b);
+ }
+ });
+ };
+
Me.prototype.keys = function(cbOrIdOrKey, cbOrKey, cb) {
if ((cb == null) && typeof cbOrIdOrKey === 'number' && typeof cbOrKey === 'function') {
return this.getKey(cbOrIdOrKey, cbOrKey);
View
11 src/octonode/me.coffee
@@ -92,7 +92,7 @@ class Me
@client.del "/user/following/#{user}", {}, (err, s, b) =>
@unfollow(user) if err? or s isnt 204
- # Get the followings of the user
+ # Get the starred repos for the user
# '/user/starred' GET
# TODO: page, user
starred: (cbOrUser, cb) ->
@@ -123,6 +123,15 @@ class Me
@client.del "/user/starred/#{repo}", {}, (err, s, b) =>
@unstar(repo) if err? or s isnt 204
+
+ # Get the subscriptions of the user (what she watches)
+ # '/user/subscriptions' GET
+ # TODO: page, user
+ watched: (cb) ->
+ @client.get '/user/subscriptions', (err, s, b) ->
+ return cb(err) if err
+ if s isnt 200 then cb(new Error('User subscription error')) else cb null, b
+
# Get public keys of a user
# '/user/keys' GET
keys: (cbOrIdOrKey, cbOrKey, cb) ->
Please sign in to comment.
Something went wrong with that request. Please try again.