@robinpath/deepl
0.1.1Node.jsPublicDeepL module for RobinPath.
DeepL
DeepL module for RobinPath.
Package: @robinpath/deepl | Category: Ai | Type: Integration
Authentication
deepl.setCredentials "your-credentials"
Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.
Use Cases
Use the deepl module when you need to:
- translateText -- Use
deepl.translateTextto perform this operation - translateBatch -- Use
deepl.translateBatchto perform this operation - getUsage -- Use
deepl.getUsageto perform this operation - listSourceLanguages -- Use
deepl.listSourceLanguagesto perform this operation - listTargetLanguages -- Use
deepl.listTargetLanguagesto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure deepl credentials. | object |
translateText | translateText | object |
translateBatch | translateBatch | object |
getUsage | getUsage | object |
listSourceLanguages | listSourceLanguages | object |
listTargetLanguages | listTargetLanguages | object |
listGlossaryLanguagePairs | listGlossaryLanguagePairs | object |
createGlossary | createGlossary | object |
getGlossary | getGlossary | object |
listGlossaries | listGlossaries | object |
deleteGlossary | deleteGlossary | object |
getGlossaryEntries | getGlossaryEntries | object |
translateDocument | translateDocument | object |
Functions
setCredentials
Configure deepl credentials.
Module: deepl | Returns: object -- API response.
deepl.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
authKey | string | Yes | authKey |
translateText
translateText
Module: deepl | Returns: object -- API response.
deepl.translateText
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
translateBatch
translateBatch
Module: deepl | Returns: object -- API response.
deepl.translateBatch
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getUsage
getUsage
Module: deepl | Returns: object -- API response.
deepl.getUsage
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listSourceLanguages
listSourceLanguages
Module: deepl | Returns: object -- API response.
deepl.listSourceLanguages
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listTargetLanguages
listTargetLanguages
Module: deepl | Returns: object -- API response.
deepl.listTargetLanguages
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listGlossaryLanguagePairs
listGlossaryLanguagePairs
Module: deepl | Returns: object -- API response.
deepl.listGlossaryLanguagePairs
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createGlossary
createGlossary
Module: deepl | Returns: object -- API response.
deepl.createGlossary
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getGlossary
getGlossary
Module: deepl | Returns: object -- API response.
deepl.getGlossary
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listGlossaries
listGlossaries
Module: deepl | Returns: object -- API response.
deepl.listGlossaries
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteGlossary
deleteGlossary
Module: deepl | Returns: object -- API response.
deepl.deleteGlossary
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getGlossaryEntries
getGlossaryEntries
Module: deepl | Returns: object -- API response.
deepl.getGlossaryEntries
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
translateDocument
translateDocument
Module: deepl | Returns: object -- API response.
deepl.translateDocument
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Deepl API error (${res.status}): ${t} | Check the error message for details |
deepl.setCredentials requires authKey. | Check the error message for details |
deepl.deleteGlossary requires an ID. | Check the error message for details |
Deepl: "..." not configured. Call deepl.setCredentials first. | Check the error message for details |
@desc "Translate text and validate result"
do
set $result as deepl.translateText
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Usage
Retrieve all items and loop through them.
@desc "Setup authentication"
do
deepl.setCredentials $token
enddo
@desc "Get usage and iterate results"
do
set $result as deepl.getUsage
each $item in $result
print $item
end
enddo
2. Create a new item with createGlossary
Create a new resource and capture the result.
@desc "Setup authentication"
do
deepl.setCredentials $token
enddo
@desc "Create glossary"
do
set $result as deepl.createGlossary
print "Created: " + $result
enddo
3. Check before creating
List existing items and only create if needed.
@desc "Setup authentication"
do
deepl.setCredentials $token
enddo
@desc "Get usage and create glossary"
do
set $existing as deepl.getUsage
if $existing == null
deepl.createGlossary
print "Item created"
else
print "Item already exists"
end
enddo
4. Multi-step DeepL workflow
Chain multiple deepl operations together.
@desc "Setup authentication"
do
deepl.setCredentials $token
enddo
@desc "Translate text, translate batch, and more"
do
set $r_translateText as deepl.translateText
set $r_translateBatch as deepl.translateBatch
set $r_getUsage as deepl.getUsage
print "All operations complete"
enddo
5. Safe translateText with validation
Check results before proceeding.
@desc "Setup authentication"
do
deepl.setCredentials $token
enddo
@desc "Translate text and validate result"
do
set $result as deepl.translateText
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- openai -- OpenAI module for complementary functionality
- anthropic -- Anthropic module for complementary functionality
- ai -- AI module for complementary functionality
- translate -- Translate module for complementary functionality
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
$ robinpath add @robinpath/deepl
