onesky

Onesky API for node

npm install onesky
30 downloads in the last day
158 downloads in the last week
353 downloads in the last month

OneSky API for Node

This Node.js module provides access to the OneSky API for managing website translations.

Installation

Install via npm

npm install onesky --save

Usage

Initialize onesky with your public and private keys.

var onesky = require('onesky')(publicKey, privateKey);
Example calls

Note: All callbacks are passed an error and data argument: callback(err, data).

Create project with base locale en_US

onesky.project.add('My app', 'en_US', callback);

Fetch project

onesky.project.details('My app', callback);

Add a platform to a project

onesky.platform.add('My app', { type: 'website' }, callback);

Add a phrase to a platform. Strings parameter can be an object, array of objects, string, or an array of strings

var strings = [{
  string: 'My webapp is cool',
  stringKey: 'homepage.webapp_is_cool'
}, {
  string: 'Another sentence, without a stringKey'
}];

onesky.string.input(platformId, strings, callback);

Order translations

onesky.translate.order({
  platformId: platformId,
  agencyId: 5,
  toLocale: 'es_ES',
  filter: 'ALL'
}, callback);

Fetch translations

onesky.string.output({
  platformId: platformId,
  locale: 'es_ES'
}, callback);

For additional methods, see Onesky's documentation. All endpoints and options listed in the official API docs are available here.

Contribute

Forks and pull requests welcome!

TODO

  • Add tests
  • Parse OneSky's response when approriate. OneSky often returns unnecessary nesting
  • Design a better way of defining API keys to allow use of multiple onesky accounts

Author

Brandon Paton. Email me if you have any questions: bp@brandonpaton.com.

npm loves you