@robinpath/onedrive
0.1.2Node.jsPublicOneDrive module for RobinPath.
OneDrive
OneDrive module for RobinPath.
Package: @robinpath/onedrive | Category: Cloud Storage | Type: Integration
Authentication
onedrive.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 onedrive module when you need to:
- listChildren -- Use
onedrive.listChildrento perform this operation - getItem -- Use
onedrive.getItemto perform this operation - getItemByPath -- Use
onedrive.getItemByPathto perform this operation - createFolder -- Use
onedrive.createFolderto perform this operation - deleteItem -- Use
onedrive.deleteItemto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure onedrive credentials. | object |
listChildren | listChildren | object |
getItem | getItem | object |
getItemByPath | getItemByPath | object |
createFolder | createFolder | object |
deleteItem | deleteItem | object |
moveItem | moveItem | object |
copyItem | copyItem | object |
uploadFile | uploadFile | object |
downloadFile | downloadFile | object |
searchFiles | searchFiles | object |
createSharingLink | createSharingLink | object |
listSharedWithMe | listSharedWithMe | object |
getPermissions | getPermissions | object |
getDriveInfo | getDriveInfo | object |
listDrives | listDrives | object |
getRecentFiles | getRecentFiles | object |
getThumbnails | getThumbnails | object |
uploadLargeFile | uploadLargeFile | object |
Functions
setCredentials
Configure onedrive credentials.
Module: onedrive | Returns: object -- API response.
onedrive.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
accessToken | string | Yes | accessToken |
listChildren
listChildren
Module: onedrive | Returns: object -- API response.
onedrive.listChildren
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getItem
getItem
Module: onedrive | Returns: object -- API response.
onedrive.getItem
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getItemByPath
getItemByPath
Module: onedrive | Returns: object -- API response.
onedrive.getItemByPath
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createFolder
createFolder
Module: onedrive | Returns: object -- API response.
onedrive.createFolder
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteItem
deleteItem
Module: onedrive | Returns: object -- API response.
onedrive.deleteItem
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
moveItem
moveItem
Module: onedrive | Returns: object -- API response.
onedrive.moveItem
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
copyItem
copyItem
Module: onedrive | Returns: object -- API response.
onedrive.copyItem
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
uploadFile
uploadFile
Module: onedrive | Returns: object -- API response.
onedrive.uploadFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
downloadFile
downloadFile
Module: onedrive | Returns: object -- API response.
onedrive.downloadFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
searchFiles
searchFiles
Module: onedrive | Returns: object -- API response.
onedrive.searchFiles
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createSharingLink
createSharingLink
Module: onedrive | Returns: object -- API response.
onedrive.createSharingLink
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listSharedWithMe
listSharedWithMe
Module: onedrive | Returns: object -- API response.
onedrive.listSharedWithMe
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getPermissions
getPermissions
Module: onedrive | Returns: object -- API response.
onedrive.getPermissions
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getDriveInfo
getDriveInfo
Module: onedrive | Returns: object -- API response.
onedrive.getDriveInfo
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listDrives
listDrives
Module: onedrive | Returns: object -- API response.
onedrive.listDrives
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getRecentFiles
getRecentFiles
Module: onedrive | Returns: object -- API response.
onedrive.getRecentFiles
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getThumbnails
getThumbnails
Module: onedrive | Returns: object -- API response.
onedrive.getThumbnails
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
uploadLargeFile
uploadLargeFile
Module: onedrive | Returns: object -- API response.
onedrive.uploadLargeFile
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Onedrive API error (${res.status}): ${t} | Check the error message for details |
onedrive.setCredentials requires accessToken. | Check the error message for details |
onedrive.deleteItem requires an ID. | Check the error message for details |
onedrive.moveItem requires an ID. | Check the error message for details |
onedrive.copyItem requires an ID. | Check the error message for details |
Onedrive: "..." not configured. Call onedrive.setCredentials first. | Check the error message for details |
@desc "List children and validate result"
do
set $result as onedrive.listChildren
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Children
Retrieve all items and loop through them.
@desc "Setup authentication"
do
onedrive.setCredentials $token
enddo
@desc "List children and iterate results"
do
set $result as onedrive.listChildren
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
onedrive.setCredentials $token
enddo
@desc "Create folder"
do
set $result as onedrive.createFolder
print "Created: " + $result
enddo
3. Check before creating
List existing items and only create if needed.
@desc "Setup authentication"
do
onedrive.setCredentials $token
enddo
@desc "List children and create folder"
do
set $existing as onedrive.listChildren
if $existing == null
onedrive.createFolder
print "Item created"
else
print "Item already exists"
end
enddo
4. Multi-step OneDrive workflow
Chain multiple onedrive operations together.
@desc "Setup authentication"
do
onedrive.setCredentials $token
enddo
@desc "List children, get item, and more"
do
set $r_listChildren as onedrive.listChildren
set $r_getItem as onedrive.getItem
set $r_getItemByPath as onedrive.getItemByPath
print "All operations complete"
enddo
5. Safe listChildren with validation
Check results before proceeding.
@desc "Setup authentication"
do
onedrive.setCredentials $token
enddo
@desc "List children and validate result"
do
set $result as onedrive.listChildren
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- s3 -- Amazon S3 module for complementary functionality
- dropbox -- Dropbox module for complementary functionality
- box -- Box 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.2 | 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/onedrive
