Skip to content

lilt/lilt-node

Repository files navigation

lilt-node

LiltNode - JavaScript client for lilt-node 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.

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: v2.0
  • Package version: 0.5.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://lilt.com/docs/api

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.CommentsApi()
var documentId = 56; // {Number} A unique document identifier.
var segmentId = 56; // {Number} A unique segment identifier.
var body = new LiltNode.CommentBody(); // {CommentBody} The comment being created
api.createComment(documentId, segmentId, body).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

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

Class Method HTTP request Description
LiltNode.CommentsApi createComment POST /comments Create a new comment
LiltNode.CommentsApi deleteComment DELETE /comments Delete a Comment
LiltNode.CommentsApi getDocumentComments GET /comments Retrieve a document's comments by segment
LiltNode.CommentsApi updateComment PUT /comments Update an existing comment
LiltNode.ConnectorsApi createConnector POST /connectors Upload a Connector
LiltNode.ConnectorsApi deleteConnector DELETE /connectors Delete a Connector
LiltNode.ConnectorsApi exportConnectorJob POST /connectors/jobs/deliver Deliver a Connector Job
LiltNode.ConnectorsApi getConnectorJobs GET /connectors/jobs Retrieve a Connector Job
LiltNode.ConnectorsApi getConnectors GET /connectors Retrieve a Connector
LiltNode.ConnectorsApi syncConnector POST /connectors/sync Sync a Connector
LiltNode.ConnectorsApi updateConnector PUT /connectors Upload a Connector
LiltNode.ConverterConfigApi addConverterConfig PUT /configs/converter Add Converter Config
LiltNode.ConverterConfigApi deleteConverterConfig DELETE /configs/converter/{configId} Delete Converter Config
LiltNode.ConverterConfigApi deleteFilterMapping DELETE /configs/converter/{configId}/{fileExtension} Delete Filter Mapping
LiltNode.ConverterConfigApi editFilterMapping PUT /configs/converter/{configId}/{fileExtension} Add Filter Mapping
LiltNode.ConverterConfigApi getConverterConfigById GET /configs/converter/{configId} Fetch Converter Config by Id
LiltNode.ConverterConfigApi getConverterConfigs GET /configs/converter List Converter Configs
LiltNode.DocumentsApi assignDocument PUT /documents/share Assign a Document
LiltNode.DocumentsApi createDocument POST /documents Create a Document
LiltNode.DocumentsApi deleteDocument DELETE /documents Delete a Document
LiltNode.DocumentsApi downloadDocument GET /documents/files Download a Document
LiltNode.DocumentsApi getDocument GET /documents Retrieve a Document
LiltNode.DocumentsApi markReviewDone POST /documents/done/review Mark review done
LiltNode.DocumentsApi markTranslationDone POST /documents/done/translation Mark translation done
LiltNode.DocumentsApi pretranslateDocuments POST /documents/pretranslate Pretranslate a Document
LiltNode.DocumentsApi unlockDocuments POST /documents/done/unlock Unlock documents
LiltNode.DocumentsApi uploadDocument POST /documents/files Upload a File
LiltNode.FilesApi addLabel POST /files/labels Add Label to File
LiltNode.FilesApi deleteFile DELETE /files Delete a File
LiltNode.FilesApi download GET /files/download Download file
LiltNode.FilesApi getFiles GET /files Retrieve a File
LiltNode.FilesApi removeLabel DELETE /files/labels Remove Label from File
LiltNode.FilesApi uploadFile POST /files Upload a File
LiltNode.JobsApi archiveJob POST /jobs/{jobId}/archive Archive a Job
LiltNode.JobsApi createJob POST /jobs Create a Job
LiltNode.JobsApi deleteJob DELETE /jobs/{jobId} Delete a Job
LiltNode.JobsApi deliverJob POST /jobs/{jobId}/deliver Deliver a Job
LiltNode.JobsApi downloadJob GET /jobs/{jobId}/downlod Download a Job
LiltNode.JobsApi exportJob GET /jobs/{jobId}/export Export a Job
LiltNode.JobsApi getJob GET /jobs/{jobId} Retrieve a Job
LiltNode.JobsApi getJobLeverageStats POST /jobs/{jobId}/stats Retrieve Job Leverage Stats
LiltNode.JobsApi reactivateJob POST /jobs/{jobId}/reactivate Reactivate a Job
LiltNode.JobsApi retrieveAllJobs GET /jobs Retrieve all Jobs
LiltNode.JobsApi unarchiveJob POST /jobs/{jobId}/unarchive Unarchive a Job
LiltNode.JobsApi updateJob PUT /jobs/{jobId} Update a Job
LiltNode.LanguagesApi getLanguages GET /languages Retrieve supported languages
LiltNode.LexiconApi queryLexicon GET /lexicon Query a Lexicon
LiltNode.LexiconApi updateLexicon POST /lexicon Update a Lexicon
LiltNode.MemoriesApi createMemory POST /memories Create a Memory
LiltNode.MemoriesApi deleteMemory DELETE /memories Delete a Memory
LiltNode.MemoriesApi getMemory GET /memories Retrieve a Memory
LiltNode.MemoriesApi importMemoryFile POST /memories/import File import for a Memory
LiltNode.MemoriesApi queryMemory GET /memories/query Query a Memory
LiltNode.MemoriesApi syncDeleteMemory DELETE /memories/sync Delete-sync for a Memory
LiltNode.MemoriesApi syncDownMemory GET /memories/sync Get-sync for a Memory
LiltNode.MemoriesApi syncInsertMemory POST /memories/sync Insert-sync for a Memory
LiltNode.MemoriesApi syncUpdateMemory PUT /memories/sync Update-sync for a Memory
LiltNode.MemoriesApi updateMemory PUT /memories Update the name of a Memory
LiltNode.ProjectsApi createProject POST /projects Create a Project
LiltNode.ProjectsApi deleteProject DELETE /projects Delete a Project
LiltNode.ProjectsApi deliverProjectsBulk POST /projects/bulk-deliver Deliver multiple projects apart from their jobs.
LiltNode.ProjectsApi getProjectReport GET /projects/quote Retrieve Project report
LiltNode.ProjectsApi getProjectRevisionReport GET /projects/{id}/revision Retrieve Project revision report
LiltNode.ProjectsApi getProjectStatus GET /projects/status Retrieve Project status
LiltNode.ProjectsApi getProjects GET /projects Retrieve a Project
LiltNode.ProjectsApi triggerAutoAssignment POST /autoAssignment Auto Assignment
LiltNode.ProjectsApi updateProjectsBulk PUT /projects/bulk-update Update multiple Projects with a single payload
LiltNode.QAApi qaCheck GET /qa Perform QA check
LiltNode.RootApi root GET / Retrieve the REST API root
LiltNode.SegmentsApi createSegment POST /segments Create a Segment
LiltNode.SegmentsApi deleteSegment DELETE /segments Delete a Segment
LiltNode.SegmentsApi getSegment GET /segments Retrieve a Segment
LiltNode.SegmentsApi tagSegment GET /segments/tag Tag a Segment
LiltNode.SegmentsApi unlockSegments POST /segments/review/unlock Unaccept and unlock segments
LiltNode.SegmentsApi updateSegment PUT /segments Update a Segment
LiltNode.SettingsApi getOrganizationSettings GET /settings/organization Get organization-level settings
LiltNode.SettingsApi getProjectSettings GET /settings/project/{projectId} Get settings for a project
LiltNode.SettingsApi getUserSettings GET /settings/user Get settings for the authenticated user
LiltNode.SettingsApi upsertSetting POST /settings Update or create a setting
LiltNode.TranslateApi batchTranslateFile POST /translate/file Translate a File
LiltNode.TranslateApi downloadFile GET /translate/files Download translated file
LiltNode.TranslateApi monitorFileTranslation GET /translate/file Monitor file translation
LiltNode.TranslateApi registerSegment GET /translate/register Register a segment
LiltNode.TranslateApi translateSegment GET /translate Translate a segment
LiltNode.TranslateApi translateSegmentPost POST /translate Translate a segment
LiltNode.WorkflowsApi advanceWorkflowStage POST /document/{documentId}/task/{taskId}/advance Advance workflow to the next stage
LiltNode.WorkflowsApi getDocumentWorkflow GET /workflows/document/{documentId} Retrieve document Workflow metadata
LiltNode.WorkflowsApi getWorkflowTemplates GET /workflows/templates Retrieve workflow templates
LiltNode.WorkflowsApi rejectWorkflowStage POST /document/{documentId}/task/{taskId}/reject Move workflow to the previous stage
LiltNode.WorkflowsApi setDocumentStage PUT /workflows/{documentId}/stage Set Workflow stage for a document

Documentation for Models

Documentation for Authorization

ApiKeyAuth

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

BasicAuth

  • Type: HTTP basic authentication