Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) add user_self method #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/instagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,27 @@ var instagram = function(spec, my) {
}, retry);
};

/**
* Retrieves information about the given user
* @param id string the user id
* @param cb function (err, user, remaining, limit);
*/
user_self = function(cb) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable user_self isn't declared above with the other variable declarations. +1 though!

var retry = function() {
user(cb);
};

call('GET', '/users/self', {}, function(err, result, remaining, limit) {
if(err) {
return handle_error(err, cb, retry);
} else if(result && result.meta && result.meta.code === 200) {
return cb(null, result.data, remaining, limit);
} else {
return handle_error(result, cb, retry);
}
}, retry);
};

/**
* Retrieves the current user feed
* @param options object { count, [opt]
Expand Down Expand Up @@ -1741,6 +1762,7 @@ var instagram = function(spec, my) {
fwk.method(that, 'use', use, _super);

fwk.method(that, 'user', user, _super);
fwk.method(that, 'user_self', user_self, _super);
fwk.method(that, 'user_self_feed', user_self_feed, _super);
fwk.method(that, 'user_media_recent', user_media_recent, _super);
fwk.method(that, 'user_self_media_recent', user_self_media_recent, _super);
Expand Down