Files
smartexpose/ts/classes.exposeprovider.ts
T

55 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-04-22 13:13:00 +02:00
import * as plugins from './plugins.js';
/**
* An expose provider provides a standardized interface for exposing data
* Note: SmartExpose comes with some default implementations of ExposeProvider
*
2024-04-22 13:13:00 +02:00
* 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>;
2024-04-22 13:13:00 +02:00
/**
* should return a url with info about how to access the file
* @param optionsArg
2024-04-22 13:13:00 +02:00
*/
public abstract exposeFile(optionsArg: {
smartFile: plugins.smartfile.SmartFile;
deleteAfterMillis?: number;
privateUrl?: boolean; // whether the returned url should be private by design
2024-04-22 13:13:00 +02:00
}): Promise<{
url: string;
id: string;
status: 'created' | 'updated';
}>;
2024-04-26 13:51:45 +02:00
public abstract exposeFileArray(optionsArg: {
smartFiles: plugins.smartfile.SmartFile[];
deleteAfterMillis?: number;
privateUrl?: boolean;
2024-04-26 13:51:45 +02:00
}): Promise<{
url: string;
id: string;
status: 'created' | 'updated';
}[]>;
2024-04-22 13:13:00 +02:00
public abstract start(): Promise<void>;
public abstract stop(): Promise<void>;
public abstract wipeAll(): Promise<{
id: string;
status: 'deleted' | 'failed' | 'notfound';
}[]>;
2024-04-24 18:02:21 +02:00
public abstract deleteFileById(idArg: string): Promise<{
2024-04-22 13:13:00 +02:00
id: string;
status: 'deleted' | 'failed' | 'notfound';
}>;
}