import type { AuthManager } from './auth.js'; import { type RoolClientInfo } from './client-info.js'; export type WebDAVDepth = '0' | '1' | 'infinity'; export type WebDAVSyncLevel = '1' | 'infinite'; export type WebDAVLockDepth = '0' | 'infinity'; export type WebDAVPropName = 'creationdate' | 'displayname' | 'getcontentlength' | 'getcontenttype' | 'getetag' | 'getlastmodified' | 'lockdiscovery' | 'quota-available-bytes' | 'quota-used-bytes' | 'resourcetype' | 'supportedlock' | 'current-user-privilege-set' | 'supported-report-set' | 'sync-token' | (string & {}); export interface WebDAVConfig { webdavUrl: string; spaceId: string; authManager: AuthManager; clientInfo?: RoolClientInfo; /** Called on shard refusal/drain (421/503). Return the new WebDAV base URL. */ onRefused?: () => Promise; } export interface SpaceFileStorageUsage { /** Bytes currently used by files in this space. */ usedBytes: number; /** Bytes still available, or null when the plan has no storage limit. */ availableBytes: number | null; /** Total storage limit, or null when the plan has no storage limit. */ limitBytes: number | null; } export interface WebDAVRequestInit extends RequestInit { /** Treat the path as a collection URL, i.e. include the trailing slash. */ collection?: boolean; } export interface WebDAVWriteResult { status: 200 | 201 | 204; etag: string | null; location: string | null; } export interface WebDAVLockResult { status: 200 | 201; token: string; timeoutSeconds: number | null; locks: WebDAVActiveLock[]; xml: string; } export interface WebDAVMultiStatus { status: 207; xml: string; responses: WebDAVResponse[]; } export interface WebDAVSyncCollectionResult extends WebDAVMultiStatus { token: string; } export interface WebDAVResponse { href: string; path: string; isCollection: boolean; status: number | null; props: WebDAVProps; propstats: WebDAVPropstat[]; } export interface WebDAVPropstat { status: number; props: Record; } export interface WebDAVProps { creationdate?: string; displayname?: string; getcontentlength?: number; getcontenttype?: string; getetag?: string; getlastmodified?: string; resourcetype?: 'collection' | ''; quotaUsedBytes?: number; quotaAvailableBytes?: number | null; canWrite?: boolean; locks?: WebDAVActiveLock[]; syncToken?: string; supportedReports?: string[]; [key: string]: unknown; } export interface WebDAVActiveLock { token: string | null; owner: string | null; depth: WebDAVLockDepth | null; timeoutSeconds: number | null; root: string | null; scope: 'exclusive' | 'shared' | null; type: 'write' | null; } export declare class WebDAVError extends Error { status: number; statusText: string; body: string; constructor(response: Response, body: string); } /** WebDAV client for a space's authenticated file storage. */ export declare class RoolWebDAV { private webdavUrl; private spaceId; private authManager; private onRefused?; private clientInfo; constructor(config: WebDAVConfig); /** Update the WebDAV base URL (used after shard rerouting). */ setWebDAVUrl(webdavUrl: string): void; /** Return the WebDAV href for a machine path. */ href(path?: string, options?: { collection?: boolean; }): string; /** Return the absolute WebDAV URL for a machine path. */ url(path?: string, options?: { collection?: boolean; }): string; /** Low-level WebDAV request for a machine path. Adds Rool auth and returns the raw Response. */ request(method: string, path?: string, init?: WebDAVRequestInit): Promise; options(path?: string): Promise; propfind(path: string, options: { depth: WebDAVDepth; props?: 'allprop' | 'propname' | WebDAVPropName[]; signal?: AbortSignal; }): Promise; syncCollection(path: string, options: { token?: string | null; level: WebDAVSyncLevel; props?: 'allprop' | WebDAVPropName[]; limit?: number; signal?: AbortSignal; }): Promise; /** Return WebDAV quota usage for this space. */ getStorageUsage(): Promise; get(path: string, options?: { range?: string | { start: number; end?: number; }; signal?: AbortSignal; }): Promise; head(path: string): Promise; put(path: string, body: BodyInit, options?: { contentType?: string; /** Create missing parent collections atomically (Rool-Create-Parents). */ createParents?: boolean; ifMatch?: string; ifNoneMatch?: string; lockToken?: string; signal?: AbortSignal; headers?: HeadersInit; }): Promise; delete(path: string, options?: { collection?: boolean; ifMatch?: string; lockToken?: string; headers?: HeadersInit; }): Promise; mkcol(path: string, options?: { lockToken?: string; headers?: HeadersInit; }): Promise; copy(source: string, destination: string, options?: { depth?: '0' | 'infinity'; overwrite?: boolean; lockToken?: string; headers?: HeadersInit; }): Promise; move(source: string, destination: string, options?: { overwrite?: boolean; lockToken?: string; headers?: HeadersInit; }): Promise; lock(path: string, options: { collection?: boolean; depth: WebDAVLockDepth; owner?: string; timeoutSeconds?: number; signal?: AbortSignal; }): Promise; refreshLock(path: string, token: string, options?: { collection?: boolean; timeoutSeconds?: number; signal?: AbortSignal; }): Promise; unlock(token: string): Promise; private moveOrCopy; private authenticatedFetch; private pathUrl; } //# sourceMappingURL=webdav.d.ts.map