smartexpose/ts/classes.exposeprovider.ts
2024-04-24 18:02:21 +02:00

43 lines
1.1 KiB
TypeScript

import * as plugins from './plugins.js';
/**
* An expose provider provides a standardized interface for exposing data
* Note: SmartExpose comes with some default implmentations of ExposeProvider
*
* notably:
* - WebDavExposeProvider
*/
export abstract class ExposeProvider {
/**
* Should take care of any housekeeping required to keep things in a healthy state.
*/
public abstract houseKeeping(): Promise<void>;
/**
* should return a url with info about how to access the file
* @param optionsArg
*/
public abstract exposeFile(optionsArg: {
smartFile: plugins.smartfile.SmartFile,
deleteAfterMillis?: number,
privateUrl?: boolean, // wether the returned url should be private by design
}): Promise<{
url: string;
id: string;
status: 'created' | 'updated';
}>;
public abstract start(): Promise<void>;
public abstract stop(): Promise<void>;
public abstract wipeAll(): Promise<{
id: string;
status: 'deleted' | 'failed' | 'notfound';
}[]>
public abstract deleteFileById(idArg: string): Promise<{
id: string;
status: 'deleted' | 'failed' | 'notfound';
}>
}