lilt-node

Lilt API Binding for Javascript

View the Project on GitHub lilt/lilt-node

LiltNode.FilesApi

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

Method HTTP request Description
addLabel POST /files/labels Add Label to File
deleteFile DELETE /files Delete a File
download GET /files/download Download file
getFiles GET /files Retrieve a File
removeLabel DELETE /files/labels Remove Label from File
uploadFile POST /files Upload a File

addLabel

addLabel(id, name)

Add Label to File

Add a label to a File. Example CURL: ``` curl –X –request POST 'https://lilt.com/2/files/labels?key=API_KEY&id=1' –header 'Content-Type: application/json' \ –data-raw '{ \"name\": \"label_name\" }' ```

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.FilesApi();
let id = "id_example"; // String | A File id.
let name = new LiltNode.AddFileLabelRequest(); // AddFileLabelRequest | 
apiInstance.addLabel(id, name).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String A File id.  
name AddFileLabelRequest    

Return type

null (empty response body)

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

deleteFile

FileDeleteResponse deleteFile(id)

Delete a File

Delete a File. Example CURL command: ``` curl -X DELETE https://lilt.com/2/files?key=API_KEY&id=123 ```

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.FilesApi();
let id = 56; // Number | A unique File identifier.
apiInstance.deleteFile(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique File identifier.  

Return type

FileDeleteResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

download

Blob download(id)

Download file

Download a File. Example CURL: ``` curl –X –request GET 'https://lilt.com/2/files/download?key=API_KEY&id=1' ```

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.FilesApi();
let id = "id_example"; // String | A File id.
apiInstance.download(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String A File id.  

Return type

Blob

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

getFiles

[SourceFile] getFiles(opts)

Retrieve a File

Retrieves one or more files available to your user. Files are not associated with a project or a memory. They are unprocessed and can be used later in the project/document creation workflow step. To retrieve a specific file, specify the <strong>id</strong> request parameter. To retrieve all files, omit the <strong>id</strong> request parameter. Example CURL command: ``` curl -X GET https://lilt.com/2/files?key=API_KEY&id=274```

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.FilesApi();
let opts = {
  'id': 56, // Number | A unique File identifier.
  'labels': ["null"] // [String] | One or more labels. This will return the files which contain all of the given labels. 
};
apiInstance.getFiles(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique File identifier. [optional]
labels [String] One or more labels. This will return the files which contain all of the given labels. [optional]

Return type

[SourceFile]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

removeLabel

removeLabel(id, name)

Remove Label from File

Remove a label from a File. Example CURL: ``` curl –X –request DELETE 'https://lilt.com/2/files/labels?key=API_KEY&id=1&name=label_name' ```

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.FilesApi();
let id = "id_example"; // String | A File id.
let name = "name_example"; // String | A label name.
apiInstance.removeLabel(id, name).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id String A File id.  
name String A label name.  

Return type

null (empty response body)

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

uploadFile

SourceFile uploadFile(name, body, opts)

Upload a File

Upload a File in any of the formats documented in our knowledge base. Request parameters should be passed in as query string parameters. Example CURL command: ``` curl -X POST https://lilt.com/2/files?key=API_KEY&name=en_US.json \ –header \"Content-Type: application/octet-stream\" \ –data-binary @en_US.json ``` Calls to GET /files are used to monitor the language detection results. The API response will be augmented to include detected language and confidence score. The language detection will complete asynchronously. Prior to completion, the `detected_lang` value will be `zxx`, the reserved ISO 639-2 code for \"No linguistic content/not applicable\". If the language can not be determined, or the detection process fails, the `detected_lang` field will return `und`, the reserved ISO 639-2 code for undetermined language, and the `detected_lang_confidence` score will be `0`.

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.FilesApi();
let name = "name_example"; // String | A file name.
let body = "/path/to/file"; // File | The file contents to be uploaded. The entire POST body will be treated as the file.
let opts = {
  'fileHash': "fileHash_example", // String | A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn't provided.
  'langId': true, // Boolean | Flag indicating whether to perform language detection on the uploaded file. Default is false.
  'projectId': 56, // Number | The project to associate the uploaded file with.
  'category': "category_example", // String | The category of the file. The options are `REFERENCE`, or `API`. The default is API. Files with the `REFERENCE` category will be displayed as reference material.
  'labels': "labels_example" // String | Comma-separated list of labels to add to the uploaded document.
};
apiInstance.uploadFile(name, 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.  
body File The file contents to be uploaded. The entire POST body will be treated as the file.  
fileHash String A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn't provided. [optional]
langId Boolean Flag indicating whether to perform language detection on the uploaded file. Default is false. [optional]
projectId Number The project to associate the uploaded file with. [optional]
category String The category of the file. The options are `REFERENCE`, or `API`. The default is API. Files with the `REFERENCE` category will be displayed as reference material. [optional]
labels String Comma-separated list of labels to add to the uploaded document. [optional]

Return type

SourceFile

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers