Modules@robinpath/onedrive
onedrive

@robinpath/onedrive

0.1.2Node.jsPublic

OneDrive 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.listChildren to perform this operation
  • getItem -- Use onedrive.getItem to perform this operation
  • getItemByPath -- Use onedrive.getItemByPath to perform this operation
  • createFolder -- Use onedrive.createFolder to perform this operation
  • deleteItem -- Use onedrive.deleteItem to perform this operation

Quick Reference

FunctionDescriptionReturns
setCredentialsConfigure onedrive credentials.object
listChildrenlistChildrenobject
getItemgetItemobject
getItemByPathgetItemByPathobject
createFoldercreateFolderobject
deleteItemdeleteItemobject
moveItemmoveItemobject
copyItemcopyItemobject
uploadFileuploadFileobject
downloadFiledownloadFileobject
searchFilessearchFilesobject
createSharingLinkcreateSharingLinkobject
listSharedWithMelistSharedWithMeobject
getPermissionsgetPermissionsobject
getDriveInfogetDriveInfoobject
listDriveslistDrivesobject
getRecentFilesgetRecentFilesobject
getThumbnailsgetThumbnailsobject
uploadLargeFileuploadLargeFileobject

Functions

setCredentials

Configure onedrive credentials.

Module: onedrive | Returns: object -- API response.

onedrive.setCredentials
ParameterTypeRequiredDescription
accessTokenstringYesaccessToken

listChildren

listChildren

Module: onedrive | Returns: object -- API response.

onedrive.listChildren
ParameterTypeRequiredDescription
inputstringNoInput parameter

getItem

getItem

Module: onedrive | Returns: object -- API response.

onedrive.getItem
ParameterTypeRequiredDescription
inputstringNoInput parameter

getItemByPath

getItemByPath

Module: onedrive | Returns: object -- API response.

onedrive.getItemByPath
ParameterTypeRequiredDescription
inputstringNoInput parameter

createFolder

createFolder

Module: onedrive | Returns: object -- API response.

onedrive.createFolder
ParameterTypeRequiredDescription
inputstringNoInput parameter

deleteItem

deleteItem

Module: onedrive | Returns: object -- API response.

onedrive.deleteItem
ParameterTypeRequiredDescription
inputstringNoInput parameter

moveItem

moveItem

Module: onedrive | Returns: object -- API response.

onedrive.moveItem
ParameterTypeRequiredDescription
inputstringNoInput parameter

copyItem

copyItem

Module: onedrive | Returns: object -- API response.

onedrive.copyItem
ParameterTypeRequiredDescription
inputstringNoInput parameter

uploadFile

uploadFile

Module: onedrive | Returns: object -- API response.

onedrive.uploadFile
ParameterTypeRequiredDescription
inputstringNoInput parameter

downloadFile

downloadFile

Module: onedrive | Returns: object -- API response.

onedrive.downloadFile
ParameterTypeRequiredDescription
inputstringNoInput parameter

searchFiles

searchFiles

Module: onedrive | Returns: object -- API response.

onedrive.searchFiles
ParameterTypeRequiredDescription
inputstringNoInput parameter

createSharingLink

createSharingLink

Module: onedrive | Returns: object -- API response.

onedrive.createSharingLink
ParameterTypeRequiredDescription
inputstringNoInput parameter

listSharedWithMe

listSharedWithMe

Module: onedrive | Returns: object -- API response.

onedrive.listSharedWithMe
ParameterTypeRequiredDescription
inputstringNoInput parameter

getPermissions

getPermissions

Module: onedrive | Returns: object -- API response.

onedrive.getPermissions
ParameterTypeRequiredDescription
inputstringNoInput parameter

getDriveInfo

getDriveInfo

Module: onedrive | Returns: object -- API response.

onedrive.getDriveInfo
ParameterTypeRequiredDescription
inputstringNoInput parameter

listDrives

listDrives

Module: onedrive | Returns: object -- API response.

onedrive.listDrives
ParameterTypeRequiredDescription
inputstringNoInput parameter

getRecentFiles

getRecentFiles

Module: onedrive | Returns: object -- API response.

onedrive.getRecentFiles
ParameterTypeRequiredDescription
inputstringNoInput parameter

getThumbnails

getThumbnails

Module: onedrive | Returns: object -- API response.

onedrive.getThumbnails
ParameterTypeRequiredDescription
inputstringNoInput parameter

uploadLargeFile

uploadLargeFile

Module: onedrive | Returns: object -- API response.

onedrive.uploadLargeFile
ParameterTypeRequiredDescription
inputstringNoInput parameter

Error Handling

All functions throw on failure. Common errors:

ErrorCause
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)

VersionTagPublished
0.1.2latest1 months ago
Install
$ robinpath add @robinpath/onedrive

Collaborators

Dumitru Balaban
Dumitru Balaban
@dumitru
View all @robinpath modules
Version0.1.2
LicenseMIT
Unpacked Size4.8 KB
Versions1
Weekly Downloads21
Total Downloads21
Stars0
Last Publish1 months ago
Created1 months ago

Category

devops