import { TokenManager as OAuthTokenManager } from '../api/oauth.ts';
import { ByteSpool } from '../../io/spool.ts';
import { type ByteWindow } from '../../utils/ranges.ts';
import { ApiError } from '../api/errors.ts';
export interface DropboxConfig {
    timeout?: number;
    clientId: string;
    clientSecret?: string;
    refreshToken: string;
    /**
     * Base URL overriding the real Dropbox hosts (integ fakes): one origin
     * serving `/oauth2/token`, the RPC API under `/2`, and content downloads
     * under `/2`. Unset means the production oauth/api/content hosts.
     */
    endpoint?: string;
    refreshFn?: (refreshToken: string) => Promise<{
        accessToken: string;
        expiresIn: number;
    }>;
}
export declare class DropboxApiError extends ApiError {
    readonly status: number;
    /** Dropbox `error_summary` (e.g. "path/not_found/..", "path/conflict/folder/.."). */
    readonly summary: string;
    constructor(message: string, status: number, summary?: string);
}
export declare class DropboxTokenManager extends OAuthTokenManager {
    readonly apiBase: string;
    readonly contentBase: string;
    private readonly config;
    constructor(config: DropboxConfig);
    protected refreshPair(): Promise<[string, number]>;
}
export declare function dropboxRpc(tm: DropboxTokenManager, endpoint: string, body: unknown): Promise<unknown>;
/**
 * Upload one file, overwriting, and return the reply as decoded. Given a
 * `rev`, the upload goes in `update` mode: Dropbox stores it only while the
 * file is still that revision, and answers a 409 `path/conflict` otherwise.
 *
 * The reply is the stored FileMetadata; it is not checked here, since the
 * upload has landed once the call returns and the writer's `uploadToken`
 * reads it without throwing.
 */
export declare function dropboxUpload(tm: DropboxTokenManager, path: string, data: Uint8Array | ByteSpool, rev?: string | null): Promise<unknown>;
/**
 * Download a file, or a byte range of it, with its result header: the raw
 * `Dropbox-API-Result`, or null when the response carries none
 * (`fingerprint.resultOf` reads it).
 */
export declare function dropboxDownload(tm: DropboxTokenManager, path: string, window?: ByteWindow): Promise<[Uint8Array, string | null]>;
/**
 * Stream a file's bytes; `onResponse` is handed its headers, lower-cased as
 * `bytes_response` hands them, before the first chunk.
 */
export declare function dropboxDownloadStream(tm: DropboxTokenManager, path: string, onResponse?: (headers: Record<string, string>) => void): AsyncIterable<Uint8Array>;
//# sourceMappingURL=client.d.ts.map