UNPKG

ecoledirecte.js

Version:

Good-looking client for EcoleDirecte's private API.

63 lines (62 loc) 1.88 kB
/// <reference types="node" /> import { cloudResFolder, cloudResFile, role } from "ecoledirecte-api-types/v3"; import { Account } from "../accounts"; export declare class Cloud { _root: cloudResFolder; _owner: Account; constructor(root: cloudResFolder, owner: Account); get quota(): number; get size(): number; root(): Folder; /** * @description Will fetch the desired path */ get(path: string): Promise<Folder | File | null>; } export declare class Folder { type: "folder"; name: string; path: string; size: number; children: Array<Folder | File>; _raw: cloudResFolder; private _cloud; constructor(o: cloudResFolder, cloud: Cloud); load(force?: boolean): Promise<Folder>; /** * @description Loads every children recursively. Non-destructive. * @returns New Folder instance with every children. The files aren't downloaded. */ loadFullTree(): Promise<Folder>; /** * @description Returns the requested path from its children (doesn't fetch anything) */ get(path: string): Folder | File | null; } export declare class File { type: "file"; name: string; path: string; extension: string; date: Date; owner?: { id: number; type: role; firstName: string; lastName: string; particle?: string; }; _raw: cloudResFile; private _cloud; constructor(o: cloudResFile, cloud: Cloud); private _downloaded?; private _downloadedUri?; download(token?: string): Promise<Buffer>; get downloaded(): { buffer?: Buffer; uri?: string; }; } export declare function getExtension(name: string): string; export declare function cleanPath(dirty: string, prefix: string): string; export declare function getFullTree(folder: cloudResFolder, cloud: Cloud): Promise<cloudResFolder>;