Skip to content

lilt/lilt-node

Repository files navigation

lilt-node

LiltNode - JavaScript client for lilt-node Lilt REST API Support: https://lilt.atlassian.net/servicedesk/customer/portals
The Lilt REST API enables programmatic access to the full-range of Lilt backend services including:

  • Training of and translating with interactive, adaptive machine translation
  • Large-scale translation memory
  • The Lexicon (a large-scale termbase)
  • Programmatic control of the Lilt CAT environment
  • Translation memory synchronization

Requests and responses are in JSON format. The REST API only responds to HTTPS / SSL requests. The base url for this REST API is https://api.lilt.com/.

Authentication

Requests are authenticated via REST API key, which requires the Business plan.

Requests are authenticated using HTTP Basic Auth. Add your REST API key as both the username and password.

For development, you may also pass the REST API key via the key query parameter. This is less secure than HTTP Basic Auth, and is not recommended for production use.

Quotas

Our services have a general quota of 4000 requests per minute. Should you hit the maximum requests per minute, you will need to wait 60 seconds before you can send another request.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 3.0.0
  • Package version: 3.0.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install lilt-node --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your lilt-node from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/lilt/lilt-node then install it via:

    npm install lilt/lilt-node --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var LiltNode = require('lilt-node');

var defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['key'] = "Token"
// Configure HTTP basic authorization: BasicAuth
var BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME'
BasicAuth.password = 'YOUR PASSWORD'

var api = new LiltNode.CreateApi()
var contentId = 56; // {Number} The content ID.
api.deleteLiltCreateContent(contentId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Checking Credentials

If you would like to test your credentials using our functionality tests you can do the following.

Navigate to the folder where the package is installed and create a .env file inside the package using .env_example as a template. Fill out the API_HOST and API_KEY lines using the credentials you were given.

Then while inside the package folder, run:

npm test

You should be able to see the tests run.

Documentation for API Endpoints

All URIs are relative to https://api.lilt.com

Class Method HTTP request Description
LiltNode.CreateApi deleteLiltCreateContent DELETE /v2/create/{contentId} Delete Lilt Create content
LiltNode.CreateApi generateLiltCreateContent POST /v2/create Generate new Lilt Create content
LiltNode.CreateApi getLiltCreateById GET /v2/create/{contentId} Get Lilt Create content by ID.
LiltNode.CreateApi getLiltCreateContent GET /v2/create Get Lilt Create content
LiltNode.CreateApi getLiltCreatePreferences GET /v2/create/preferences Get Lilt Create preferences
LiltNode.CreateApi regenerateLiltCreateContent GET /v2/create/{contentId}/create Regenerate Lilt Create content
LiltNode.CreateApi signLiltCreateTerms POST /v2/create/terms-and-conditions Sign the Lilt Create terms and conditions
LiltNode.CreateApi updateLiltCreateContent PUT /v2/create/{contentId} Update Lilt Create content
LiltNode.CreateApi updateLiltCreatePreferences PUT /v2/create/preferences Update Lilt Create preferences
LiltNode.DocumentsApi downloadDocument GET /v2/documents/files Download a Document
LiltNode.DocumentsApi uploadDocument POST /v2/documents/files Upload a File
LiltNode.FilesApi addLabel POST /v2/files/labels Add Label to File
LiltNode.FilesApi deleteFile DELETE /v2/files Delete a File
LiltNode.FilesApi download GET /v2/files/download Download file
LiltNode.FilesApi getFiles GET /v2/files Retrieve a File
LiltNode.FilesApi removeLabel DELETE /v2/files/labels Remove Label from File
LiltNode.FilesApi uploadFile POST /v2/files Upload a File
LiltNode.JobsApi archiveJob POST /v2/jobs/{jobId}/archive Archive a Job
LiltNode.JobsApi createJob POST /v2/jobs Create a Job
LiltNode.JobsApi deleteJob DELETE /v2/jobs/{jobId} Delete a Job
LiltNode.JobsApi deliverJob POST /v2/jobs/{jobId}/deliver Deliver a Job
LiltNode.JobsApi downloadJob GET /v2/jobs/{jobId}/download Download a Job
LiltNode.JobsApi exportJob GET /v2/jobs/{jobId}/export Export a Job
LiltNode.JobsApi getJob GET /v2/jobs/{jobId} Retrieve a Job
LiltNode.JobsApi getJobLeverageStats POST /v2/jobs/{jobId}/stats Retrieve Job Leverage Stats
LiltNode.JobsApi reactivateJob POST /v2/jobs/{jobId}/reactivate Reactivate a Job
LiltNode.JobsApi retrieveAllJobs GET /v2/jobs Retrieve all Jobs
LiltNode.JobsApi unarchiveJob POST /v2/jobs/{jobId}/unarchive Unarchive a Job
LiltNode.JobsApi updateJob PUT /v2/jobs/{jobId} Update a Job
LiltNode.LanguagesApi getLanguages GET /v2/languages Retrieve supported languages
LiltNode.MemoriesApi createMemory POST /v2/memories Create a Memory
LiltNode.MemoriesApi deleteMemory DELETE /v2/memories Delete a Memory
LiltNode.MemoriesApi deleteSegmentFromMemory DELETE /v2/memories/segment Delete a segment from a memory.
LiltNode.MemoriesApi downloadTermbase GET /v2/memories/termbase/download Termbase download for a Memory
LiltNode.MemoriesApi exportTermbase POST /v2/memories/termbase/export Termbase export for a Memory
LiltNode.MemoriesApi getMemory GET /v2/memories Retrieve a Memory
LiltNode.MemoriesApi importMemoryFile POST /v2/memories/import File import for a Memory
LiltNode.MemoriesApi queryMemory GET /v2/memories/query Query a Memory
LiltNode.MemoriesApi updateMemory PUT /v2/memories Update the name of a Memory
LiltNode.ProjectsApi createProject POST /v2/projects Create a Project
LiltNode.ProjectsApi deleteProject DELETE /v2/projects Delete a Project
LiltNode.ProjectsApi getProjects GET /v2/projects Retrieve a Project
LiltNode.TranslateApi batchTranslateFile POST /v2/translate/file Translate a File
LiltNode.TranslateApi downloadFile GET /v2/translate/files Download translated file
LiltNode.TranslateApi monitorFileTranslation GET /v2/translate/file Monitor file translation
LiltNode.TranslateApi translateSegmentPost POST /v2/translate Translate a segment
LiltNode.WorkflowsApi getWorkflowTemplates GET /v2/workflows/templates Retrieve workflow templates

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

BasicAuth

  • Type: HTTP basic authentication