npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

instagram-client

v0.0.2

Published

Instagram API client for node, supports both promises and callbacks

Downloads

4

Readme

Instagram node client

codecov Build Status

Get started

Add instagram-client to your project

npm i instagram-client

Use the instagram client

const Instagram = require("instagram-client").v1
const Client = new Instagram({
    CLIENT_ID: process.env.CLIENT_ID,
    CLIENT_SECRET: process.env.CLIENT_SECRET,
})

API

Classes

const Client = new Instagram({ CLIENT_ID: "SOMECLIENTID", CLIENT_SECRET: "SOMECLIENTSECRET", })

Comments ⇐ Endpoint

Client.comments

// example
Client.comments.create("MEDIAID", {
 text: "some comment",
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

comments.create(id, opts, cb)

Creates a comment for a media by media id

Kind: instance method of Comments

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign, text } | | cb | function | callback called if paseed, otherwise returns a promise |

comments.del(id, opts, cb)

Deletes a comment for a media by media id

Kind: instance method of Comments

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign, text } | | cb | function | callback called if paseed, otherwise returns a promise |

comments.getByMediaID(id, opts, cb)

Get comments for a media by media id

Kind: instance method of Comments

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign, text } | | cb | function | callback called if paseed, otherwise returns a promise |

Likes ⇐ Endpoint

Client.likes

