@jeepq/capacitor
Version:
Capacitor Plugins Library
323 lines (322 loc) • 9.95 kB
TypeScript
declare module "@capacitor/core" {
interface PluginRegistry {
CapacitorDataStorageSqlite: CapacitorDataStorageSqlitePlugin;
CapacitorVideoPlayer: CapacitorVideoPlayerPlugin;
CapacitorSQLite: CapacitorSQLitePlugin;
}
}
/**
* Capacitor Data Storage Sqlite Plugin
*/
export interface CapacitorDataStorageSqlitePlugin {
echo(options: {
value: string;
}): Promise<{
value: string;
}>;
/**
* Open a store
* @param {capOpenStorageOptions} options {database: string, table: string}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
openStore(options: capOpenStorageOptions): Promise<capDataStorageResult>;
/**
* Set or Add a table to an existing store
* @param {capOpenStorageOptions} options {table: string}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
setTable(options: capOpenStorageOptions): Promise<capDataStorageResult>;
/**
* Store a data with given key and value
* @param {capDataStorageOptions} options {key: string, value: string}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
set(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Retrieve a data value for a given data key
* @param {capDataStorageOptions} options {key:"foo",value:"foovalue"}
* @returns {Promise<capDataStorageResult>} {value:string}
*/
get(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Remove a data with given key
* @param {capDataStorageOptions} options {key:"foo"}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
remove(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Clear the Data Store (delete all keys)
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
clear(): Promise<capDataStorageResult>;
/**
* Check if a data key exists
* @param {capDataStorageOptions} options {key:"foo"}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
iskey(options: capDataStorageOptions): Promise<capDataStorageResult>;
/**
* Get the data key list
* @returns {Promise<capDataStorageResult>} {keys:Array<string>}
*/
keys(): Promise<capDataStorageResult>;
/**
* Get the data value list
* @returns {Promise<capDataStorageResult>} {values:Array<string>}
*/
values(): Promise<capDataStorageResult>;
/**
* Get the data key/value pair list
* @returns {Promise<capDataStorageResult>} {keysvalues:Array<{key:string,value:string}>}
*/
keysvalues(): Promise<capDataStorageResult>;
/**
* Delete a store
* @param {capOpenStorageOptions} options {database: string}
* @returns {Promise<capDataStorageResult>} {result:boolean}
*/
deleteStore(options: capOpenStorageOptions): Promise<capDataStorageResult>;
}
export interface capOpenStorageOptions {
/**
* The storage database name
*/
database?: string;
/**
* The storage table name
*/
table?: string;
/**
* Set to true for database encryption
*/
encrypted?: boolean;
/***
* Set the mode for database ancryption
* ["encryption", "secret","newsecret"]
*/
mode?: string;
}
export interface capDataStorageOptions {
/**
* The data name
*/
key: string;
/**
* The data value when required
*/
value?: string;
}
export interface capDataStorageResult {
/**
* result set to true when successful else false
*/
result?: boolean;
/**
* the data value for a given data key
*/
value?: string;
/**
* the data key list as an Array
*/
keys?: Array<string>;
/**
* the data values list as an Array
*/
values?: Array<string>;
/**
* the data keys/values list as an Array of {key:string,value:string}
*/
keysvalues?: Array<any>;
/**
* a message
*/
message?: string;
}
/**
* Capacitor Video Player Plugin
*/
export interface CapacitorVideoPlayerPlugin {
/**
* Initialize a video
* @param {capVideoPlayerOptions} options { url: string }
* @returns {Promise<VideoPlayerResult>} {result: boolean}
*/
initPlayer(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Play the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
play(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Pause the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
pause(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Get the duration of the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
getDuration(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Get the current time of the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
getCurrentTime(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Set the current time to seek the current video to from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
setCurrentTime(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Get the volume of the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
getVolume(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Set the volume of the current video to from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
setVolume(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Get the muted of the current video from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
getMuted(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
/**
* Set the muted of the current video to from a given playerId
*
* @param options
* @returns {Promise<VideoPlayerResult>} {result: boolean, method: string, value:string}
*/
setMuted(options: capVideoPlayerOptions): Promise<capVideoPlayerResult>;
}
export interface capVideoPlayerOptions {
/**
* The url of the video to play
*/
mode: string;
url: string;
playerId: string;
width: number;
height: number;
volume: number;
seektime: number;
muted: boolean;
videoList: Array<any>;
pageTitle: string;
}
export interface capVideoPlayerResult {
/**
* result set to true when successful else false
*/
result?: boolean;
method?: string;
value?: any;
}
/**
* Capacitor Sqlite Plugin
*/
export interface CapacitorSQLitePlugin {
echo(options: {
value: string;
}): Promise<{
value: string;
}>;
/**
* Open a SQLite database
* @param {capSQLiteOptions} options {database: string, encrypted?: boolean, mode?: string}
* @returns {Promise<capSQLiteResult>} {result:boolean}
*/
open(options: capSQLiteOptions): Promise<capSQLiteResult>;
/**
* Close a SQLite database
* @param {capSQLiteOptions} options {database: string}
* @returns {Promise<capSQLiteResult>} {result:boolean}
*/
close(options: capSQLiteOptions): Promise<capSQLiteResult>;
/**
* Execute a Set of Raw Statements
* @param {capSQLiteOptions} options {statements: string}
* @returns {Promise<capSQLiteResult>} {changes:number}
*/
execute(options: capSQLiteOptions): Promise<capSQLiteResult>;
/**
* Execute a Single Statement
* @param {capSQLiteOptions} options {statement: string, values:Array<any> }
* @returns {Promise<capSQLiteResult>} {changes:number}
*/
run(options: capSQLiteOptions): Promise<capSQLiteResult>;
/**
* Query a Single Statement
* @param {capSQLiteOptions} options {statement: string, values:Array<string> }
* @returns {Promise<capSQLiteResult>} {values:Array<any>}
*/
query(options: capSQLiteOptions): Promise<capSQLiteResult>;
/**
* Delete a SQLite database
* @param {capSQLiteOptions} options {database: string}
* @returns {Promise<capSQLiteResult>} {result:boolean}
*/
deleteDatabase(options: capSQLiteOptions): Promise<capSQLiteResult>;
}
export interface capSQLiteOptions {
/**
* The database name
*/
database?: string;
/**
* The batch of raw SQL statements
*/
statements?: string;
/**
* A statement
*/
statement?: string;
/**
* A set of values for a statement
*/
values?: Array<any>;
/**
* Set to true for database encryption
*/
encrypted?: boolean;
/***
* Set the mode for database encryption
* ["encryption", "secret","newsecret"]
*/
mode?: string;
}
export interface capSQLiteResult {
/**
* result set to true when successful else false
*/
result?: boolean;
/**
* the number of changes from an execute or run command
*/
changes?: number;
/**
* the data values list as an Array
*/
values?: Array<any>;
/**
* a message
*/
message?: string;
}