Class: SampleConnector

Class: SampleConnector

QuickNav

SampleConnector

new SampleConnector()

Source:

Methods

createJob(req, res) → {HttpResponse.<SampleConnector.JobStatus>}

Create a translation job from a POST request. The job is stored in the connector persistence store and will be used to correlate translation requests from OCE to the Language Service Provider. The job "status" is set to "CREATED". The corresponding REST API endpoint is: POST: /connector/rest/api/v1/job
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
body object Body object extracted from the 'req' parameter.
Properties
Name Type Description
name string Name of the job to create.
header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
workflowId string The identifier for the workflow to use when translating files in this job.
res object HTTPS response object.
Source:
Returns:
Type
HttpResponse.<SampleConnector.JobStatus>

deleteJob(req, res) → {HttpResponse.<string>}

Remove the job and all associated data from the translation connector The corresponding REST API endpoint is: DELETE: /connector/rest/api/v1/job/:id
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
params object Parameters passed on the URL.
Properties
Name Type Description
id string Identifier for the connector job to retrieve.
header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
res object HTTPS response object.
Source:
Returns:
confirmation that deletion succeeded
Type
HttpResponse.<string>

getApiVersions(req, res) → {HttpResponse.<array>}

Return the array of API versions supported by this server The corresponding REST API endpoint is: GET: /connector/rest/api
Parameters:
Name Type Description
req object HTTPS request object.
res object HTTPS response object.
Source:
Returns:
["v1"]
Type
HttpResponse.<array>

getJob(req, res) → {HttpResponse.<SampleConnector.JobStatus>}

Get the translation connector job details, status and translation progress that corresponds to the given job ID from a GET request. The corresponding REST API endpoint is: GET: /connector/rest/api/v1/job/:id
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
params object Parameters passed on the URL.
Properties
Name Type Description
id string Identifier for the connector job to retrieve.
res.header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
res object HTTPS response object.
Source:
Returns:
Type
HttpResponse.<SampleConnector.JobStatus>

getServer(req, res) → {HttpResponse.<object>}

Return the connector configuration of this translation connector server The corresponding REST API endpoint is: GET: /connector/rest/api/v1/server
Parameters:
Name Type Description
req object HTTPS request object.
res object HTTPS response object.
Source:
Returns:
JSON describing the server configuration
Type
HttpResponse.<object>

getTranslation(req, res) → {HttpResponse.<SampleConnector.ZipFileStream>}

Get the translated zip file for the specified connector job identifier. The corresponding REST API endpoint is: GET: /connector/rest/api/v1/job/:id/translation
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
params object Parameters passed on the URL.
Properties
Name Type Description
id string Identifier for the connector job to retrieve.
header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
res object HTTPS response object.
Source:
Returns:
Type
HttpResponse.<SampleConnector.ZipFileStream>

refreshTranslation(req, res) → {HttpResponse.<SampleConnector.JobStatus>}

Refreshes (re-fetches) the translation files from the LSP server for the job ID passed on the URL. The corresponding REST API endpoint is: POST: /connector/rest/api/v1/job/:id/translate The job "status" is updated to "IMPORTING" until all files have been extracted from the zip and corresponding documents created in the Language Service Provider.
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
params object Parameters passed on the URL.
Properties
Name Type Description
id string Identifier for the connector job to retrieve.
body stream Contents of the zip file passed as a stream
header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
res object HTTPS response object.
Source:
Returns:
Type
HttpResponse.<SampleConnector.JobStatus>

translateJob(req, res) → {HttpResponse.<SampleConnector.JobStatus>}

Translate the POSTed zip from the request body using the connector job identifier passed on the URL. The corresponding REST API endpoint is: POST: /connector/rest/api/v1/job/:id/translate The job "status" is updated to "IMPORTING" until all files have been extracted from the zip and corresponding documents created in the Language Service Provider.
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
params object Parameters passed on the URL.
Properties
Name Type Description
id string Identifier for the connector job to retrieve.
body stream Contents of the zip file passed as a stream
header object Parameters passed on via the header.
Properties
Name Type Description
BearerToken string OAuth Bearer token to connect to the Language Service Provider
res object HTTPS response object.
Source:
Returns:
Type
HttpResponse.<SampleConnector.JobStatus>

validateBasicAuthorization(req, res) → {HttpResponse.<true>}

Validate that the Basic Auth security is enabled and working The corresponding REST API endpoint is: GET: /connector/rest/api/v1/authorization/basicAuthorization
Parameters:
Name Type Description
req object HTTPS request object.
Properties
Name Type Description
header object Parameters passed on via the header.
Properties
Name Type Description
X-CEC-UserName string Username for basic auth validation.
X-CEC-Pwd string Password to use for basic auth validation.
res object HTTPS response object.
Source:
Returns:
confirmation that can connect using basic auth
Type
HttpResponse.<true>

Type Definitions

JobStatus

Type:
  • Object
Properties:
Name Type Description
properties object Properties of the job
Properties
Name Type Description
id string The connector job identifier for the requested job.
title string The connector job label created for this job identifier.
workflowId string The identifier for the workflow to use when translating files in this job.
status 'CREATED' | 'IMPORTING' | 'TRANSLATING' | 'DOWNLOADING' | 'TRANSLATED' The status of the job.
progress number Percentage progress through the translation of the job.
Source:

ZipFileStream

Type:
  • Object
Properties:
Name Type Attributes Default Description
Content-Type string <optional>
'application/zip' Content Type Response Header - application type
Content-Length string <optional>
{size of zip file} Content Length Response Header - size of the zip file
zipfile stream Contents of the zip file
Source: