@kentcdodds/dropbox
README.md
65 lines · 2.5 KB · Markdown@kentcdodds/dropbox
Intent
Provide reusable, account-agnostic Dropbox helpers for Kody agents through the standard saved dropbox OAuth integration. Cover common account, metadata, search, transfer, deletion, and sharing workflows while retaining a generic escape hatch for the rest of the Dropbox API.
When To Use
- Inspect the connected Dropbox account or storage usage
- List folders, read metadata, and search for files
- Download or upload file content
- Delete files or create shared links with explicit confirmation
- Call less-common Dropbox RPC and content endpoints through a generic request helper
Required Setup
Connect a Dropbox OAuth integration named dropbox at:
https://kody.codes/connect/oauth?provider=dropbox
The integration needs the scopes required by the operations you call. Common scopes include account_info.read, files.metadata.read, files.metadata.write, files.content.read, files.content.write, sharing.read, and sharing.write.
Safety
Mutating helpers require confirm: true. Pass dryRun: true to inspect a request without sending it. The generic request helper recognizes documented read-only endpoints; all other endpoints require confirmation.
Exports
kody:@kentcdodds/dropbox— package overview and setup guidancekody:@kentcdodds/dropbox/smoke-test— verify OAuth without returning account datakody:@kentcdodds/dropbox/get-current-account— current account detailskody:@kentcdodds/dropbox/get-space-usage— current storage usagekody:@kentcdodds/dropbox/list-folder— list a folder, with optional paginationkody:@kentcdodds/dropbox/get-metadata— metadata for a file or folderkody:@kentcdodds/dropbox/search— search file and folder nameskody:@kentcdodds/dropbox/download— download bytes as base64kody:@kentcdodds/dropbox/upload— upload text or base64 byteskody:@kentcdodds/dropbox/delete— delete a file or folderkody:@kentcdodds/dropbox/create-shared-link— create a shared linkkody:@kentcdodds/dropbox/request— generic authenticated RPC, upload, or download request
Examples
import listFolder from 'kody:@kentcdodds/dropbox/list-folder'
export default async function main() {
return await listFolder({ path: '' })
}import upload from 'kody:@kentcdodds/dropbox/upload'
export default async function main() {
return await upload({
path: '/notes/hello.txt',
text: 'Hello from Kody',
mode: 'overwrite',
confirm: true,
})
}Dropbox paths begin with /; use an empty string for the account root.