OSSecureFileWrapper/index.d.ts

49 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-02-01 15:37:12 +00:00
/// <reference types="node" />
2018-02-25 11:20:30 +00:00
import "isomorphic-fetch";
2018-02-01 15:37:12 +00:00
export interface File {
_id: string;
type: "binary" | "text";
name: string;
time: string;
preview: string;
version: string;
}
export interface History {
file: File;
history: File[];
}
export default class SecureFile {
private Server;
private Username;
private PrivateKey;
constructor(server: string, username: string, private_key: string);
private getCode();
2018-03-09 13:24:18 +00:00
makeRequest(endpoint: string, method: "POST" | "GET" | "PUT" | "DELETE", query: any, body?: Buffer): Promise<Response>;
2018-02-25 10:39:01 +00:00
test(): Promise<{
user: string;
test: true;
}>;
2018-02-05 09:32:48 +00:00
list(folder?: string): Promise<File[]>;
2018-02-18 13:03:23 +00:00
create(name: string, data: Buffer, type: "text" | "binary", folder?: string, encrypt?: boolean, preview?: Buffer): Promise<File>;
2018-02-01 15:37:12 +00:00
get(id: string, version?: string): Promise<Buffer>;
update(id: string, data: Buffer, preview?: Buffer): Promise<File>;
delete(id: string): Promise<boolean>;
history(id: string): Promise<History>;
}
2018-03-10 17:33:47 +00:00
export declare class NoConnection extends Error {
type: string;
constructor();
}
2018-02-01 15:37:12 +00:00
export declare class Unauthorized extends Error {
2018-03-10 15:40:59 +00:00
type: string;
2018-02-01 15:37:12 +00:00
constructor();
}
export declare class NotFound extends Error {
2018-03-10 15:40:59 +00:00
type: string;
2018-02-01 15:37:12 +00:00
constructor();
}
export declare class BadRequest extends Error {
2018-03-10 15:40:59 +00:00
type: string;
2018-02-01 15:37:12 +00:00
constructor();
}