ADR 0008: Cloud Drive Providers Use SDK Client Wrappers + Options-Based Auth

Status

Accepted — 2025-12-15

Context

Cloud drive providers (OneDrive/Google Drive/Dropbox) are API-first systems that require OAuth token management and typically ship vendor SDKs with their own abstractions.

We also want consumers to have a clear “swap point” for advanced scenarios and for tests.

Problem

If providers accept only raw vendor SDK clients:

If we re-implement all REST calls ourselves:

Decision

For cloud-drive providers we standardize on:

  1. Small wrapper interfaces used by the storage implementation:
    • OneDrive: IOneDriveClient
    • Google Drive: IGoogleDriveClient
    • Dropbox: IDropboxClientWrapper
  2. Options allow multiple configuration styles:
    • Provide the wrapper directly (options.Client = ...) for full control.
    • Provide a raw SDK client (options.DropboxClient = ...) where supported.
    • Provide credentials/tokens so the provider can construct the SDK client when no client is supplied.

This keeps provider logic:

flowchart LR
  App[Application code] --> Opts[Provider options]
  Opts -->|wrapper provided| Wrap[IOneDriveClient / IGoogleDriveClient / IDropboxClientWrapper]
  Opts -->|no wrapper| Build[Provider builds SDK client from credentials]
  Build --> Wrap
  Wrap --> Storage[Provider storage]
  Storage --> I[IStorage]

Alternatives Considered

  1. Expose only raw SDK clients
    • Pros: minimal wrapper code in the library.
    • Cons: weak testability; pushes complexity into consumer apps; SDK contract leaks.
  2. Call REST directly (no SDK)
    • Pros: full control; easy to inject HttpClient.
    • Cons: large maintenance burden; re-implementing vendor SDK behaviour.
  3. SDK wrapper interfaces + options-based auth (chosen)
    • Pros: stable swap point; behaviour-driven HTTP tests; reasonable consumer experience.
    • Cons: wrapper maintenance; requires good credential docs for each provider.

Consequences

Positive

Negative

References (Internal)