lilt-node

Lilt API Binding for Javascript

View the Project on GitHub lilt/lilt-node

LiltNode.DocumentsApi

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

Method HTTP request Description
downloadDocument GET /v2/documents/files Download a Document
uploadDocument POST /v2/documents/files Upload a File

downloadDocument

Blob downloadDocument(id, opts)

Download a Document

Export a Document that has been translated in the Lilt web application. Any Document can be downloaded in XLIFF 1.2 format, or can be retrieved in its original uploaded format by setting `is_xliff=false`. This endpoint will fail if either (a) export or (b) pre-translation operations are in-progress. The status of those operations can be determined by retrieving the Document resource. Example CURL command: ```bash curl -X GET https://api.lilt.com/v2/documents/files?key=API_KEY&id=274 -o from_lilt.xliff ```

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let 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 = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.DocumentsApi();
let id = 56; // Number | An unique Document identifier.
let opts = {
  'isXliff': true // Boolean | Download the document in XLIFF 1.2 format.
};
apiInstance.downloadDocument(id, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number An unique Document identifier.  
isXliff Boolean Download the document in XLIFF 1.2 format. [optional] [default to true]

Return type

Blob

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

uploadDocument

DocumentWithSegments uploadDocument(name, projectId, body, opts)

Upload a File

Create a Document from a file in any of the formats documented in our knowledge base. Request parameters should be passed as JSON object with the header field `LILT-API`. File names in the header can only contain US-ASCII characters. File names with characters outside of US-ASCII should be URI encoded or transliterated to US-ASCII strings. Example CURL command: ```bash curl -X POST https://api.lilt.com/v2/documents/files?key=API_KEY \ –header \"LILT-API: {\\"name\\": \\"introduction.xliff\\",\\"pretranslate\\": \\"tm+mt\\",\\"project_id\\": 9}\" \ –header \"Content-Type: application/octet-stream\" \ –data-binary @Introduction.xliff ```

Example

import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let 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 = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';

let apiInstance = new LiltNode.DocumentsApi();
let name = "name_example"; // String | A file name.
let projectId = 56; // Number | A unique Project identifier.
let body = "/path/to/file"; // File | The file contents to be uploaded. The entire POST body will be treated as the file. 
let opts = {
  'pretranslate': "pretranslate_example", // String | An optional parameter indicating if and how the document will be pretranslated upon being uploaded. The accepted values are `TM`, or `TM+MT` 
  'autoAccept': true, // Boolean | An optional parameter to auto-accept segments with 100% translation memory matches when the `pretranslate` option is also set, or to auto-accept any target data that is present when the uploaded file is XLIFF. If omitted it will default to your organization settings for `Accept and lock exact matches`, if set to `false`, no segments will be auto-accepted. 
  'caseSensitive': true, // Boolean | An optional parameter to use case sensitive translation memory matching when the `pretranslate` option is also enabled. Matches must have identical character-by-character case to qualify as matches. Default value matches your organization settings for `Use case sensitive translation memory matching` setting 
  'matchAttribution': true, // Boolean | An optional parameter to attribute translation authorship of exact matches to the author of the file when the `pretranslate` option is also enabled. Default value matches your organization settings for `Translation authorship` setting 
  'configId': 56 // Number | An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file. 
};
apiInstance.uploadDocument(name, projectId, body, opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
name String A file name.  
projectId Number A unique Project identifier.  
body File The file contents to be uploaded. The entire POST body will be treated as the file.  
pretranslate String An optional parameter indicating if and how the document will be pretranslated upon being uploaded. The accepted values are `TM`, or `TM+MT` [optional]
autoAccept Boolean An optional parameter to auto-accept segments with 100% translation memory matches when the `pretranslate` option is also set, or to auto-accept any target data that is present when the uploaded file is XLIFF. If omitted it will default to your organization settings for `Accept and lock exact matches`, if set to `false`, no segments will be auto-accepted. [optional]
caseSensitive Boolean An optional parameter to use case sensitive translation memory matching when the `pretranslate` option is also enabled. Matches must have identical character-by-character case to qualify as matches. Default value matches your organization settings for `Use case sensitive translation memory matching` setting [optional]
matchAttribution Boolean An optional parameter to attribute translation authorship of exact matches to the author of the file when the `pretranslate` option is also enabled. Default value matches your organization settings for `Translation authorship` setting [optional]
configId Number An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file. [optional]

Return type

DocumentWithSegments

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers