Dropbox
The dropbox module lets editors search and import files from a linked Dropbox account through Brightspot's federated search.
Dependencies
Depends on db-http, the Dropbox Core Java SDK (com.dropbox.core:dropbox-core-sdk, Dropbox API v2), and com.psddev:dropbox-upload for the application key setting used alongside this module's application secret setting.
Installation
- Maven
- Gradle
- Gradle (Kotlin DSL)
<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>dropbox</artifactId>
<version>1.0.0</version>
</dependency>
// Requires Brightspot 5.0 or later.
implementation 'com.brightspot.dbhttp:dropbox:1.0.0'
// Requires Brightspot 5.0 or later.
implementation("com.brightspot.dbhttp:dropbox:1.0.0")
API reference
com.psddev.dropbox.DropboxDatabase
Extends HttpDatabase. When an editor searches with a keyword, the database calls Dropbox's full-text search API; with no keyword, it recursively lists the editor's entire linked Dropbox account. Both cases return all matching results before applying offset/limit locally, since the Dropbox API doesn't support arbitrary offset-based paging.
com.psddev.dropbox.DropboxFile
Extends ExternalItem.
| Field | Type | Description |
|---|---|---|
dropboxId | String | The Dropbox file Id. |
title | String | The file name. |
dropboxPath | String | The file's display path in Dropbox. |
lastModified | Date | The file's server-modified time in Dropbox. |
Configuration
The application secret is stored on DropboxSettings, a Modification<CmsTool> shown under Site Settings > Integrations > Dropbox. The application key is read from the com.psddev:dropbox-upload dependency's own settings. Each editor additionally links their own Dropbox account (DropboxAccountAccess) before they can search Dropbox; until they do, the search panel shows an authentication prompt instead of results.
Extending the plugin
The module doesn't ship a content type for imported files. To let editors create one from search results, define a content type and extend ExternalItemConverter<DropboxFile, T> to convert the external item into it on import, downloading the file's content through the Dropbox API.