Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.
/ docscout Public archive

NodeJS client for HelpScout Docs API

License

Notifications You must be signed in to change notification settings

ynab/docscout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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

At this time the client if focused 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 )

List Related Articles | Docs

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