Skip to content

Commit

Permalink
adding history, license and working through readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mckelvey committed Apr 7, 2011
1 parent 3a276ef commit 37a32af
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

0.0.1 / 2011-04-07
==================

* Initial release
15 changes: 15 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

## License

(The MIT X License)

Copyright (c) 2011 David W. McKelvey <david@mckelveycreative.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

## What It Is

The Instagram Node Lib is a helper library for [node](http://nodejs.org) that makes communicating with the [Instagram API](http://instagram.com/developer/) easy.

## Simple Example

Following is an example that loads the library, sets my CLIENT_ID and CLIENT_SECRET for accessing the API and makes a simple call to get information on the tag `#blue`.

Instagram = require('instagram');

Instagram.API.set('client_id', 'YOUR-CLIENT-ID');
Instagram.API.set('client_secret', 'YOUR-CLIENT-SECRET');

Instagram.API.tags.info({
name: 'blue',
complete: function(data){
console.log(data);
}
});

When successful, the data logged in the console would be a javascript object like `{ media_count: 10863, name: 'blue' }`.

## Installation

$ npm install instagram

## Setup

To use the library, you'll need to require it and at minimum, set your CLIENT_ID and CLIENT_SECRET given to you by Instagram.

Instagram = require('instagram');

Instagram.API.set('client_id', 'YOUR-CLIENT-ID');
Instagram.API.set('client_secret', 'YOUR-CLIENT-SECRET');

Optionally, if you intend to use the real-time API to manage subscriptions, then you can also set a global callback url. (You may also provide/override the callback url when subscribing.)

Instagram.API.set('callback_url', 'http://your.callback/path');

## Available Methods

_The methods currently available are limited to those available for non-user-specific interaction (i.e. anything that does not require authentication and an access_token). Look for those in future releases._

All of the methods below follow a similar pattern and stem directly from the API. All methods accept a single javascript object with the needed parameters to complete the API call ([use the API docs for those](http://instagram.com/developer/endpoints/)), plus the addition of a function to execute upon successful completion (i.e. `complete`) or an error function, should it fail (i.e. `error`).

{
name: 'blue',
complete: function(data){
// data is a javascript object/array/null matching that shipped Instagram
},
error: function(errorMessage, errorObject, caller){
// errorMessage is the raised error message
// errorObject is either the object that caused the issue, or the nearest neighbor
// caller is the method in which the error occurred
}
}

In the event you do not provide a `complete` or `error` function, the library has fallback functions which simply post results to the console log.

# Tags

The following basic tag methods are available. Required parameters are shown below, see the [Instagram API docs](http://instagram.com/developer/endpoints/tags/) for the optional parameters.

Instagram.API.tags.info({ name: 'blue' });
-> { media_count: 10863, name: 'blue' }

Instagram.API.tags.recent({ name: 'blue' });
-> [ {media object},
{media object},
{media object}, ... ]

Instagram.API.tags.search({ q: 'blue' });
-> [ { media_count: 10872, name: 'blue' },
{ media_count: 931, name: 'bluesky' },
{ media_count: 178, name: 'blueeyes' }, ... ]

Subscriptions for tags are also available with the following methods. A `callback_url` is required if not specified globally, and you may also provide a `verify_token` if you want to keep track of which subscription is coming back.

Instagram.API.tags.subscribe({ object_id: 'blue' });
-> {}

Instagram.API.tags.unsubscribe({ subscription_id: 3678 });
-> null


## Developers

0 comments on commit 37a32af

Please sign in to comment.