Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/dropbox

src/get-space-usage.ts

21 lines · 571 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:@kentcdodds/dropbox/get-space-usage'
 * const usage = await getSpaceUsage()
 */
export default async function getSpaceUsage(): Promise<DropboxSpaceUsage> {
	return dropboxRpc<DropboxSpaceUsage>('users/get_space_usage')
}