instagram-client

0.0.2 • Public • Published

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

CommentsEndpoint

Client.comments

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

Client.likes

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

Client.locations

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

Client.media

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

Client.oauth

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

Client.subscriptions

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

Client.tags

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

Client.users

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

InstagramClient V1

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

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

Readme

Keywords

none

Package Sidebar

Install

npm i instagram-client

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • francoispqt