Feature: Dropbox Provider (ManagedCode.Storage.Dropbox)
Purpose
Expose Dropbox as IStorage so .NET apps can use the Dropbox API via a consistent upload/download/list/delete abstraction:
- upload/download/list/delete through a consistent API
- support “library-managed client creation” from credentials for the common cases
- keep a clean swap point (
IDropboxClientWrapper) for tests and advanced scenarios
Main Flows
flowchart LR
App --> DB[DropboxStorage : IDropboxStorage]
DB --> Client[IDropboxClientWrapper]
Client --> DropboxAPI[Dropbox API]
Components
- Storage:
- Client wrapper:
- Options / DI:
DI Wiring
dotnet add package ManagedCode.Storage.Dropbox
Access token (simple):
using ManagedCode.Storage.Dropbox.Extensions;
builder.Services.AddDropboxStorageAsDefault(options =>
{
options.AccessToken = configuration["Dropbox:AccessToken"];
options.RootPath = "/Apps/my-app";
});
Refresh token (recommended for production/offline access):
using ManagedCode.Storage.Dropbox.Extensions;
builder.Services.AddDropboxStorageAsDefault(options =>
{
options.RefreshToken = configuration["Dropbox:RefreshToken"];
options.AppKey = configuration["Dropbox:AppKey"];
options.AppSecret = configuration["Dropbox:AppSecret"]; // optional in PKCE flows
options.RootPath = "/Apps/my-app";
});
Current Behavior
Supported configuration modes:
- Provide a swap point (tests / custom behaviour):
DropboxStorageOptions.Client(customIDropboxClientWrapper)
- Provide credentials and let the provider build the SDK client:
AccessToken(+ optionalDropboxClientConfig)- OR
RefreshToken+AppKey(+ optionalAppSecret,DropboxClientConfig)
RootPath scopes all operations (for App Folder apps use /Apps/<your-app>).
Tests
- HTTP/SDK-level fake:
- Storage behaviour via fake client:
- DI + provider plumbing:
Configuration Notes
See docs/Development/credentials.md and README.md for step-by-step instructions on creating an app, enabling scopes, and obtaining tokens.