Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docscout

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docscout

NodeJS client for HelpScout Docs API

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

DocScout

NodeJS client for HelpScout Docs API written in TypeScript

Install

$ npm install docscout

Usage

Functional

import { listCollections } from 'docscout/collections'

const apiToken = process.env.HELPSCOUT_DOCS_API_TOKEN;

(async () => {
  try {
    const collectionsEnvelope = await listCollections(apiToken, { visibility: 'private', sort: 'createdAt', order: 'asc'  });
    console.log(JSON.stringify(collectionsEnvelope, null, 2));
  } catch (error) {
    console.error(error);
  }
})();

OOP Client Instance

The OOP Client has two subtle differences from the functional approach:

  • Stores the API token internally so that you don't have to pass it in every single function call.
  • Unboxes the envelope data from the API responses. More info about HS Docs Data Envelopes
import DocscoutClient from 'docscout'

const apiToken = process.env.HELPSCOUT_DOCS_API_TOKEN;

(async () => {
  try {
    const docscoutClient = new DocscoutClient(apiToken);
    const collections = await docscoutClient.listCollections({
      visibility: 'private',
      sort: 'createdAt',
      order: 'desc'
    });
    console.log(JSON.stringify(collections, null, 2));
  } catch (error) {
    console.error(error);
  }
})();

API

Version 1 of this client focuses on fetching data, i.e. the API Reads.
We'll happily welcome your PRs to improve this client.

Articles | Source Code

List Articles | Docs
In Collection
listArticlesInCollection( apiToken: string, collectionId: string, options?: ListArticleOptions )
In Category
listArticlesInCategory( apiToken: string, categoryId: string, options?: ListArticleOptions )
Search Articles | Docs
searchArticles( apiToken: string, options: SearchArticlesOptions )
listRelatedArticles( apiToken: string, articleId: string, options?: ListRelatedArticlesOptions )
List Revisions | Docs
listRevisions( apiToken: string, articleId: string, options?: ListRevisionsOptions )
Get Article | Docs
getArticle( apiToken: string, articleIdOrNumber: string | number, options?: GetArticleOptions )
Get Revision | Docs
getRevision( apiToken: string, revisionId: string )

Assets | Source Code

Create Article Asset | Docs
createArticleAsset( apiToken: string, options: CreateArticleAssetOptions )

Categories | Source Code

List Categories | Docs
listCategories( apiToken: string, collectionId: string, options?: ListCategoriesOptions )
Get Category | Docs
getCategory( apiToken: string, categoryIdOrNumber: string | number )

Collections | Source Code

List Collections | Docs
listCollections( apiToken: string, options?: ListCollectionsOptions )
Get Collection | Docs
getCollection( apiToken: string, collectionIdOrNumber: string | number )

Sites | Source Code

List Sites | Docs
listSites( apiToken: string, options?: ListSitesOptions )

License

Copyright (c) 2019 You Need A Budget, LLC

Licensed under the Apache-2.0 license

Keywords

FAQs

Package last updated on 23 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc