onesky-utils
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -11,3 +11,4 @@ | ||
getMultilingualFile: rootRequire('lib/getMultilingualFile.js'), | ||
postFile: rootRequire('lib/postFile.js') | ||
postFile: rootRequire('lib/postFile.js'), | ||
getLanguages: rootRequire('lib/getLanguages.js') | ||
}; |
{ | ||
"name": "onesky-utils", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Node.js utils for working with OneSky translation service.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,2 +70,20 @@ # nodejs-onesky-utils [![Build Status](https://travis-ci.org/brainly/nodejs-onesky-utils.svg?branch=master)](https://travis-ci.org/brainly/nodejs-onesky-utils) [![Code Climate](https://codeclimate.com/github/brainly/nodejs-onesky-utils/badges/gpa.svg)](https://codeclimate.com/github/brainly/nodejs-onesky-utils) [![npm version](https://badge.fury.io/js/onesky-utils.svg)](http://badge.fury.io/js/onesky-utils) | ||
### getLanguages | ||
```js | ||
var onesky = require('onesky-utils'); | ||
var options = { | ||
apiKey: 'abcdefg', | ||
secret: '1234567', | ||
projectId: '123' | ||
}; | ||
onesky.getLanguages(options).then(function(content) { | ||
console.log(content); | ||
}).catch(function(error) { | ||
console.log(error); | ||
}); | ||
``` | ||
## Install | ||
@@ -145,2 +163,49 @@ | ||
### getLanguages(options) | ||
Get list of project languages. | ||
The `options` object is required. Options include: | ||
- **options.projectId** - Numerical ID of the project | ||
- **options.secret** - `secret` and `apiKey` are used for authentication | ||
- **options.apiKey** | ||
Returns JSON API response content via promise. | ||
Example: | ||
````JSON | ||
{ | ||
"meta": { | ||
"status": 200, | ||
"record_count": 2 | ||
}, | ||
"data": [ | ||
{ | ||
"code": "en-US", | ||
"english_name": "English (United States)", | ||
"local_name": "English (United States)", | ||
"locale": "en", | ||
"region": "US", | ||
"is_base_language": true, | ||
"is_ready_to_publish": true, | ||
"translation_progress": "100%", | ||
"uploaded_at": "2013-10-07T15:27:10+0000", | ||
"uploaded_at_timestamp": 1381159630 | ||
}, | ||
{ | ||
"code": "ja-JP", | ||
"english_name": "Japanese", | ||
"local_name": "日本語", | ||
"locale": "ja", | ||
"region": "JP", | ||
"is_base_language": false, | ||
"is_ready_to_publish": true, | ||
"translation_progress": "98%", | ||
"uploaded_at": "2013-10-07T15:27:10+0000", | ||
"uploaded_at_timestamp": 1381159630 | ||
} | ||
] | ||
} | ||
```` | ||
## Tests | ||
@@ -147,0 +212,0 @@ |
25243
19
546
218
5