Skip to content
← Public packages

@kody/dropbox

Reusable Dropbox OAuth helpers for account, metadata, search, file transfer, sharing, and generic API requests.

src/get-space-usage.ts

21 lines · 565 B · TypeScript
import { dropboxRpc } from './request.ts'

export type DropboxSpaceUsage = {
	used: number
	allocation: {
		'.tag': 'individual' | 'team'
		allocated?: number
		used?: number
		user_within_team_space_allocated?: number
	}
}

/**
 * Return Dropbox storage usage and allocation for the connected account.
 * @example
 * import getSpaceUsage from 'kody:@kody/dropbox/get-space-usage'
 * const usage = await getSpaceUsage()
 */
export default async function getSpaceUsage(): Promise<DropboxSpaceUsage> {
	return dropboxRpc<DropboxSpaceUsage>('users/get_space_usage')
}