Classes
Type Definitions
ClientConfig :object
Properties:
| Name | Type | Attributes | Default | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
projectId |
string |
<optional> |
The project ID from the Google Developer's
Console, e.g. 'grape-spaceship-123'. We will also check the environment
variable |
|||||||||||||
key |
string |
<optional> |
An API key. You should prefer using a Service Account key file instead of an API key. |
|||||||||||||
keyFilename |
string |
<optional> |
Full path to the a .json, .pem, or .p12 key
downloaded from the Google Developers Console. If you provide a path to a
JSON file, the |
|||||||||||||
email |
string |
<optional> |
Account email address. Required when using a .pem or .p12 keyFilename. |
|||||||||||||
credentials |
object |
<optional> |
Credentials object. Properties
|
|||||||||||||
autoRetry |
boolean |
<optional> |
true |
Automatically retry requests if the response is related to rate limits or certain intermittent server errors. We will exponentially backoff subsequent requests by default. |
||||||||||||
maxRetries |
number |
<optional> |
3 |
Maximum number of automatic retries attempted before returning the error. |
||||||||||||
promise |
Constructor |
<optional> |
Custom promise module to use instead of native Promises. |
- Source:
DetectCallback(errnullable, results, apiResponse)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error |
<nullable> |
Request error, if any. |
||||||||||||
results |
object | Array.<object> |
The detection results. Properties
|
|||||||||||||
apiResponse |
object |
The full API response. |
- Source:
DetectResult :object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
0.language |
string |
The language code matched from the input. |
|
0.confidence |
number |
<optional> |
A float 0 - 1. The higher the number, the higher the confidence in language detection. Note, this is not always returned from the API. |
1 |
object |
The full API response. |
- Source:
GetLanguagesCallback(errnullable, results, apiResponse)
Parameters:
| Name | Type | Attributes | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
Error |
<nullable> |
Request error, if any. |
|||||||||
results |
Array.<object> |
The languages supported by the API. Properties
|
||||||||||
apiResponse |
object |
The full API response. |
- Source:
LanguageResult :object
Properties:
| Name | Type | Description |
|---|---|---|
code |
string |
The ISO 639-1 language code. |
name |
string |
The language name. This can be translated into your
preferred language with the |
- Source:
TranslateCallback(errnullable, translations, apiResponse)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
err |
Error |
<nullable> |
Request error, if any. |
translations |
object | Array.<object> |
If a single string input was given, a single translation is given. Otherwise, it is an array of translations. |
|
apiResponse |
object |
The full API response. |
- Source:
TranslateRequest :object
Translate request options.
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
format |
string |
<optional> |
Set the text's format as |
from |
string |
<optional> |
The ISO 639-1 language code the source input is written in. |
model |
string |
<optional> |
Set the model type requested for this translation. Please refer to the upstream documentation for possible values. |
to |
string |
The ISO 639-1 language code to translate the input to. |
- Source: