0.2.1 • Published 5 years ago

deviantnode v0.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

deviantnode

a pretty basic node.js library using the deviantart api

version

How do I start?

The functions for this package is quite easy and basic. All these contain the deviantart api. The only requirements you need is to create your application, which gives you CLIENT_ID and CLIENT_SECRET.

The "Basic"

const deviantnode = require('deviantnode');

const options = { //optional
  category: 'digitalart/animation/',
  q: 'test',
  time: '24hr',
  offset: 0,
  limit: 5
};
deviantnode.getPopularDeviations('CLIENT_ID','CLIENT_SECRET', options)
  .then(response => console.log(response.results[0])); //show the first result

Functions

getDailyDeviations(client_id, client_secret, options)

Browse daily deviations. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • date(optional): the day to browse, defaults to today. the string must be like this: YYYY-MM-DD.
deviantnode.getDailyDeviations('CLIENT_ID','CLIENT_SECRET', { date: '2012-12-12' })
  .then(response => console.log(response));

getHotDeviations(client_id, client_secret, options)

Browse whats hot deviations. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • category(optional): category path to fetch from.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
const options = {
   category: 'apps',
   offset: 6,
   limit: 1 }
}
deviantnode.getHotDeviations('CLIENT_ID','CLIENT_SECRET', options)
  .then(response => console.log(response));

getNewestDeviations(client_id, client_secret, options)

Browse whats hot deviations. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • category(optional): category path to fetch from.
    • q(optional): a search query term.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
deviantnode.getNewestDeviations('CLIENT_ID','CLIENT_SECRET', { q: 'hi' })
  .then(response => console.log(response));

getPopularDeviations(client_id, client_secret, options)

Browse popular deviations. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • category(optional): category path to fetch from.
    • q(optional): a search query term.
    • time(optional): the timerange, valid values(8hr, 24hr, 3days, 1week, 1month, alltime) default: 24hr.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
deviantnode.getPopularDeviations('CLIENT_ID','CLIENT_SECRET', { time: 'alltime', limit: 5 })
  .then(response => console.log(response));

getTagDeviations(client_id, client_secret, options)

Browse a tag. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • tag: the tag to browse.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
deviantnode.getTagDeviations('CLIENT_ID','CLIENT_SECRET', { tag: 'Hi' })
  .then(response => console.log(response));

getUndiscoveredDeviations(client_id, client_secret, options)

Browse undiscovered deviations. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • category(optional): category path to fetch from.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
deviantnode.getUndiscoveredDeviations('CLIENT_ID','CLIENT_SECRET', { category: 'digitalart/animation/' })
  .then(response => console.log(response));

getGalleryAllDeviations(client_id, client_secret, options)

Get the "all" view of a users gallery. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • username: the user whose gallery to fetch.
    • offset(optional): the pagination offset.
    • limit(optional): the pagination limit.
deviantnode.getGalleryAllDeviations('CLIENT_ID','CLIENT_SECRET', { username: 'EduardoBarra' })
  .then(response => console.log(response));

getUserInfo(client_id, client_secret, options)

Get user profile information. Source

Parameters:

  • CLIENT_ID: the client id from your application.
  • CLIENT_SECRET: the client secret from your application.
  • options:
    • username: username to lookup profile of.
    • collections(optional): include collection folder info.
    • galleries(optional): include gallery folder info.
deviantnode.getUserInfo('CLIENT_ID','CLIENT_SECRET', { username: 'EduardoBarra' })
  .then(response => console.log(response));

and,.,. that's all. soon there will be more functions.!