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

divshot

v0.4.8

Published

Wrapper for the Divshot api

Downloads

74

Readme

Divshot Api

Wrapper for the Divshot API.

Contents

Install

npm install divshot --save

Usage

Refer to the Narrator api for a more in depth understanding of all available methods.

CommonJS (Node/Browserify)

var Divshot = require('divshot');

Standalone

<script src="/path/to/divshot.standalone.min.js"></div>

###Instantiate

var api = Divshot.createClient({
  email: '[email protected]',
  password: 'somepassword123!',
  
  // OR
  
  token: 'your divshot access token'
});

###Angular Module

Located at /dist/divshot.angular.js

angular.module('myApp', ['divshot'])
  .config(function (divshotProvider) {
    divshotProvider.configure({
      token: 'divshot_api_access_token'
    });
  }).
  controller('SomeCtrl', function ($scope, divshot) {
    
    $scope.apps = divshot.apps.list();
    
  });

###User

By default, the authenticate method will be called on each request as a pre hook. If a token is provided, this does not create another http request.

api.user.authenticate(function (err, token) {
  
});

api.user.setCredentials({
  email: '[email protected]',
  password: 'somepassword123!',
  
  // OR
  
  token: 'some_really_long_access_token_from_divshot'
});

// User data
api.user.self().then(function (user) {
  
});
// OR
api.user.id(userId).get().then(function (user) {
  
});

// Update user
var user = api.user.id(userId);
user.update({
  name: 'First Last'
}).then(function (user) {
  
});

User password

// Change password
divshot.user.password.update({
  password: 'Password123',
  password_confirm: 'Password123'
}).then(function (res) {
  
});

User Emails

// Add email
divshot.user.emails.add('[email protected]').then(function (res) {
  
});

// Set primary email
divshot.user.emails.primary('[email protected]').then(function (res) {
  
});

// Remove email
divshot.user.emails.remove('[email protected]').then(function (res) {
  
});

// Resend email
divshot.user.emails.resend('[email protected]').then(function (res) {
  
});

Organizations

// Users orgs
divshot.organizations.list().then(function (orgs) {
  
});

// A single organization
divshot.organizations.id(someOrgId).get().then(function (org) {
  
});

// Apps from an organization
divshot.organizations.id(someOrgId).apps.list().then(function (apps) {
  
});

// Update organization
divshot.organizations.id(someOrgId).update({
  name: 'name',
  billing_email: '[email protected]',
  gravatar_email: '[email protected]',
  etc: 'other stuff'
}).then(function (res) {
  
});

Organization Members

// Get org members
divshot.organizations.id(someOrg).members.list().then(function (members) {
  
});

// Invite members to organization
divshot.organizations.id(someOrg).members.create({
  name: email,
  email: email
}).then(function (res) {
  
});

// Update a member in organiztion
divshot.organizations.id(someOrg).members.id(memberid).update({
  admin: false // or true
}).then(function (res) {
  
});

// Remove a member from an organization
divshot.organizations.id(someOrg).members.id(memberId).remove().then(function () {
  
});

Apps

// List apps
api.apps.list().then(function (apps) {
  
});

// Create an app
api.apps.create('app-name').then(function (app) {
  
});

// A specific app
var app = api.apps.id('app name');
app.get().then(function (app) {
  
});

Builds

app.builds.list(function (err, builds) {
  
});

app.builds.id('build id').get(function (err, build) {
  // Specific build by id
});

app.builds.id('build id').finalize(function (err, response) {
  
});

app.builds.id('build id').release('production', function (err, response) {
  
});

###Releases

app.releases.list(function (err, releases) {
  
});

app.releases.env('production').get(function (err, release) {
  // Release by environment
});

app.releases.env('production').rollback(function (err, response) {
  
});

app.releases.env('production').promote('staging', function (err, callback) {
  // Here, "staging" is the from environment
  // and "production" is the to-environment
});

###Domains

// List domains for an app
app.domains.list().then(function(domains) {
  
});

// Add a domain
app.domains.add('www.domain.com').then(function (response) {
  
});

// Remove a domain
app.domains.remove('www.domain.com').then(function (response) {
  
});

###App Environment Configuration

app.env('development').config({
  auth: 'username:password'
}, function (err, response) {
  
});

Build

grunt build