smartexpose/ts/classes.exposeprovider.ts

53 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-04-22 11:13:00 +00:00
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';
}>;
2024-04-26 11:51:45 +00:00
public abstract exposeFileArray(optionsArg: {
smartFiles: plugins.smartfile.SmartFile[],
deleteAfterMillis?: number,
privateUrl?: boolean,
}): Promise<{
url: string;
id: string;
status: 'created' | 'updated';
}[]>;
2024-04-22 11:13:00 +00:00
public abstract start(): Promise<void>;
public abstract stop(): Promise<void>;
public abstract wipeAll(): Promise<{
id: string;
status: 'deleted' | 'failed' | 'notfound';
}[]>
2024-04-24 16:02:21 +00:00
public abstract deleteFileById(idArg: string): Promise<{
2024-04-22 11:13:00 +00:00
id: string;
status: 'deleted' | 'failed' | 'notfound';
}>
}