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

Added Users API Endpoint (documentation) #2

Merged
merged 2 commits into from
Jun 5, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ For example:
// search for a location // search for a location
instagram.tags.search({lat: ..., lng: ..., distance: ...}, function (tags, error) { ... }); instagram.tags.search({lat: ..., lng: ..., distance: ...}, function (tags, error) { ... });



// get info about a specific user
instagram.users.id(1234, function (user, error) { ... });

// get recent media for a user
instagram.users.media(1234, {count: 12}, function (images, error, pagination) { ... });

// getting own media, according to given *access_token* which is a required parameter
instagram.users.self({access_token: "1337", count: 12}, function (images, error, pagination) { ... });

// search for usernames
instagram.users.search("Jack", function (users, error) { ... });
instagram.users.search({q: "John", count: 1}, function (users, error) { ... });


# License # License


Some sort of BSD or MIT license, the general idea being: Some sort of BSD or MIT license, the general idea being:
Expand Down
24 changes: 24 additions & 0 deletions index.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function InstagramClient(client_id, client_secret) {
this.media = new InstagramMediaClient(this); this.media = new InstagramMediaClient(this);
this.tags = new InstagramTagsClient(this); this.tags = new InstagramTagsClient(this);
this.locations = new InstagramLocationsClient(this); this.locations = new InstagramLocationsClient(this);
this.users = new InstagramUsersClient(this);
} }


InstagramClient.prototype.fetch = function (path, params, callback) { InstagramClient.prototype.fetch = function (path, params, callback) {
Expand Down Expand Up @@ -114,7 +115,30 @@ InstagramLocationsClient.prototype.search = function (params, callback) {
this.parent.fetch('/v1/locations/search', params, callback); this.parent.fetch('/v1/locations/search', params, callback);
} }


function InstagramUsersClient (parent) {
this.parent = parent;
}

InstagramUsersClient.prototype.id = function (id, callback) {
this.parent.fetch('/v1/users/'+id, callback);
}

InstagramUsersClient.prototype.media = function (id, params, callback) {
this.parent.fetch('/v1/users/'+id+'/media/recent', params, callback);
}

InstagramUsersClient.prototype.self = function (params, callback) {
this.parent.fetch('/v1/users/self/feed', params, callback);
}


InstagramUsersClient.prototype.search = function (params, callback) {
if (typeof params == "string") {
params = {
q: params
}
}
this.parent.fetch('/v1/users/search/', params, callback);
}


exports.createClient = function (client_id, client_secret) { exports.createClient = function (client_id, client_secret) {
var instagram_client = new InstagramClient(client_id, client_secret); var instagram_client = new InstagramClient(client_id, client_secret);
Expand Down