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

node-behance-api

v1.3.0

Published

a node utility for adobe behance apis

Downloads

14

Readme

node-behance-api

alt text

A utility wrapper for adobe behance services. This utility is developed for nodejs only. Currently it supports most of the API's of Adobe Behance.

Before starting development on node. You have to register your app on https://www.behance.net/dev/register. Register your app and get the client id from there.

###Prerequisites for node-behance-api This utility wrapper uses request module.

Requirement

request - npm https://www.npmjs.org/package/request

###Require node-behance-api to your nodejs app

var Behance = require("node-behance-api");

###Initialize Behance module with your client_id

var behance = new Behance({"client_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"})
Behance.initOptions();

Here Behance.initOptions() is where you intialize node-behance-api. You can further integrate this module with currently added API. We will see example later on.

###Call a simple api let's say users/{user} ##Examples:

var Behance = require("node-behance-api");
var behance = new Behance({"client_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"})
Behance.initOptions();
behance.get({
    api: Behance.APIS.GET_USER,
    params: { //or simply behance.get('user',
        user:'deepakmshrma'

    }
}, function (error, result) {
    if (error)
        console.log(error)
    else
        console.log(result)
});

Here Behance.APIS.GET_USER, name of the API which you want to access. There are several API's available. You can find name of the API's in apiNameEnum.js. You can also pass simple string as api name here.

List of API's available right now:

GET_USERS: "users",
GET_USER: "user",
GET_USER_PRODUCT: "user_products",
GET_USER_WIPS: "user_wips",
GET_USER_APR: "user_appreciations",
GET_USER_COLLECTIONS: "user_collections",
GET_USER_STATS: "user_stats",
GET_USER_FOLLOWERS: "user_followers",
GET_USER_FOLLOWEES: "user_following",
GET_USER_FEEDBACK: "user_feedback",
GET_USER_WORK_EXP: "user_work_experience",
GET_PRODUCTS: "projects",
GET_PRODUCT: "project",
GET_PRODUCT_COMMENTS: "project_comments",
GET_COLLECTIONS: "collections",
GET_COLLECTION: "collection",
GET_COLLECTION_PROJECTS: "collection_projects",
GET_WIPS: "wips",
GET_WIP_REVISION: "wip_revision",
GET_WIP_REVISION_COMMENTS: "wip_revision_comments",
GET_WIP: "wip"

###Integration of another API's node-behance-api Currently this node-behance-api supports most of the behance api. But if future you can upgrade it with other list of API's.

var Behance = require('node-behance-api'),
    extend = require('extend');
var behance = new Behance({'client_id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'})
Behance.initOptions({
    postProcess: function (options) {
        var newapis = {
            'newapis': {
                'name': 'newapis',
                'url': 'users',
                'params': {
                    'client_id': true,
                    'q': false,
                    'sort': false
                }
            }
        }
        options = extend(true, {}, newapis, options);
        return options;
    }
});
behance
    .get({
        api: 'newapis',
        params: {
            user: 'deepakmshrma'
        }
    }, function (error, result) {
        if (error)
            console.log(error)
        else
            console.log(result)
    });

Here i have use https://www.npmjs.com/package/extend module to extend previous option with new api.

You can use this initOptions method to override the existing api. If you pass new api name same as defined one it will override the previous api. ####Example:

Behance.initOptions({
    postProcess: function (options) {
        var newapis = {
            "users": {
                "name": "users",
                "url": "users",
                "params": {
                    "client_id": true,
                    "q": false,
                    "sort": false,
                    "time": false,
                    "field": false,
                    "country": false,
                    "state": false,
                    "city": false,
                    "page": false,
                    "tags": false,
                    "color_hex": false,
                    "color_range": false
                }
            }
        }
        options = extend(true, {}, newapis, options);
        return options;
    }
});

###Error handling with node-behance-api Error handling with this module is very easy. You can specify the mandatory param with options. If the param value is true. It means it is mandatory for given API’s.

"newapi": {
    "name": "newapis",
    "url": "users",
    "params": {
        "client_id": true,
        "q": false,
        "sort": false,
        "time": true,
        "field": false,
        "country": false,
        "state": false,
        "city": false,
        "page": false,
        "tags": false,
        "color_hex": false,
        "color_range": false
    }
}

Here param "time" is mandatory for newapi.