node-pressgang-rest
A node module that provides a REST client library for the PressGang CCMS. It provides a more semantic interface for application development than the raw PressGang REST interface. Uses restler for the REST interface.
Installation
npm install pressgang-rest
Basic Usage v.0.1.0 and up
var pressgang =
Get a topic:
pressgang;
revision
and expand
are optional. expand
can take any of the root expandable entities, which include:
tagsincomingRelationshipsoutgoingRelationshipssourceUrls_OTMbugzillaBugs_OTMpropertieslogDetailsrevisions
Get a Content Spec:
pressgang;
Basic Usage v.0.0.13 and below
First, require pressgang-rest
:
var PressGangCCMS = PressGangCCMS;
Next, create a new PressGangCCMS object:
var pressgang = 'http://127.0.0.1:8080/TopicIndex';
Now, you can get the XML of a topic:
pressgang;
To get the JSON representation of a topic:
pressgang
To get a specific revision of a topic:
pressgang
isContentSpec
will return true if an ID is a Content Specification:
pressgang;
getContentSpec
returns a Content Spec object, which has the plain text content of the Content Spec, and a metadata record.
pressgang;
You can change the logging level of the PressGangCCMS Object to get details for debugging. The loglevel
defaults to 0. Higher levels produce more trace output on the console:
pressgangloglevel = 2;
You can also do quick and dirty topic operations, like this:
getTopic
returns a JSON representation of a topic.
PressGangCCMS;
getTopic
takes an optional revision parameter between the topic ID and the callback. Here 3445 is the topic id, and 23433 is the revision:
PressGangCCMS;
Source Code
The source is hosted on github at https://github.com/jwulf/node-pressgang-rest.
Up to 0.0.13 it was written using Microsoft TypeScript, and compiled to JavaScript using the node typescript module. There is a TypeScript declaration file in the module.
From 0.1.0 I made it straight-forward JavaScript. Tests have not been updated yet.