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

helpscout-docs

v0.2.3

Published

HelpScout Docs API client for Node.js

Downloads

13

Readme

helpscout-docs

HelpScout Docs API client for Node.js

Installation

$ npm install helpscout-docs

Usage

var HelpScoutDocs = require('helpscout-docs');

var apiKey = '{your api key}';
var hsdocs = new HelpScoutDocs(apiKey);

// get all collections
hsdocs.collections.getAll(function(err, result){
  console.log(result);
});

All available methods are listed below

API Documentation

After module initialization:

var hsdocs = new HelpScoutDocs('{your api key}');

hsdocs object has following methods to perform API calls:

Notice

All methods accept "error-first" callback function. In case of error, callback will be called with error message in first parameter, otherwise JSON result of API call will be passed as second parameter.

Some methods require data to pass. Provide object with data as first argument (see code examples).

Articles

  • List Articles
hsdocs.articles.getAllByCollection({id:'{collectionId}'}, function(err, result){});
// or
hsdocs.articles.getAllByCategory({id:'{categoryId}'}, function(err, result){});
  • Search Articles
hsdocs.articles.search({
  fields:{
    query: 'query string'
  }
}, function(err, result){});
  • List Related Articles
hsdocs.articles.getRelated({id:'{articleId}'}, function(err, result){});
  • List Revisions
hsdocs.articles.getRevisions({id:'{articleId}'}, function(err, result){});
  • Get Article
hsdocs.articles.get({id:'{articleId or articleNumber}'}, function(err, result){});
  • Get Revision
hsdocs.articles.getRevision({id:'{revisionId}'}, function(err, result){});
  • Create Article
hsdocs.articles.create({
  fields:{
    collectionId: '{collectionId}',
    name: 'article name',
    text: 'article text'
  }
}, function(err, result){});
  • Update Article
hsdocs.articles.update({
  id: '{articleId}',
  fields:{
    name: 'article name',
    text: 'article text'
  }
}, function(err, result){});
  • Upload Article
hsdocs.articles.upload({
  fields:{
    collectionId: '{collectionId}',
    file: 'file data'
  }
}, function(err, result){});
  • Update View Count
hsdocs.articles.updateViewCount({
  id: 'articleId',
  fields:{
    count: 42
  }
}, function(err, result){});
  • Delete Article
hsdocs.articles.delete({id:'{articleId}'}, function(err, result){});
  • Save Article Draft
hsdocs.articles.saveDraft({
  id: 'articleId',
  fields:{
    text: 'article text'
  }
}, function(err, result){});
  • Delete Article Draft
hsdocs.articles.deleteDraft({id:'{articleId}'}, function(err, result){});

Assets

  • Create Article Asset
hsdocs.assets.createArticleAsset({
  fields:{
    articleId: '{articleId}',
    assetType: 'attachment',
    file: 'file data'
  }
}, function(err, result){});
  • Create Settings Asset
hsdocs.assets.createSettingsAsset({
  fields:{
    assetType: 'favicon',
    file: 'file data'
  }
}, function(err, result){});

Categories

  • List Categories
hsdocs.categories.getAllByCollection({id:'{collectionId}'}, function(err, result){});
  • Get Category
hsdocs.categories.get({id:'{categoryId or categoryNumber}'}, function(err, result){});
  • Create Category
hsdocs.categories.create({
  fields:{
    collectionId: '{collectionId}',
    name: 'category name'
  }
}, function(err, result){});
  • Update Category
hsdocs.categories.update({
  id: '{categoryId}',
  fields:{
    name: 'category name'
  }
}, function(err, result){});
  • Update Category Order
hsdocs.categories.updateOrder({
  id: '{collectionId}',
  fields:{
    categories: [
      {
        id: '{categoryId}',
        order: 1
      },
      {
        id: '{categoryId}',
        order: 2
      },
    }
  }
}, function(err, result){});
  • Delete Category
hsdocs.categories.delete({id:'{categoryId}'}, function(err, result){});

Collections

  • List Collections
hsdocs.collections.getAll(function(err, result){});
  • Get Collection
hsdocs.collections.get({id:'{collectionId or collectionNumber}'}, function(err, result){});
  • Create Collection
hsdocs.collections.create({
  fields:{
    siteId: '{siteId}',
    name: 'collection name'
  }
}, function(err, result){});
  • Update Collection
hsdocs.collections.update({
  id: '{collectionId}',
  fields:{
    name: 'collection name'
  }
}, function(err, result){});
  • Delete Collection
hsdocs.collections.delete({id:'{collectionId}'}, function(err, result){});

Redirects

  • List Redirects
hsdocs.redirects.getAllBySite({id:'{siteId}'}, function(err, result){});
  • Get Redirect
hsdocs.redirects.get({id:'{redirectId}'}, function(err, result){});
  • Find Redirect
hsdocs.redirects.find({
  fields: {
    url: '/some/path/123',
    siteId: '{siteId}'
  }
}, function(err, result){});
  • Create Redirect
hsdocs.redirects.create({
  fields:{
    siteId: '{siteId}',
    urlMapping: '/some/path/123',
    redirect: 'http://redirect.to/'
  }
}, function(err, result){});
  • Update Redirect
hsdocs.redirects.update({
  id: '{redirectId}',
  fields:{
    siteId: '{siteId}',
    urlMapping: '/some/path/123',
    redirect: 'http://redirect.to/'
  }
}, function(err, result){});
  • Delete Redirect
hsdocs.redirects.delete({id:'{redirectId}'}, function(err, result){});

Sites

  • List Sites
hsdocs.sites.getAll(function(err, result){});
  • Get Site
hsdocs.sites.get({id:'{siteId}'}, function(err, result){});
  • Create Site
hsdocs.sites.create({
  fields:{
    subDomain: 'some-subdomain',
    title: 'site title'
  }
}, function(err, result){});
  • Update Site
hsdocs.sites.update({
  id: '{siteId}',
  fields:{
    subDomain: 'some-subdomain',
    title: 'site title'
  }
}, function(err, result){});
  • Transfer Site
hsdocs.sites.transfer({
  id: '{siteId}',
  fields:{
    destinationApiKey: '{another account Docs API key}'
  }
}, function(err, result){});
  • Delete Site
hsdocs.sites.delete({id:'{siteId}'}, function(err, result){});

See full Help Scout Docs API description on official website: http://developer.helpscout.net/docs-api/