Skip to content

Commit

Permalink
feat: add definition
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Sep 3, 2024
1 parent 3a9ed2b commit 3d123de
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
import type { PluginListenerHandle } from "@capacitor/core";

export interface uploadOption {
id: string;
filePath: string;
serverUrl: string;
notificationTitle: number;
headers: {
[key: string]: string;
}
}
export interface UploadEvent {
/**
* Current status of upload, between 0 and 100.
*
*/
name: 'uploading' | 'completed' | 'failed';
payload: {
percent?: number;
error?: string;
}
id: string;
}

export interface UploaderPlugin {
echo(options: { value: string }): Promise<{ value: string }>;
startUpload(options: uploadOption): Promise<{ value: string }>;
removeUpload(options: { id: string }): Promise<void>;
addListener(
eventName: "events",
listenerFunc: (state: UploadEvent) => void,
): Promise<PluginListenerHandle>;
}

0 comments on commit 3d123de

Please sign in to comment.