@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
98 lines • 4.5 kB
TypeScript
import type { ByteSpool } from '../../io/spool.ts';
import type { ByteWindow } from '../../utils/ranges.ts';
import type { TokenManager } from '../google/client.ts';
import type { DriveChange, DriveFile, SharedDrive } from '../google/drive.ts';
/**
* Every Drive request the Google backends make, as one object. A core op
* reaches Drive only through `accessor.drive`. Mirrors Python's `DriveApi`.
*/
export interface DriveApi {
listFiles(opts: {
folderId: string;
driveId?: string | null;
limit?: number;
}): Promise<DriveFile[]>;
listChildren(folderIds: readonly string[], driveId: string | null, limit?: number): Promise<DriveFile[]>;
listSharedDrives(): Promise<SharedDrive[]>;
listAllFiles(opts?: {
mimeType?: string | null;
modifiedAfter?: string | null;
modifiedBefore?: string | null;
}): Promise<{
files: DriveFile[];
complete: boolean;
}>;
searchFiles(text: string, parentIds: readonly string[], mimeType?: string | null): Promise<{
ids: string[];
complete: boolean;
}>;
getFile(fileId: string, fields?: string): Promise<DriveFile>;
storageQuota(): Promise<{
limit?: string;
usage?: string;
}>;
deleteFile(fileId: string): Promise<void>;
downloadFile(fileId: string, window?: ByteWindow): Promise<Uint8Array>;
downloadFileStream(fileId: string): AsyncGenerator<Uint8Array, void>;
createFolder(name: string, parentId: string): Promise<DriveFile>;
uploadFile(name: string, parentId: string, data: Uint8Array | ByteSpool): Promise<DriveFile>;
updateFileContent(fileId: string, data: Uint8Array | ByteSpool): Promise<DriveFile>;
patchFile(fileId: string, opts: {
body: Record<string, unknown>;
addParents?: string;
removeParents?: string;
}): Promise<DriveFile>;
copyFile(fileId: string, name: string, parentId: string): Promise<DriveFile>;
startPageToken(): Promise<string>;
listChanges(pageToken: string): Promise<[DriveChange[], string]>;
captureFileMetadata(fileId: string): Promise<[string | null, string | null]>;
downloadRevision(fileId: string, revisionId: string, window?: ByteWindow): Promise<Uint8Array>;
downloadRevisionStream(fileId: string, revisionId: string): AsyncGenerator<Uint8Array, void>;
}
/** The live `DriveApi`: one token manager, one wire call per method. */
export declare class DriveClient implements DriveApi {
readonly tokenManager: TokenManager;
constructor(tokenManager: TokenManager);
listFiles(opts: {
folderId: string;
driveId?: string | null;
limit?: number;
}): Promise<DriveFile[]>;
listChildren(folderIds: readonly string[], driveId: string | null, limit?: number): Promise<DriveFile[]>;
listSharedDrives(): Promise<SharedDrive[]>;
listAllFiles(opts?: {
mimeType?: string | null;
modifiedAfter?: string | null;
modifiedBefore?: string | null;
}): Promise<{
files: DriveFile[];
complete: boolean;
}>;
searchFiles(text: string, parentIds: readonly string[], mimeType?: string | null): Promise<{
ids: string[];
complete: boolean;
}>;
getFile(fileId: string, fields?: string): Promise<DriveFile>;
storageQuota(): Promise<{
limit?: string;
usage?: string;
}>;
deleteFile(fileId: string): Promise<void>;
downloadFile(fileId: string, window?: ByteWindow): Promise<Uint8Array>;
downloadFileStream(fileId: string): AsyncGenerator<Uint8Array, void>;
createFolder(name: string, parentId: string): Promise<DriveFile>;
uploadFile(name: string, parentId: string, data: Uint8Array | ByteSpool): Promise<DriveFile>;
updateFileContent(fileId: string, data: Uint8Array | ByteSpool): Promise<DriveFile>;
patchFile(fileId: string, opts: {
body: Record<string, unknown>;
addParents?: string;
removeParents?: string;
}): Promise<DriveFile>;
copyFile(fileId: string, name: string, parentId: string): Promise<DriveFile>;
startPageToken(): Promise<string>;
listChanges(pageToken: string): Promise<[DriveChange[], string]>;
captureFileMetadata(fileId: string): Promise<[string | null, string | null]>;
downloadRevision(fileId: string, revisionId: string, window?: ByteWindow): Promise<Uint8Array>;
downloadRevisionStream(fileId: string, revisionId: string): AsyncGenerator<Uint8Array, void>;
}
//# sourceMappingURL=api.d.ts.map