// example
Client.likes.getByMedia("MEDIAID", {
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

likes.getByMedia(id, opts, cb)

Gets likes for a media by media id

Kind: instance method of Likes

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

likes.likeMedia(id, opts, cb)

Like a media by media id with user from accessToken

Kind: instance method of Likes

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

likes.unlikeMedia(id, opts, cb)

Unlike a media by media id with user from accessToken

Kind: instance method of Likes

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

Locations ⇐ Endpoint

Client.locations

// example
Client.locations.getByID("LOCATIONID", {
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

locations.getByID(id, opts, cb)

Gets a location by id

Kind: instance method of Locations

| Param | Type | Description | | --- | --- | --- | | id | string | the location ID | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

locations.getMediaRecent(id, opts, cb)

Gets recent media for location by location id

Kind: instance method of Locations

| Param | Type | Description | | --- | --- | --- | | id | string | the location ID | | opts | object | the options object { accessToken, sign, maxTagID, minTagID } | | cb | function | callback called if paseed, otherwise returns a promise |

locations.search(opts, cb)

Search locations

Kind: instance method of Locations

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign, lat, lng, facebookPlacesID } | | cb | function | callback called if paseed, otherwise returns a promise |

Media ⇐ Endpoint

Client.media

// example
Client.media.getByID("SOMEMEDIAID", {
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

media.getByID(id, opts, cb)

Gets a media by id

Kind: instance method of Media

| Param | Type | Description | | --- | --- | --- | | id | string | the media ID | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

media.getByShortcode(id, opts, cb)

Gets a media by shortcode

Kind: instance method of Media

| Param | Type | Description | | --- | --- | --- | | id | string | the media shortcode | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

media.search(id, opts, cb)

Search media by locations

Kind: instance method of Media

| Param | Type | Description | | --- | --- | --- | | id | string | the media shortcode | | opts | object | the options object { accessToken, sign, lng, lat, distance } | | cb | function | callback called if paseed, otherwise returns a promise |

OAuth ⇐ Endpoint

Client.oauth

// example
Client.oauth.getAccessToken({
 grantType: "",
 redirectURI: "",
 code: "",
})
.then(result => {})

Kind: global class
Extends: Endpoint

oAuth.getAccessToken(opts, cb)

It returns the accessToken

Kind: instance method of OAuth

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { code, grantType, redirectURI } | | cb | function | callback called if paseed, otherwise returns a promise |

oAuth.getAuthURL(opts)

It returns the authURL

Kind: instance method of OAuth

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { CLIENT_ID, CLIENT_SECRET, responseType, redirectURI, scope } |

Subscriptions ⇐ Endpoint

Client.subscriptions

// example
Client.subscriptions.create({
 object: "",
 aspect: "",
 verifyToken: "",
 callbackURL: "",
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

subscriptions.create(opts, cb)

Creates a subscription

Kind: instance method of Subscriptions

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign, object, aspect, verifyToken, callbackURL } | | cb | function | callback called if paseed, otherwise returns a promise |

subscriptions.list(opts, cb)

Lists the subscriptions for the client

Kind: instance method of Subscriptions

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign, object, aspect, verifyToken, callbackURL } | | cb | function | callback called if paseed, otherwise returns a promise |

subscriptions.del(opts, cb)

Deletes subscriptions for the client

Kind: instance method of Subscriptions

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign, object, aspect, verifyToken, callbackURL } | | cb | function | callback called if paseed, otherwise returns a promise |

Tags ⇐ Endpoint

Client.tags

// example
Client.tags.getByName("travel", {
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

tags.getByName(tagName, opts, cb)

Gets a tag by name

Kind: instance method of Tags

| Param | Type | Description | | --- | --- | --- | | tagName | string | the tag name | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

tags.getMediaRecent(tagName, opts, cb)

Gets a tag's recent media by tag name

Kind: instance method of Tags

| Param | Type | Description | | --- | --- | --- | | tagName | string | the tag name | | opts | object | the options object { accessToken, sign, minTagID, maxTaxID, count } | | cb | function | callback called if paseed, otherwise returns a promise |

tags.search(tagName, opts, cb)

Searches a tag by tag name

Kind: instance method of Tags

| Param | Type | Description | | --- | --- | --- | | tagName | string | the tag name | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

Users ⇐ Endpoint

Client.users

// example
Client.users.getSelf({
 accessToken: "SOMEACCESSTOKEN",
})
.then(result => {})

Kind: global class
Extends: Endpoint

users.getSelf(opts, cb)

Gets the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getSelfFollows(opts, cb)

Gets the users followed by the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getSelfFollowedBy(opts, cb)

Gets the user's follower of the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getSelfRequestedBy(opts, cb)

Gets the pending follow requests of the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getRelationshipWithUser(id, opts, cb)

Gets the relationship between a user and the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | id | string | the ID of the user to check the relatioship with the accessToken user | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.updateRelationshipWithUser(id, opts, cb)

Updates the relationship between a user and the user from the access token

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | id | string | the ID of the user to check the relatioship with the accessToken user | | opts | object | the options object { accessToken, sign, action } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getByID(id, opts, cb)

Gets a user by ID

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | id | string | the ID of the user to get | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getUserRecentMedia(id, opts, cb)

Gets a user's recent media by user ID

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | id | string | the ID of the user to get | | opts | object | the options object { accessToken, sign, count } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getSelfRecentMedia(opts, cb)

Gets a self recent media from the accessToken

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.getSelfMediaLiked(opts, cb)

Gets a self media liked from the accessToken

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign } | | cb | function | callback called if paseed, otherwise returns a promise |

users.search(opts, cb)

Search a users

Kind: instance method of Users

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { accessToken, sign, q } | | cb | function | callback called if paseed, otherwise returns a promise |

V1 ⇐ InstagramClient

InstagramClient V1

const Instagram = require("instragram-client").v1

const Client = new Instagram({
 CLIENT_ID: "SOMECLIENTID",
 CLIENT_SECRET: "SOMECLIENTSECRET",
}) 

Kind: global class
Extends: InstagramClient

new V1(opts)

| Param | Type | Description | | --- | --- | --- | | opts | object | the options object { CLIENT_ID, CLIENT_SECRET } |

v1.get(endpoint, opts, cb)

Kind: instance method of V1

| Param | Type | | --- | --- | | endpoint | string | | opts | object | | cb | function |

v1.post(endpoint, opts, formData, cb)

Kind: instance method of V1

| Param | Type | | --- | --- | | endpoint | string | | opts | object | | formData | object | | cb | function |

v1.del(endpoint, opts, formData, cb)

Kind: instance method of V1

| Param | Type | | --- | --- | | endpoint | string | | opts | object | | formData | object | | cb | function |