qordoba-nodejs-sdk-latest

0.0.13 • Public • Published

Qordoba-nodejs-sdk-npm

Makes it easy to work with the Qordoba API in nodejs

Getting Started

Before getting started, you will need to visit Qordoba.com and set up an account.

After creating an account, clone down the repo from github and npm install in the root.

Directory Structure

├── root
│   ├── lib // transplied ES6 code
│   ├── src
│   │   ├── App.js 
│   │   ├── const.js
│   │   ├── file.js
│   │   ├── lang_codes.js
│   │   ├── organization.js
│   │   ├── project.js
│   │   ├── tm.js
│   ├── test
│   ├── node_modules
│   ├── gulpfile.js
│   ├── package.json
│   ├── readme.md

Install module

npm install qordoba-nodejs-sdk-latest --save

Creating a new app

const QordobaSdk = require('qordoba-nodejs-sdk-latest'); const app = new QordobaSdk({ consumerKey, organizationId, projectId });

Basic Use

app.ping() .then( body => /* do something / ) .catch( err => / do something */ )

Arguments

arguments are passed directly into the methods

app.file.list(languageId) .then( body => /* do something / ) .catch( err => / do something */ )

Custom Options

can optionally be passed inside an object literal as the last argument

app.file.segments(languageId, fileId, { limit: 1 }) .then( body => /* do something / ) .catch( err => / do something */ )

Full Response

get full response by passing { fullResponse: true } as one of your key:value pairs inside custom options

app.ping({ fullResponse: true }) .then( body => /* do something / ) .catch( err => / do something */ )

Available Methods

Globals

app.ping()

  • returns the status of the Qordoba API
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.languages()

  • returns detail about the language detail for Qordoba
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.countries()

  • returns detail about the country list for Qordoba
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

Organization

app.organization.team()

  • returns information about your organization's team members
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

Project

app.project.list()

  • returns a list of projects that belong to an organization, including some project details.
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.offset Number of files to skip before starting the list (optional, default: 0)
  • @param {number} custom.limit Maximum number of files to list (optional, default: 100)
  • @param {string} custom.search The search term (optional, default: none)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error

app.project.detail()

  • returns detailed information about a project
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.project.status()

  • returns the status of all projects
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.project.updateKey(pageId, key, newKey)

  • Updates the key in the file\page with the new one
  • @param {number} pageId Id of the file\page where the key should be updated
  • @param {string} key Old key in the file
  • @param {string} newKey The key to replace with

app.project.workflow()

  • returns the milestone information, status, and language for a project
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.project.milestones()

  • returns the milestone information, status, and language for a project
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error

File

app.file.list(languageId)

  • returns a list of project files for a given target languageId or languageCode
  • @params {number|string} languageId | languageCode The id of target language
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.offset Number of files to skip before starting the list (optional, default: 0)
  • @param {number} custom.limit Maximum number of files to list (optional, default: 100)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error

app.file.types()

  • returns a list of the file types in a project
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)
  • @return {Promise} A Promise that is fulfilled with the API response or rejected with an error

app.file.uploadJsonAsFile(json, fileName)

  • uploads json as a file and attaches it to the project
  • @params {object|string} json JSON object or serialized JSON
  • @params {string} fileName file name

app.file.upload(filesUpload)

  • uploads a files and attaches them to the project
  • @params {object|array} filesUpload A file object or array of file objects { path, type } || [{ path, type}, { path, type }...]
  • @param {string} some_file_object.path System path to target file
  • @param {string} some_file_object.type Type of file to uplaod

app.file.export(languageId, fileIds)

  • returns a link for downloading a .zip file that contains project files for a specified page and target language
  • @params {number|string} languageId | languageCode The id of target language
  • @params {string|array} fileIds Ids of files to export
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.file.update(fileUpdate)

  • updates a file in a project - parallel updates are not supported
  • @params {object} fileUpdate A file object { path, fileId }
    • @param {string} some_file_object.path Path to target file
    • @param {string} some_file_object.fileId Id of file to update
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.file.segments(languageId, fileId)

  • returns a list or filtered list of the segments in a file
  • @params {number|string} languageId | languageCode The id of target language
  • @params {number} fileId The id of the file to retrieve segments
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.offset Number of files to skip before starting the list (optional, default: 0)
  • @param {number} custom.limit Maximum number of files to list (optional, default: 100)
  • @param {string} custom.search The search term (optional, default: none)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.file.segment(languageId, fileId, segmentId)

  • returns a file segment by its id
  • @params {number|string} languageId | languageCode The id of target language
  • @params {number} fileId The id of the file to retrieve segments
  • @params {number} segmentId The id of segment
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

app.file.json(languageId, milestoneId, fileIds)

  • returns json object of key value pairs
  • @params {number|string} languageId | languageCode The id of target language
  • @params {number} milestoneId The id of the milestone to get json from (see app.project.milestone)
  • @params {number} fileId The id of the file to retrieve segments
  • @params {number} segmentId The id of segment

app.file.recent(languageId)

  • returns array of most version of files by target language
  • @params {number|string} languageId | languageCode The id of target language
  • @param {object} custom Custom object with keys explained below: (optional)
  • @param {number} custom.fullResponse Forces return of full response (optional, default: false)

Scripts

  • 'gulp build' - transpliles ES6 code from src -> lib into ES5. Provides runtime support for promises.

Running the tests

'npm test' in the root directory

Built With

  • rp-promise -The simplified HTTP request client 'request' with Promise suppor

Authors

  • Erik Suddath -

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Readme

Keywords

none

Package Sidebar

Install

npm i qordoba-nodejs-sdk-latest

Weekly Downloads

0

Version

0.0.13

License

MIT

Unpacked Size

116 kB

Total Files

29

Last publish

Collaborators

  • q-kirill