1.0.2 • Published 4 years ago

@jorsek/cms-api-v1 v1.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

easyDITA CMS API Wrapper

The goal of this repo is to be a super-simple wrapper for the easyDITA CMS API. This wrapper uses CMS API v1, v2 is currently being built, you will likely need to migrate your code when v2 is released.

Note: There is no typing implemented. It's unlikely that we'll implement types before creating a new project for v2, as much as I'd love to.

Usage

import cmsAPI, {cmsAPIUtil} from '@jorsek/cms-api-v1';

const cmsAPIConnection = cmsAPI({
  subdomain: 'your-org.easydita.com',
  email: 'your@username.com',
  token: 'yourGeneratedToken'
})

// if you want to use the utils...
const cmsAPIUtils = cmsAPIUtil(cmsAPIConnection);


try {
  const res = await cmsAPIConnection(`${uuid}/metadata`);

} catch (e) {
  
  if (e instanceOf Errors.Authentication) {
    
  }
}

Running tests

In order to run the test suite, you must have a keys.json file with the following structure:

{
  "CMS_ORG": "",
  "CMS_SUBDOMAIN": "",
  "CMS_API_USER": "",
	"CMS_API_USER_TOKEN": "",
	"testing_values": {
		"folder_uuid_for_create":"",
		"example_map_uuid":"",
		"example_topic_1_uuid":"",
    "example_topic_1_path":""
	}
}