@rsweeten/dropbox-sync
Version:
Reusable Dropbox synchronization module with framework adapters
57 lines (56 loc) • 1.84 kB
TypeScript
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import type { DropboxCredentials, DropboxSyncClient, SyncOptions, SyncResult, TokenResponse } from '../core/types';
export declare class DropboxSyncService {
private http;
private client;
constructor(http: HttpClient);
/**
* Initialize the Dropbox sync client with credentials
*/
initialize(credentials: DropboxCredentials): DropboxSyncClient;
/**
* Get the current Dropbox sync client instance, or initialize with credentials if not exists
*/
getClient(credentials?: DropboxCredentials): DropboxSyncClient;
/**
* Check the connection status with Dropbox
*/
checkConnection(): Observable<boolean>;
/**
* Start the OAuth flow to connect to Dropbox
*/
connectDropbox(): void;
/**
* Disconnect from Dropbox
*/
disconnectDropbox(): Observable<boolean>;
/**
* Start the sync process
*/
startSync(options?: Partial<SyncOptions>): Observable<SyncResult>;
/**
* Cancel an ongoing sync process
*/
cancelSync(): void;
/**
* Set up socket listeners for sync events
* Returns an RxJS Observable that emits sync progress events
*/
setupSocketListeners(): Observable<any>;
/**
* Handle OAuth callback on the client side
*/
handleOAuthCallback(code: string): Observable<TokenResponse>;
/**
* Create a sync queue to determine which files need to be uploaded/downloaded
*/
createSyncQueue(options?: Partial<SyncOptions>): Observable<{
uploadQueue: string[];
downloadQueue: string[];
}>;
}
/**
* Function to extract credentials from Angular environment
*/
export declare function getCredentialsFromEnvironment(environment: any): DropboxCredentials;