@robinpath/dropbox
0.1.1Node.jsPublicDropbox module for RobinPath.
Dropbox
Dropbox module for RobinPath.
Package: @robinpath/dropbox | Category: Cloud Storage | Type: Integration
Authentication
dropbox.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 dropbox module when you need to:
- listFolder -- Use
dropbox.listFolderto perform this operation - getMetadata -- Use
dropbox.getMetadatato perform this operation - createFolder -- Use
dropbox.createFolderto perform this operation - deleteEntry -- Use
dropbox.deleteEntryto perform this operation - moveEntry -- Use
dropbox.moveEntryto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure dropbox credentials. | object |
listFolder | listFolder | object |
getMetadata | getMetadata | object |
createFolder | createFolder | object |
deleteEntry | deleteEntry | object |
moveEntry | moveEntry | object |
copyEntry | copyEntry | object |
uploadFile | uploadFile | object |
downloadFile | downloadFile | object |
getTemporaryLink | getTemporaryLink | object |
searchFiles | searchFiles | object |
listRevisions | listRevisions | object |
restoreFile | restoreFile | object |
createSharedLink | createSharedLink | object |
listSharedLinks | listSharedLinks | object |
revokeSharedLink | revokeSharedLink | object |
getSpaceUsage | getSpaceUsage | object |
getCurrentAccount | getCurrentAccount | object |
getPreview | getPreview | object |
Functions
setCredentials
Configure dropbox credentials.
Module: dropbox | Returns: object -- API response.
dropbox.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
accessToken | string | Yes | accessToken |
listFolder
listFolder
Module: dropbox | Returns: object -- API response.
dropbox.listFolder
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getMetadata
getMetadata
Module: dropbox | Returns: object -- API response.
dropbox.getMetadata
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createFolder
createFolder
Module: dropbox | Returns: object -- API response.
dropbox.createFolder
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteEntry
deleteEntry
Module: dropbox | Returns: object -- API response.
dropbox.deleteEntry
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
moveEntry
moveEntry
Module: dropbox | Returns: object -- API response.
dropbox.moveEntry
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
copyEntry
copyEntry
Module: dropbox | Returns: object -- API response.
dropbox.copyEntry
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
uploadFile
uploadFile
Module: dropbox | Returns: object -- API response.
dropbox.uploadFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
downloadFile
downloadFile
Module: dropbox | Returns: object -- API response.
dropbox.downloadFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getTemporaryLink
getTemporaryLink
Module: dropbox | Returns: object -- API response.
dropbox.getTemporaryLink
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
searchFiles
searchFiles
Module: dropbox | Returns: object -- API response.
dropbox.searchFiles
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listRevisions
listRevisions
Module: dropbox | Returns: object -- API response.
dropbox.listRevisions
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
restoreFile
restoreFile
Module: dropbox | Returns: object -- API response.
dropbox.restoreFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createSharedLink
createSharedLink
Module: dropbox | Returns: object -- API response.
dropbox.createSharedLink
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listSharedLinks
listSharedLinks
Module: dropbox | Returns: object -- API response.
dropbox.listSharedLinks
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
revokeSharedLink
revokeSharedLink
Module: dropbox | Returns: object -- API response.
dropbox.revokeSharedLink
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getSpaceUsage
getSpaceUsage
Module: dropbox | Returns: object -- API response.
dropbox.getSpaceUsage
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getCurrentAccount
getCurrentAccount
Module: dropbox | Returns: object -- API response.
dropbox.getCurrentAccount
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getPreview
getPreview
Module: dropbox | Returns: object -- API response.
dropbox.getPreview
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Dropbox API error (${res.status}): ${t} | Check the error message for details |
dropbox.setCredentials requires accessToken. | Check the error message for details |
dropbox.deleteEntry requires an ID. | Check the error message for details |
dropbox.moveEntry requires an ID. | Check the error message for details |
dropbox.copyEntry requires an ID. | Check the error message for details |
dropbox.restoreFile requires an ID. | Check the error message for details |
dropbox.revokeSharedLink requires an ID. | Check the error message for details |
Dropbox: "..." not configured. Call dropbox.setCredentials first. | Check the error message for details |
@desc "List folder and validate result"
do
set $result as dropbox.listFolder
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Folder
Retrieve all items and loop through them.
@desc "Setup authentication"
do
dropbox.setCredentials $token
enddo
@desc "List folder and iterate results"
do
set $result as dropbox.listFolder
each $item in $result
print $item
end
enddo
2. Create a new item with createFolder
Create a new resource and capture the result.
@desc "Setup authentication"
do
dropbox.setCredentials $token
enddo
@desc "Create folder"
do
set $result as dropbox.createFolder
print "Created: " + $result
enddo
3. Check before creating
List existing items and only create if needed.
@desc "Setup authentication"
do
dropbox.setCredentials $token
enddo
@desc "List folder and create folder"
do
set $existing as dropbox.listFolder
if $existing == null
dropbox.createFolder
print "Item created"
else
print "Item already exists"
end
enddo
4. Multi-step Dropbox workflow
Chain multiple dropbox operations together.
@desc "Setup authentication"
do
dropbox.setCredentials $token
enddo
@desc "List folder, get metadata, and more"
do
set $r_listFolder as dropbox.listFolder
set $r_getMetadata as dropbox.getMetadata
set $r_createFolder as dropbox.createFolder
print "All operations complete"
enddo
5. Safe listFolder with validation
Check results before proceeding.
@desc "Setup authentication"
do
dropbox.setCredentials $token
enddo
@desc "List folder and validate result"
do
set $result as dropbox.listFolder
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- s3 -- Amazon S3 module for complementary functionality
- box -- Box module for complementary functionality
- onedrive -- OneDrive module for complementary functionality
- google-drive -- Google Drive module for complementary functionality
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
github
JS@robinpathv0.1.1
GitHub module for RobinPath.
bitbucket
JS@robinpathv0.1.2
Bitbucket module for RobinPath.
box
JS@robinpathv0.1.2
Box module for RobinPath.
cache
JS@robinpathv0.1.2
In-memory key-value cache with optional TTL expiration for temporary data storage
$ robinpath add @robinpath/dropbox
