Skip to main content

Interface: IPluginAPI

Capabilities exposed by StreamShare to one addon instance.

Remarks

Availability depends on the runtime mode and platform. Addons must use runtime capability fields and the public compatibility documentation rather than assuming every method is available everywhere.

Properties

runtime

runtime: PluginRuntime

Execution environment. Headless tasks expose a deadline for cooperative checkpointing.


logger

logger: object

Logger piped to the host and development tools

log()

log(...args): void

Writes a general diagnostic message.

Parameters
args

...unknown[]

Returns

void

info()

info(...args): void

Writes an informational diagnostic message.

Parameters
args

...unknown[]

Returns

void

warn()

warn(...args): void

Writes a warning diagnostic message.

Parameters
args

...unknown[]

Returns

void

error()

error(...args): void

Writes an error diagnostic message.

Parameters
args

...unknown[]

Returns

void


storage

storage: object

Isolated persistent key-value storage for this specific plugin

get()

get(key): Promise<string | null>

Retrieves a string value, or null when the key does not exist.

Parameters
key

string

Returns

Promise<string | null>

set()

set(key, value): Promise<void>

Creates or replaces a string value.

Parameters
key

string

value

string

Returns

Promise<void>

delete()

delete(key): Promise<void>

Removes one key when it exists.

Parameters
key

string

Returns

Promise<void>

clear()

clear(): Promise<void>

Removes every key owned by this addon.

Returns

Promise<void>


files

files: object

Isolated file storage for large plugin-owned datasets. Paths are always relative to the plugin directory; traversal is rejected.

write()

write(path, data, options?): Promise<void>

Creates or updates a UTF-8 file at a package-relative path.

Parameters
path

string

data

string

options?
append?

boolean

Returns

Promise<void>

read()

read(path): Promise<string | null>

Reads a UTF-8 file, or returns null when it does not exist.

Parameters
path

string

Returns

Promise<string | null>

stat()

stat(path): Promise<PluginFileStat>

Returns existence, size, and modification metadata for a file.

Parameters
path

string

Returns

Promise<PluginFileStat>

delete()

delete(path): Promise<void>

Deletes a file when it exists.

Parameters
path

string

Returns

Promise<void>

move()

move(from, to): Promise<void>

Atomically moves or renames a file within the addon's storage.

Parameters
from

string

to

string

Returns

Promise<void>

scanLines()

scanLines(path, options?): Promise<PluginFileScanResult>

Streams matching lines without loading an entire large file into memory.

Parameters
path

string

options?

PluginFileScanOptions

Returns

Promise<PluginFileScanResult>


sourceCatalog

sourceCatalog: object

Indexed, isolated storage for large source catalogs.

A snapshot is invisible until commitSnapshot succeeds, so interactive reads keep using the previous snapshot while a synchronization is running.

beginSnapshot()

beginSnapshot(options?): Promise<string>

Resume a durable unpublished snapshot when requested and available.

Parameters
options?
resume?

boolean

Returns

Promise<string>

append()

append(snapshotId, batch): Promise<PluginSourceCatalogAppendResult>

Appends a bounded batch of logical media and variants to a draft snapshot.

Parameters
snapshotId

string

batch

PluginSourceCatalogBatch

Returns

Promise<PluginSourceCatalogAppendResult>

getSnapshotStats()

getSnapshotStats(snapshotId): Promise<PluginSourceCatalogAppendResult>

Durable row counts, useful when resuming after process termination.

Parameters
snapshotId

string

Returns

Promise<PluginSourceCatalogAppendResult>

commitSnapshot()

commitSnapshot(snapshotId): Promise<void>

Atomically publishes a completed snapshot for interactive queries.

Parameters
snapshotId

string

Returns

Promise<void>

abortSnapshot()

abortSnapshot(snapshotId): Promise<void>

Deletes an unpublished snapshot and its temporary data.

Parameters
snapshotId

string

Returns

Promise<void>

query()

query(criteria): Promise<PluginSourceCatalogResult>

Query unique logical media before pagination.

Parameters
criteria

PluginSourceCatalogQuery

Returns

Promise<PluginSourceCatalogResult>

queryVariants()

queryVariants(criteria): Promise<PluginSourceCatalogResult>

Expand matching logical media into their playable variants.

Parameters
criteria

PluginSourceCatalogQuery

Returns

Promise<PluginSourceCatalogResult>


http

http: object

Native HTTP capability constrained by the manifest network allowlist.

get()

get(url, headers?): Promise<string>

Retrieves raw text content from an allowed HTTP(S) URL.

Parameters
url

string

headers?

Record<string, string>

Returns

Promise<string>


lists

lists: object

Interactive playlist and library management capabilities.

getAll()

getAll(): Promise<PluginList[]>

Returns playlists visible to the current user.

Returns

Promise<PluginList[]>

getById()

getById(id): Promise<PluginListWithItems | null>

Returns one playlist and its items, or null when it does not exist.

Parameters
id

number

Returns

Promise<PluginListWithItems | null>

create()

create(name): Promise<number>

Creates a playlist when permitted by the current account and returns its numeric identifier.

Parameters
name

string

Returns

Promise<number>

addItem()

addItem(listId, item): Promise<number>

Adds one media item to a playlist and returns the new item identifier.

Parameters
listId

number

item

PluginListItemInput

Returns

Promise<number>

addItems()

addItems(listId, items): Promise<number>

Adds multiple media items atomically and returns the number accepted.

Parameters
listId

number

items

PluginListItemInput[]

Returns

Promise<number>

removeItem()

removeItem(itemId): Promise<void>

Removes one playlist item by its item identifier.

Parameters
itemId

number

Returns

Promise<void>

clear()

clear(listId): Promise<void>

Removes every item from a playlist while retaining the playlist.

Parameters
listId

number

Returns

Promise<void>

enrichList()

enrichList(listId): Promise<void>

Requests metadata enrichment for items in a playlist.

Parameters
listId

number

Returns

Promise<void>

Methods

getConfig()

getConfig(): Promise<Readonly<Record<string, string>>>

Retrieves user configuration defined by the addon manifest.

Returns

Promise<Readonly<Record<string, string>>>


toast()

toast(messageOrOptions): void

Displays or updates a user notification.

Parameters

messageOrOptions

string | ToastOptions

Returns

void


dismissToast()

dismissToast(id): void

Dismisses the notification with the supplied stable ID.

Parameters

id

string

Returns

void


setActionProgress()

setActionProgress(progress): void

Sets the progress description for the currently running action.

Parameters

progress

string

Returns

void